Merge pull request #51 from CPM-INDIA-SALES-AND-MARKETING-PVT-LTD/Deepak_promoCompliance_new

promo_Compliance_spinner_new
This commit is contained in:
deepakpathakCPM
2017-06-09 12:20:16 +05:30
committed by GitHub
3 changed files with 52 additions and 69 deletions
@@ -212,7 +212,6 @@ public class T2PComplianceActivity extends AppCompatActivity {
}
@Override
protected void onResume() {
@@ -270,7 +269,8 @@ public class T2PComplianceActivity extends AppCompatActivity {
/* Typeface iconFont = FontManager.getTypeface(getApplicationContext(), FontManager.FONTAWESOME);
FontManager.markAsIconContainer(findViewById(R.id.icons_container), iconFont);
*/ holder.spinner.setOnTouchListener(new View.OnTouchListener() {
*/
holder.spinner.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
userSelect[0] = true;
@@ -281,19 +281,18 @@ public class T2PComplianceActivity extends AppCompatActivity {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
if(userSelect[0]){
if (userSelect[0]) {
userSelect[0] = false;
boolean flag_clear = false;
int present =-1;
int present = -1;
switch (position) {
case 0:
if(mItem.getPresent()==1){
if (mItem.getPresent() == 1) {
flag_clear = true;
}
else{
} else {
mItem.setPresent(-1);
t2PAdapter.notifyDataSetChanged();
}
@@ -306,22 +305,21 @@ public class T2PComplianceActivity extends AppCompatActivity {
break;
case 2:
if(mItem.getPresent()==1){
if (mItem.getPresent() == 1) {
flag_clear = true;
present = 0;
}
else{
} else {
mItem.setPresent(0);
t2PAdapter.notifyDataSetChanged();
}
if(mItem.getPresent()==1)
if (mItem.getPresent() == 1)
break;
break;
}
if(flag_clear){
if (flag_clear) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(T2PComplianceActivity.this);
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
@@ -528,7 +526,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
//if (mItem.isPresent()) {
if (mItem.getPresent()==1) {
if (mItem.getPresent() == 1) {
holder.img_cam.setBackgroundResource(R.mipmap.camera_orange);
} else {
//if not present camera disabled
@@ -555,7 +553,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
if (mItem.getImage1().equals("")) {
//if (mItem.isPresent()) {
if (mItem.getPresent()==1) {
if (mItem.getPresent() == 1) {
holder.img_cam1.setVisibility(View.VISIBLE);
holder.img_cam1.setBackgroundResource(R.mipmap.camera_orange);
@@ -584,7 +582,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
if (mItem.getImage2().equals("")) {
//if (mItem.isPresent()) {
if (mItem.getPresent()==1) {
if (mItem.getPresent() == 1) {
holder.img_cam2.setVisibility(View.VISIBLE);
holder.img_cam2.setBackgroundResource(R.mipmap.camera_orange);
@@ -620,7 +618,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
} else {
//if (mItem.isPresent()) {
if (mItem.getPresent()==1) {
if (mItem.getPresent() == 1) {
holder.img_cam.setBackgroundResource(R.mipmap.new_no_camera_edit);
} else {
//if not present camera disabled
@@ -631,10 +629,9 @@ public class T2PComplianceActivity extends AppCompatActivity {
boolean is_enabled;
//if (mItem.isPresent()) {
if (mItem.getPresent()==1) {
if (mItem.getPresent() == 1) {
is_enabled = true;
}
else {
} else {
is_enabled = false;
}
@@ -654,7 +651,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
if (mItem.getGapsChecklist().size() > 0) {
holder.btn_gaps.setBackgroundColor(getResources().getColor(R.color.green));
} else {
if (mItem.getPresent()==1) {
if (mItem.getPresent() == 1) {
holder.btn_gaps.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
} else {
holder.btn_gaps.setBackgroundColor(getResources().getColor(R.color.grey_background));
@@ -664,24 +661,24 @@ public class T2PComplianceActivity extends AppCompatActivity {
if (mItem.getSkulist().size() > 0) {
holder.btn_sku.setBackgroundColor(getResources().getColor(R.color.green));
} else {
if (mItem.getPresent()==1 && mItem.getCategory_fixture().equals("0")) {
if (mItem.getPresent() == 1 && mItem.getCategory_fixture().equals("0")) {
holder.btn_sku.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
} else {
holder.btn_sku.setBackgroundColor(getResources().getColor(R.color.grey_background));
}
}
switch (mItem.getPresent()){
case -1:
holder.spinner.setSelection(0);
break;
case 0:
holder.spinner.setSelection(2);
break;
case 1:
holder.spinner.setSelection(1);
break;
}
switch (mItem.getPresent()) {
case -1:
holder.spinner.setSelection(0);
break;
case 0:
holder.spinner.setSelection(2);
break;
case 1:
holder.spinner.setSelection(1);
break;
}
}
@Override
@@ -1107,7 +1104,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
for (int i = 0; i < t2PGetterSetters.size(); i++) {
if (t2PGetterSetters.get(i).getPresent()==1) {
if (t2PGetterSetters.get(i).getPresent() == 1) {
//if (camera_allow.equals("1") && t2PGetterSetters.get(i).getImage().equals("")) {
if (t2PGetterSetters.get(i).getGapsChecklist().size() == 0) {
flag = false;
@@ -1129,8 +1126,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
break;
}
}
else if(t2PGetterSetters.get(i).getPresent()==-1){
} else if (t2PGetterSetters.get(i).getPresent() == -1) {
flag = false;
error_msg = getResources().getString(R.string.msg_select_present);
break;
@@ -133,12 +133,11 @@
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:weightSum="5">
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
@@ -151,16 +150,14 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<Spinner
android:id="@+id/toggle_add_InStock"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>
@@ -169,13 +166,11 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:weightSum="5">
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
@@ -188,16 +183,14 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<Spinner
android:id="@+id/toggle_add_promoAnnouncer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
@@ -92,12 +92,11 @@
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:weightSum="5">
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
@@ -110,28 +109,26 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<Spinner
android:id="@+id/spinner_inStock"
android:background="@drawable/spinner_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/>
android:background="@drawable/spinner_bg" />
<ToggleButton
android:visibility="gone"
android:id="@+id/toggle_inStock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/toggle_selector_background"
android:textOff="@string/no"
android:textOn="@string/yes" />
android:textOn="@string/yes"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
@@ -141,12 +138,11 @@
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:weightSum="5">
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
@@ -159,27 +155,25 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<Spinner
android:id="@+id/spinner_promoAnnouncer"
android:background="@drawable/spinner_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/>
android:background="@drawable/spinner_bg" />
<ToggleButton
android:visibility="gone"
android:id="@+id/toggle_promoAnnouncer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/toggle_selector_background"
android:textOff="@string/no"
android:textOn="@string/yes" />
android:textOn="@string/yes"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>