promo_Compliance_spinner_new

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