Merge branch 'master' of https://github.com/CPM-INDIA-SALES-AND-MARKETING-PVT-LTD/GSKORANGEV1 into GG_Update_Manifest
# Conflicts: # GSKMTOrange/src/main/AndroidManifest.xml
This commit is contained in:
+366
-371
@@ -72,14 +72,11 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
RecyclerView rec_t2p;
|
RecyclerView rec_t2p;
|
||||||
|
|
||||||
String categoryName, categoryId;
|
String categoryName, categoryId;
|
||||||
|
|
||||||
private SharedPreferences preferences;
|
|
||||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow;
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow;
|
||||||
|
|
||||||
String path = "", str = CommonString.FILE_PATH, _pathforcheck = "", img = "";
|
String path = "", str = CommonString.FILE_PATH, _pathforcheck = "", img = "";
|
||||||
int child_position = -1;
|
int child_position = -1;
|
||||||
|
|
||||||
String error_msg;
|
String error_msg;
|
||||||
|
private SharedPreferences preferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -174,142 +171,6 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class T2PAdapter extends RecyclerView.Adapter<T2PAdapter.ViewHolder> {
|
|
||||||
|
|
||||||
private ArrayList<T2PGetterSetter> list;
|
|
||||||
|
|
||||||
public T2PAdapter(ArrayList<T2PGetterSetter> t2PList) {
|
|
||||||
list = t2PList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
||||||
View view = LayoutInflater.from(parent.getContext())
|
|
||||||
.inflate(R.layout.t2p_item_layout, parent, false);
|
|
||||||
return new ViewHolder(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(final ViewHolder holder, final int position) {
|
|
||||||
|
|
||||||
final T2PGetterSetter mItem = list.get(position);
|
|
||||||
holder.tv_brand.setText(mItem.getBrand());
|
|
||||||
holder.tv_display.setText(mItem.getDisplay().trim());
|
|
||||||
|
|
||||||
//holder.tv_display.setTypeface(FontManager.getTypeface(getApplicationContext(),FontManager.FONTAWESOME));
|
|
||||||
|
|
||||||
/* Typeface iconFont = FontManager.getTypeface(getApplicationContext(), FontManager.FONTAWESOME);
|
|
||||||
FontManager.markAsIconContainer(findViewById(R.id.icons_container), iconFont);
|
|
||||||
*/
|
|
||||||
holder.btn_gaps.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
|
|
||||||
showGapsDialog(mItem);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
holder.toggle_btn.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
|
|
||||||
mItem.setPresent(((ToggleButton) v).getText().toString().equalsIgnoreCase("Yes"));
|
|
||||||
|
|
||||||
t2PAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
holder.btn_sku.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
showSkuDialog(mItem.getSkulist());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!img.equalsIgnoreCase("")) {
|
|
||||||
if (position == child_position) {
|
|
||||||
mItem.setImage(img);
|
|
||||||
img = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(camera_allow.equals("1")){
|
|
||||||
|
|
||||||
holder.img_cam.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
_pathforcheck = "T2P_Image_" + store_id + "_" + mItem.getBrand_id() + mItem.getDisplay_id() + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
|
||||||
child_position = position;
|
|
||||||
path = str + _pathforcheck;
|
|
||||||
|
|
||||||
startCameraActivity();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (mItem.getImage().equals("")) {
|
|
||||||
holder.img_cam.setBackgroundResource(R.mipmap.camera_orange);
|
|
||||||
} else {
|
|
||||||
holder.img_cam.setBackgroundResource(R.mipmap.camera_green);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
holder.img_cam.setBackgroundResource(R.mipmap.camera_grey);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
holder.toggle_btn.setChecked(mItem.isPresent());
|
|
||||||
|
|
||||||
if (mItem.getGapsChecklist().size() > 0) {
|
|
||||||
holder.btn_gaps.setBackgroundColor(getResources().getColor(R.color.green));
|
|
||||||
} else {
|
|
||||||
holder.btn_gaps.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mItem.getSkulist().size() > 0) {
|
|
||||||
holder.btn_sku.setBackgroundColor(getResources().getColor(R.color.green));
|
|
||||||
} else {
|
|
||||||
holder.btn_sku.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return list.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
public final View mView;
|
|
||||||
public final LinearLayout parentLayout;
|
|
||||||
public final TextView tv_brand, tv_display;
|
|
||||||
public final ImageView img_cam, img_remark;
|
|
||||||
public final Button btn_gaps, btn_sku, btn_ref_img;
|
|
||||||
public final ToggleButton toggle_btn;
|
|
||||||
|
|
||||||
|
|
||||||
public ViewHolder(View view) {
|
|
||||||
super(view);
|
|
||||||
|
|
||||||
mView = view;
|
|
||||||
|
|
||||||
tv_brand = (TextView) mView.findViewById(R.id.tv_brand);
|
|
||||||
tv_display = (TextView) mView.findViewById(R.id.tv_display);
|
|
||||||
img_cam = (ImageView) mView.findViewById(R.id.img_cam);
|
|
||||||
img_remark = (ImageView) mView.findViewById(R.id.img_remark);
|
|
||||||
btn_gaps = (Button) mView.findViewById(R.id.btn_gaps);
|
|
||||||
btn_sku = (Button) mView.findViewById(R.id.btn_sku);
|
|
||||||
btn_ref_img = (Button) mView.findViewById(R.id.btn_ref_image);
|
|
||||||
parentLayout = (LinearLayout) mView.findViewById(R.id.parent_layout);
|
|
||||||
toggle_btn = (ToggleButton) mView.findViewById(R.id.toggle_btn);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showGapsDialog(final T2PGetterSetter t2p) {
|
public void showGapsDialog(final T2PGetterSetter t2p) {
|
||||||
|
|
||||||
final ArrayList<GapsChecklistGetterSetter> gapsChecklist;
|
final ArrayList<GapsChecklistGetterSetter> gapsChecklist;
|
||||||
@@ -504,191 +365,6 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GapsAdapter extends RecyclerView.Adapter<GapsAdapter.ViewHolder> {
|
|
||||||
|
|
||||||
private ArrayList<GapsChecklistGetterSetter> list;
|
|
||||||
|
|
||||||
public GapsAdapter(ArrayList<GapsChecklistGetterSetter> gapsPList) {
|
|
||||||
list = gapsPList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
||||||
View view = LayoutInflater.from(parent.getContext())
|
|
||||||
.inflate(R.layout.gap_checklist_item, parent, false);
|
|
||||||
return new ViewHolder(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(final ViewHolder holder, int position) {
|
|
||||||
|
|
||||||
final GapsChecklistGetterSetter mItem = list.get(position);
|
|
||||||
holder.tv_checklist.setText(mItem.getChecklist());
|
|
||||||
|
|
||||||
holder.tb_present.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
|
|
||||||
mItem.setPresent(((ToggleButton) v).getText().toString().equalsIgnoreCase("Yes"));
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
holder.tb_present.setChecked(mItem.isPresent());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return list.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
public final View mView;
|
|
||||||
public final LinearLayout parentLayout;
|
|
||||||
public final TextView tv_checklist;
|
|
||||||
public final ToggleButton tb_present;
|
|
||||||
|
|
||||||
|
|
||||||
public ViewHolder(View view) {
|
|
||||||
super(view);
|
|
||||||
|
|
||||||
mView = view;
|
|
||||||
|
|
||||||
tv_checklist = (TextView) mView.findViewById(R.id.tv_checklist);
|
|
||||||
tb_present = (ToggleButton) mView.findViewById(R.id.btn_is_present);
|
|
||||||
parentLayout = (LinearLayout) mView.findViewById(R.id.parent_layout);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class CustomAdapter extends ArrayAdapter<String> {
|
|
||||||
|
|
||||||
private Activity activity;
|
|
||||||
private ArrayList data;
|
|
||||||
BrandMasterGetterSetter tempValues = null;
|
|
||||||
LayoutInflater inflater;
|
|
||||||
|
|
||||||
/*************
|
|
||||||
* CustomAdapter Constructor
|
|
||||||
*****************/
|
|
||||||
public CustomAdapter(
|
|
||||||
T2PComplianceActivity activitySpinner,
|
|
||||||
int textViewResourceId,
|
|
||||||
ArrayList objects
|
|
||||||
|
|
||||||
) {
|
|
||||||
super(activitySpinner, textViewResourceId, objects);
|
|
||||||
|
|
||||||
/********** Take passed values **********/
|
|
||||||
activity = activitySpinner;
|
|
||||||
data = objects;
|
|
||||||
/*********** Layout inflator to call external xml layout () **********************/
|
|
||||||
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
|
||||||
return getCustomView(position, convertView, parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
|
||||||
return getCustomView(position, convertView, parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This funtion called for each row ( Called data.size() times )
|
|
||||||
public View getCustomView(int position, View convertView, ViewGroup parent) {
|
|
||||||
|
|
||||||
/********** Inflate spinner_rows.xml file for each row ( Defined below ) ************/
|
|
||||||
View row = inflater.inflate(R.layout.custom_spinner_item, parent, false);
|
|
||||||
|
|
||||||
/***** Get each Model object from Arraylist ********/
|
|
||||||
tempValues = null;
|
|
||||||
tempValues = (BrandMasterGetterSetter) data.get(position);
|
|
||||||
|
|
||||||
TextView label = (TextView) row.findViewById(R.id.tv_text);
|
|
||||||
|
|
||||||
if (position == 0) {
|
|
||||||
|
|
||||||
// Default selected Spinner item
|
|
||||||
label.setText("Select");
|
|
||||||
//sub.setText("");
|
|
||||||
} else {
|
|
||||||
// Set values for spinner each row
|
|
||||||
label.setText(tempValues.getBRAND().get(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CustomSkuAdapter extends ArrayAdapter<String> {
|
|
||||||
|
|
||||||
private Activity activity;
|
|
||||||
private ArrayList data;
|
|
||||||
SkuGetterSetter tempValues = null;
|
|
||||||
LayoutInflater inflater;
|
|
||||||
|
|
||||||
/*************
|
|
||||||
* CustomAdapter Constructor
|
|
||||||
*****************/
|
|
||||||
public CustomSkuAdapter(
|
|
||||||
T2PComplianceActivity activitySpinner,
|
|
||||||
int textViewResourceId,
|
|
||||||
ArrayList objects
|
|
||||||
|
|
||||||
) {
|
|
||||||
super(activitySpinner, textViewResourceId, objects);
|
|
||||||
|
|
||||||
/********** Take passed values **********/
|
|
||||||
activity = activitySpinner;
|
|
||||||
data = objects;
|
|
||||||
/*********** Layout inflator to call external xml layout () **********************/
|
|
||||||
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
|
||||||
return getCustomView(position, convertView, parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
|
||||||
return getCustomView(position, convertView, parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This funtion called for each row ( Called data.size() times )
|
|
||||||
public View getCustomView(int position, View convertView, ViewGroup parent) {
|
|
||||||
|
|
||||||
/********** Inflate spinner_rows.xml file for each row ( Defined below ) ************/
|
|
||||||
View row = inflater.inflate(R.layout.custom_spinner_item, parent, false);
|
|
||||||
|
|
||||||
/***** Get each Model object from Arraylist ********/
|
|
||||||
tempValues = null;
|
|
||||||
tempValues = (SkuGetterSetter) data.get(position);
|
|
||||||
|
|
||||||
TextView label = (TextView) row.findViewById(R.id.tv_text);
|
|
||||||
|
|
||||||
if (position == 0) {
|
|
||||||
|
|
||||||
// Default selected Spinner item
|
|
||||||
label.setText("Select");
|
|
||||||
//sub.setText("");
|
|
||||||
} else {
|
|
||||||
// Set values for spinner each row
|
|
||||||
label.setText(tempValues.getSKU());
|
|
||||||
}
|
|
||||||
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
// Handle action bar item clicks here. The action bar will
|
// Handle action bar item clicks here. The action bar will
|
||||||
@@ -794,6 +470,371 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
boolean flag = true;
|
||||||
|
|
||||||
|
for (int i = 0; i < t2PGetterSetters.size(); i++) {
|
||||||
|
|
||||||
|
if (camera_allow.equals("1") && t2PGetterSetters.get(i).getImage().equals("")) {
|
||||||
|
flag = false;
|
||||||
|
error_msg = getResources().getString(R.string.click_image);
|
||||||
|
break;
|
||||||
|
} else if (t2PGetterSetters.get(i).getGapsChecklist().size() == 0) {
|
||||||
|
flag = false;
|
||||||
|
error_msg = getResources().getString(R.string.fill_gaps_data);
|
||||||
|
break;
|
||||||
|
} else if (t2PGetterSetters.get(i).getSkulist().size() == 0) {
|
||||||
|
flag = false;
|
||||||
|
error_msg = getResources().getString(R.string.fill_sku_data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
//super.onBackPressed();
|
||||||
|
|
||||||
|
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(T2PComplianceActivity.this);
|
||||||
|
builder.setTitle("Parinaam");
|
||||||
|
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||||
|
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton("Cancel ", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
android.app.AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class T2PAdapter extends RecyclerView.Adapter<T2PAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
private ArrayList<T2PGetterSetter> list;
|
||||||
|
|
||||||
|
public T2PAdapter(ArrayList<T2PGetterSetter> t2PList) {
|
||||||
|
list = t2PList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext())
|
||||||
|
.inflate(R.layout.t2p_item_layout, parent, false);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(final ViewHolder holder, final int position) {
|
||||||
|
|
||||||
|
final T2PGetterSetter mItem = list.get(position);
|
||||||
|
holder.tv_brand.setText(mItem.getBrand());
|
||||||
|
holder.tv_display.setText(mItem.getDisplay().trim());
|
||||||
|
|
||||||
|
//holder.tv_display.setTypeface(FontManager.getTypeface(getApplicationContext(),FontManager.FONTAWESOME));
|
||||||
|
|
||||||
|
/* Typeface iconFont = FontManager.getTypeface(getApplicationContext(), FontManager.FONTAWESOME);
|
||||||
|
FontManager.markAsIconContainer(findViewById(R.id.icons_container), iconFont);
|
||||||
|
*/
|
||||||
|
holder.btn_gaps.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
|
||||||
|
showGapsDialog(mItem);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.toggle_btn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
|
||||||
|
mItem.setPresent(((ToggleButton) v).getText().toString().equalsIgnoreCase("Yes"));
|
||||||
|
|
||||||
|
t2PAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
holder.btn_sku.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
showSkuDialog(mItem.getSkulist());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!img.equalsIgnoreCase("")) {
|
||||||
|
if (position == child_position) {
|
||||||
|
mItem.setImage(img);
|
||||||
|
img = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(camera_allow.equals("1")){
|
||||||
|
|
||||||
|
holder.img_cam.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
_pathforcheck = "T2P_Image_" + store_id + "_" + mItem.getBrand_id() + mItem.getDisplay_id() + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
||||||
|
child_position = position;
|
||||||
|
path = str + _pathforcheck;
|
||||||
|
|
||||||
|
startCameraActivity();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (mItem.getImage().equals("")) {
|
||||||
|
holder.img_cam.setBackgroundResource(R.mipmap.camera_orange);
|
||||||
|
} else {
|
||||||
|
holder.img_cam.setBackgroundResource(R.mipmap.camera_green);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
holder.img_cam.setBackgroundResource(R.mipmap.camera_grey);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
holder.toggle_btn.setChecked(mItem.isPresent());
|
||||||
|
|
||||||
|
if (mItem.getGapsChecklist().size() > 0) {
|
||||||
|
holder.btn_gaps.setBackgroundColor(getResources().getColor(R.color.green));
|
||||||
|
} else {
|
||||||
|
holder.btn_gaps.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mItem.getSkulist().size() > 0) {
|
||||||
|
holder.btn_sku.setBackgroundColor(getResources().getColor(R.color.green));
|
||||||
|
} else {
|
||||||
|
holder.btn_sku.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
public final View mView;
|
||||||
|
public final LinearLayout parentLayout;
|
||||||
|
public final TextView tv_brand, tv_display;
|
||||||
|
public final ImageView img_cam, img_remark;
|
||||||
|
public final Button btn_gaps, btn_sku, btn_ref_img;
|
||||||
|
public final ToggleButton toggle_btn;
|
||||||
|
|
||||||
|
|
||||||
|
public ViewHolder(View view) {
|
||||||
|
super(view);
|
||||||
|
|
||||||
|
mView = view;
|
||||||
|
|
||||||
|
tv_brand = (TextView) mView.findViewById(R.id.tv_brand);
|
||||||
|
tv_display = (TextView) mView.findViewById(R.id.tv_display);
|
||||||
|
img_cam = (ImageView) mView.findViewById(R.id.img_cam);
|
||||||
|
img_remark = (ImageView) mView.findViewById(R.id.img_remark);
|
||||||
|
btn_gaps = (Button) mView.findViewById(R.id.btn_gaps);
|
||||||
|
btn_sku = (Button) mView.findViewById(R.id.btn_sku);
|
||||||
|
btn_ref_img = (Button) mView.findViewById(R.id.btn_ref_image);
|
||||||
|
parentLayout = (LinearLayout) mView.findViewById(R.id.parent_layout);
|
||||||
|
toggle_btn = (ToggleButton) mView.findViewById(R.id.toggle_btn);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GapsAdapter extends RecyclerView.Adapter<GapsAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
private ArrayList<GapsChecklistGetterSetter> list;
|
||||||
|
|
||||||
|
public GapsAdapter(ArrayList<GapsChecklistGetterSetter> gapsPList) {
|
||||||
|
list = gapsPList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext())
|
||||||
|
.inflate(R.layout.gap_checklist_item, parent, false);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(final ViewHolder holder, int position) {
|
||||||
|
|
||||||
|
final GapsChecklistGetterSetter mItem = list.get(position);
|
||||||
|
holder.tv_checklist.setText(mItem.getChecklist());
|
||||||
|
|
||||||
|
holder.tb_present.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
|
||||||
|
mItem.setPresent(((ToggleButton) v).getText().toString().equalsIgnoreCase("Yes"));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.tb_present.setChecked(mItem.isPresent());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
public final View mView;
|
||||||
|
public final LinearLayout parentLayout;
|
||||||
|
public final TextView tv_checklist;
|
||||||
|
public final ToggleButton tb_present;
|
||||||
|
|
||||||
|
|
||||||
|
public ViewHolder(View view) {
|
||||||
|
super(view);
|
||||||
|
|
||||||
|
mView = view;
|
||||||
|
|
||||||
|
tv_checklist = (TextView) mView.findViewById(R.id.tv_checklist);
|
||||||
|
tb_present = (ToggleButton) mView.findViewById(R.id.btn_is_present);
|
||||||
|
parentLayout = (LinearLayout) mView.findViewById(R.id.parent_layout);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CustomAdapter extends ArrayAdapter<String> {
|
||||||
|
|
||||||
|
BrandMasterGetterSetter tempValues = null;
|
||||||
|
LayoutInflater inflater;
|
||||||
|
private Activity activity;
|
||||||
|
private ArrayList data;
|
||||||
|
|
||||||
|
/*************
|
||||||
|
* CustomAdapter Constructor
|
||||||
|
*****************/
|
||||||
|
public CustomAdapter(
|
||||||
|
T2PComplianceActivity activitySpinner,
|
||||||
|
int textViewResourceId,
|
||||||
|
ArrayList objects
|
||||||
|
|
||||||
|
) {
|
||||||
|
super(activitySpinner, textViewResourceId, objects);
|
||||||
|
|
||||||
|
/********** Take passed values **********/
|
||||||
|
activity = activitySpinner;
|
||||||
|
data = objects;
|
||||||
|
/*********** Layout inflator to call external xml layout () **********************/
|
||||||
|
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||||
|
return getCustomView(position, convertView, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
return getCustomView(position, convertView, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This funtion called for each row ( Called data.size() times )
|
||||||
|
public View getCustomView(int position, View convertView, ViewGroup parent) {
|
||||||
|
|
||||||
|
/********** Inflate spinner_rows.xml file for each row ( Defined below ) ************/
|
||||||
|
View row = inflater.inflate(R.layout.custom_spinner_item, parent, false);
|
||||||
|
|
||||||
|
/***** Get each Model object from Arraylist ********/
|
||||||
|
tempValues = null;
|
||||||
|
tempValues = (BrandMasterGetterSetter) data.get(position);
|
||||||
|
|
||||||
|
TextView label = (TextView) row.findViewById(R.id.tv_text);
|
||||||
|
|
||||||
|
if (position == 0) {
|
||||||
|
|
||||||
|
// Default selected Spinner item
|
||||||
|
label.setText("Select");
|
||||||
|
//sub.setText("");
|
||||||
|
} else {
|
||||||
|
// Set values for spinner each row
|
||||||
|
label.setText(tempValues.getBRAND().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CustomSkuAdapter extends ArrayAdapter<String> {
|
||||||
|
|
||||||
|
SkuGetterSetter tempValues = null;
|
||||||
|
LayoutInflater inflater;
|
||||||
|
private Activity activity;
|
||||||
|
private ArrayList data;
|
||||||
|
|
||||||
|
/*************
|
||||||
|
* CustomAdapter Constructor
|
||||||
|
*****************/
|
||||||
|
public CustomSkuAdapter(
|
||||||
|
T2PComplianceActivity activitySpinner,
|
||||||
|
int textViewResourceId,
|
||||||
|
ArrayList objects
|
||||||
|
|
||||||
|
) {
|
||||||
|
super(activitySpinner, textViewResourceId, objects);
|
||||||
|
|
||||||
|
/********** Take passed values **********/
|
||||||
|
activity = activitySpinner;
|
||||||
|
data = objects;
|
||||||
|
/*********** Layout inflator to call external xml layout () **********************/
|
||||||
|
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||||
|
return getCustomView(position, convertView, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
return getCustomView(position, convertView, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This funtion called for each row ( Called data.size() times )
|
||||||
|
public View getCustomView(int position, View convertView, ViewGroup parent) {
|
||||||
|
|
||||||
|
/********** Inflate spinner_rows.xml file for each row ( Defined below ) ************/
|
||||||
|
View row = inflater.inflate(R.layout.custom_spinner_item, parent, false);
|
||||||
|
|
||||||
|
/***** Get each Model object from Arraylist ********/
|
||||||
|
tempValues = null;
|
||||||
|
tempValues = (SkuGetterSetter) data.get(position);
|
||||||
|
|
||||||
|
TextView label = (TextView) row.findViewById(R.id.tv_text);
|
||||||
|
|
||||||
|
if (position == 0) {
|
||||||
|
|
||||||
|
// Default selected Spinner item
|
||||||
|
label.setText("Select");
|
||||||
|
//sub.setText("");
|
||||||
|
} else {
|
||||||
|
// Set values for spinner each row
|
||||||
|
label.setText(tempValues.getSKU());
|
||||||
|
}
|
||||||
|
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class SkuAddedAdapter extends RecyclerView.Adapter<SkuAddedAdapter.ViewHolder> {
|
public class SkuAddedAdapter extends RecyclerView.Adapter<SkuAddedAdapter.ViewHolder> {
|
||||||
|
|
||||||
private ArrayList<SkuGetterSetter> list;
|
private ArrayList<SkuGetterSetter> list;
|
||||||
@@ -843,50 +884,4 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValid() {
|
|
||||||
boolean flag = true;
|
|
||||||
|
|
||||||
for (int i = 0; i < t2PGetterSetters.size(); i++) {
|
|
||||||
|
|
||||||
if (camera_allow.equals("1") && t2PGetterSetters.get(i).getImage().equals("")) {
|
|
||||||
flag = false;
|
|
||||||
error_msg = getResources().getString(R.string.click_image);
|
|
||||||
break;
|
|
||||||
} else if (t2PGetterSetters.get(i).getGapsChecklist().size() == 0) {
|
|
||||||
flag = false;
|
|
||||||
error_msg = getResources().getString(R.string.fill_gaps_data);
|
|
||||||
break;
|
|
||||||
} else if (t2PGetterSetters.get(i).getSkulist().size() == 0) {
|
|
||||||
flag = false;
|
|
||||||
error_msg = getResources().getString(R.string.fill_sku_data);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
//super.onBackPressed();
|
|
||||||
|
|
||||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(T2PComplianceActivity.this);
|
|
||||||
builder.setTitle("Parinaam");
|
|
||||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
|
||||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setNegativeButton("Cancel ", new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
android.app.AlertDialog alert = builder.create();
|
|
||||||
alert.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,33 +48,28 @@ import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
|
|||||||
|
|
||||||
public class UploadActivity extends AppCompatActivity {
|
public class UploadActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private Dialog dialog;
|
|
||||||
private ProgressBar pb;
|
|
||||||
private TextView percentage, message;
|
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
ArrayList<CoverageBean> coverageList;
|
ArrayList<CoverageBean> coverageList;
|
||||||
|
|
||||||
private FailureGetterSetter failureGetterSetter = null;
|
|
||||||
private SharedPreferences preferences;
|
|
||||||
String date, userId, app_version;
|
String date, userId, app_version;
|
||||||
|
|
||||||
StoreBean storeData;
|
StoreBean storeData;
|
||||||
String datacheck = "";
|
String datacheck = "";
|
||||||
String[] words;
|
String[] words;
|
||||||
String validity;
|
String validity;
|
||||||
int mid;
|
int mid;
|
||||||
private int factor, k = 0;
|
|
||||||
String errormsg = "", Path;
|
String errormsg = "", Path;
|
||||||
|
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
ArrayList<MSL_AvailabilityGetterSetter> msl_availabilityList;
|
ArrayList<MSL_AvailabilityGetterSetter> msl_availabilityList;
|
||||||
ArrayList<Stock_FacingGetterSetter> stock_facingHeaderList, stock_facingChildList;
|
ArrayList<Stock_FacingGetterSetter> stock_facingHeaderList, stock_facingChildList;
|
||||||
ArrayList<Promo_Compliance_DataGetterSetter> promotionSkuList, additionalPromotionList;
|
ArrayList<Promo_Compliance_DataGetterSetter> promotionSkuList, additionalPromotionList;
|
||||||
ArrayList<T2PGetterSetter> t2PGetterSetters;
|
ArrayList<T2PGetterSetter> t2PGetterSetters;
|
||||||
ArrayList<AddittionalGetterSetter> additionalVisibilityList;
|
ArrayList<AddittionalGetterSetter> additionalVisibilityList;
|
||||||
ArrayList<AdditionalDialogGetterSetter> additionalVisibilitySkuList;
|
ArrayList<AdditionalDialogGetterSetter> additionalVisibilitySkuList;
|
||||||
|
private Dialog dialog;
|
||||||
|
private ProgressBar pb;
|
||||||
|
private TextView percentage, message;
|
||||||
|
private FailureGetterSetter failureGetterSetter = null;
|
||||||
|
private SharedPreferences preferences;
|
||||||
|
private int factor, k = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -97,6 +92,85 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
new UploadTask(this).execute();
|
new UploadTask(this).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String UploadImage(String path, String folder_name) throws Exception {
|
||||||
|
errormsg = "";
|
||||||
|
BitmapFactory.Options o = new BitmapFactory.Options();
|
||||||
|
o.inJustDecodeBounds = true;
|
||||||
|
BitmapFactory.decodeFile(Path + path, o);
|
||||||
|
|
||||||
|
// The new size we want to scale to
|
||||||
|
final int REQUIRED_SIZE = 1639;
|
||||||
|
|
||||||
|
// Find the correct scale value. It should be the power of 2.
|
||||||
|
int width_tmp = o.outWidth, height_tmp = o.outHeight;
|
||||||
|
int scale = 1;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
if (width_tmp < REQUIRED_SIZE && height_tmp < REQUIRED_SIZE)
|
||||||
|
break;
|
||||||
|
width_tmp /= 2;
|
||||||
|
height_tmp /= 2;
|
||||||
|
scale *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decode with inSampleSize
|
||||||
|
BitmapFactory.Options o2 = new BitmapFactory.Options();
|
||||||
|
o2.inSampleSize = scale;
|
||||||
|
Bitmap bitmap = BitmapFactory.decodeFile(Path + path, o2);
|
||||||
|
|
||||||
|
ByteArrayOutputStream bao = new ByteArrayOutputStream();
|
||||||
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bao);
|
||||||
|
byte[] ba = bao.toByteArray();
|
||||||
|
String ba1 = Base64.encodeBytes(ba);
|
||||||
|
|
||||||
|
SoapObject request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_IMAGE);
|
||||||
|
|
||||||
|
String[] split = path.split("/");
|
||||||
|
String path1 = split[split.length - 1];
|
||||||
|
|
||||||
|
request.addProperty("img", ba1);
|
||||||
|
request.addProperty("name", path1);
|
||||||
|
request.addProperty("FolderName", folder_name);
|
||||||
|
|
||||||
|
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||||
|
envelope.dotNet = true;
|
||||||
|
envelope.setOutputSoapObject(request);
|
||||||
|
|
||||||
|
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||||
|
androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_IMAGE, envelope);
|
||||||
|
|
||||||
|
Object result = envelope.getResponse();
|
||||||
|
|
||||||
|
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||||
|
if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
|
||||||
|
return CommonString.KEY_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SAXParserFactory saxPF = SAXParserFactory.newInstance();
|
||||||
|
SAXParser saxP = saxPF.newSAXParser();
|
||||||
|
XMLReader xmlR = saxP.getXMLReader();
|
||||||
|
|
||||||
|
// for failure
|
||||||
|
FailureXMLHandler failureXMLHandler = new FailureXMLHandler();
|
||||||
|
xmlR.setContentHandler(failureXMLHandler);
|
||||||
|
|
||||||
|
InputSource is = new InputSource();
|
||||||
|
is.setCharacterStream(new StringReader(result.toString()));
|
||||||
|
xmlR.parse(is);
|
||||||
|
|
||||||
|
failureGetterSetter = failureXMLHandler.getFailureGetterSetter();
|
||||||
|
|
||||||
|
if (failureGetterSetter.getStatus().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||||
|
errormsg = failureGetterSetter.getErrorMsg();
|
||||||
|
return CommonString.KEY_FAILURE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
new File(Path + path).delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
|
||||||
class Data {
|
class Data {
|
||||||
int value;
|
int value;
|
||||||
String name;
|
String name;
|
||||||
@@ -185,7 +259,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_STORE_COVERAGE, envelope);
|
androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_STORE_COVERAGE, envelope);
|
||||||
|
|
||||||
Object result = (Object) envelope.getResponse();
|
Object result = envelope.getResponse();
|
||||||
|
|
||||||
datacheck = result.toString();
|
datacheck = result.toString();
|
||||||
words = datacheck.split("\\;");
|
words = datacheck.split("\\;");
|
||||||
@@ -240,7 +314,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||||
|
|
||||||
result = (Object) envelope.getResponse();
|
result = envelope.getResponse();
|
||||||
|
|
||||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||||
@@ -309,7 +383,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||||
|
|
||||||
result = (Object) envelope.getResponse();
|
result = envelope.getResponse();
|
||||||
|
|
||||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||||
@@ -368,7 +442,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||||
|
|
||||||
result = (Object) envelope.getResponse();
|
result = envelope.getResponse();
|
||||||
|
|
||||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||||
@@ -427,7 +501,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||||
|
|
||||||
result = (Object) envelope.getResponse();
|
result = envelope.getResponse();
|
||||||
|
|
||||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||||
@@ -532,7 +606,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||||
|
|
||||||
result = (Object) envelope.getResponse();
|
result = envelope.getResponse();
|
||||||
|
|
||||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||||
@@ -547,7 +621,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
data.value = 35;
|
data.value = 35;
|
||||||
data.name = "Additional Visibility Data";
|
data.name = "Additional Visibility Data";
|
||||||
publishProgress(data);
|
publishProgress(data);
|
||||||
@@ -666,7 +740,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||||
|
|
||||||
result = (Object) envelope.getResponse();
|
result = envelope.getResponse();
|
||||||
|
|
||||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||||
@@ -680,7 +754,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data.value = 40;
|
data.value = 40;
|
||||||
data.name = "T2P Data Uploading";
|
data.name = "T2P Data Uploading";
|
||||||
publishProgress(data);
|
publishProgress(data);
|
||||||
@@ -759,7 +833,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_COVERAGE_STATUS, envelope);
|
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_COVERAGE_STATUS, envelope);
|
||||||
|
|
||||||
result = (Object) envelope.getResponse();
|
result = envelope.getResponse();
|
||||||
|
|
||||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||||
return CommonString.METHOD_UPLOAD_COVERAGE_STATUS;
|
return CommonString.METHOD_UPLOAD_COVERAGE_STATUS;
|
||||||
@@ -802,83 +876,4 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String UploadImage(String path, String folder_name) throws Exception {
|
|
||||||
errormsg = "";
|
|
||||||
BitmapFactory.Options o = new BitmapFactory.Options();
|
|
||||||
o.inJustDecodeBounds = true;
|
|
||||||
BitmapFactory.decodeFile(Path + path, o);
|
|
||||||
|
|
||||||
// The new size we want to scale to
|
|
||||||
final int REQUIRED_SIZE = 1639;
|
|
||||||
|
|
||||||
// Find the correct scale value. It should be the power of 2.
|
|
||||||
int width_tmp = o.outWidth, height_tmp = o.outHeight;
|
|
||||||
int scale = 1;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
if (width_tmp < REQUIRED_SIZE && height_tmp < REQUIRED_SIZE)
|
|
||||||
break;
|
|
||||||
width_tmp /= 2;
|
|
||||||
height_tmp /= 2;
|
|
||||||
scale *= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Decode with inSampleSize
|
|
||||||
BitmapFactory.Options o2 = new BitmapFactory.Options();
|
|
||||||
o2.inSampleSize = scale;
|
|
||||||
Bitmap bitmap = BitmapFactory.decodeFile(Path + path, o2);
|
|
||||||
|
|
||||||
ByteArrayOutputStream bao = new ByteArrayOutputStream();
|
|
||||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bao);
|
|
||||||
byte[] ba = bao.toByteArray();
|
|
||||||
String ba1 = Base64.encodeBytes(ba);
|
|
||||||
|
|
||||||
SoapObject request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_IMAGE);
|
|
||||||
|
|
||||||
String[] split = path.split("/");
|
|
||||||
String path1 = split[split.length - 1];
|
|
||||||
|
|
||||||
request.addProperty("img", ba1);
|
|
||||||
request.addProperty("name", path1);
|
|
||||||
request.addProperty("FolderName", folder_name);
|
|
||||||
|
|
||||||
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
|
||||||
envelope.dotNet = true;
|
|
||||||
envelope.setOutputSoapObject(request);
|
|
||||||
|
|
||||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
|
||||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_IMAGE, envelope);
|
|
||||||
|
|
||||||
Object result = (Object) envelope.getResponse();
|
|
||||||
|
|
||||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
|
||||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
|
|
||||||
return CommonString.KEY_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
SAXParserFactory saxPF = SAXParserFactory.newInstance();
|
|
||||||
SAXParser saxP = saxPF.newSAXParser();
|
|
||||||
XMLReader xmlR = saxP.getXMLReader();
|
|
||||||
|
|
||||||
// for failure
|
|
||||||
FailureXMLHandler failureXMLHandler = new FailureXMLHandler();
|
|
||||||
xmlR.setContentHandler(failureXMLHandler);
|
|
||||||
|
|
||||||
InputSource is = new InputSource();
|
|
||||||
is.setCharacterStream(new StringReader(result.toString()));
|
|
||||||
xmlR.parse(is);
|
|
||||||
|
|
||||||
failureGetterSetter = failureXMLHandler.getFailureGetterSetter();
|
|
||||||
|
|
||||||
if (failureGetterSetter.getStatus().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
|
||||||
errormsg = failureGetterSetter.getErrorMsg();
|
|
||||||
return CommonString.KEY_FAILURE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
new File(Path + path).delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user