Panagiotis Triantafyllou

unified screen basket part7

...@@ -17,6 +17,7 @@ import android.widget.ImageView; ...@@ -17,6 +17,7 @@ import android.widget.ImageView;
17 import android.widget.LinearLayout; 17 import android.widget.LinearLayout;
18 import android.widget.TextView; 18 import android.widget.TextView;
19 19
20 +import androidx.appcompat.app.AlertDialog;
20 import androidx.constraintlayout.widget.ConstraintLayout; 21 import androidx.constraintlayout.widget.ConstraintLayout;
21 import androidx.core.content.ContextCompat; 22 import androidx.core.content.ContextCompat;
22 import androidx.core.text.HtmlCompat; 23 import androidx.core.text.HtmlCompat;
...@@ -73,6 +74,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -73,6 +74,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
73 private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false, 74 private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false,
74 mShopsPressed = false, mGiftPressed = false, mEshopPressed = false, mIsUnified = false, 75 mShopsPressed = false, mGiftPressed = false, mEshopPressed = false, mIsUnified = false,
75 mIsActiveUnified = false, mIsFindItPressed = false; 76 mIsActiveUnified = false, mIsFindItPressed = false;
77 + private AlertDialog mErrorAlertDialog;
76 78
77 // =========================================================== 79 // ===========================================================
78 // Methods for/from SuperClass/Interfaces 80 // Methods for/from SuperClass/Interfaces
...@@ -303,10 +305,14 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -303,10 +305,14 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
303 JSONArray shopAvailability = new JSONArray(extraFields.optString("shop_availability")); 305 JSONArray shopAvailability = new JSONArray(extraFields.optString("shop_availability"));
304 if (shopAvailability.length() > 0) { 306 if (shopAvailability.length() > 0) {
305 showChooseMerchantDialog(shopAvailability); 307 showChooseMerchantDialog(shopAvailability);
308 + } else {
309 + errorDialog();
306 } 310 }
307 } catch (JSONException e) { 311 } catch (JSONException e) {
308 e.printStackTrace(); 312 e.printStackTrace();
309 } 313 }
314 + } else {
315 + errorDialog();
310 } 316 }
311 } 317 }
312 } 318 }
...@@ -580,6 +586,18 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -580,6 +586,18 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
580 } 586 }
581 } 587 }
582 588
589 + private void errorDialog() {
590 + if (!isFinishing()) {
591 + mErrorAlertDialog = new AlertDialog.Builder(this)
592 + .setTitle(R.string.cos_dlg_error_supermarket)
593 + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
594 + dialogPositive.dismiss();
595 + })
596 + .setCancelable(false)
597 + .show();
598 + }
599 + }
600 +
583 // =========================================================== 601 // ===========================================================
584 // Inner and Anonymous Classes 602 // Inner and Anonymous Classes
585 // =========================================================== 603 // ===========================================================
......
...@@ -107,6 +107,7 @@ ...@@ -107,6 +107,7 @@
107 <string name="cos_dlg_positive_button">Ενεργοποίηση</string> 107 <string name="cos_dlg_positive_button">Ενεργοποίηση</string>
108 <string name="cos_dlg_negative_button">Απόρριψη</string> 108 <string name="cos_dlg_negative_button">Απόρριψη</string>
109 <string name="cos_dlg_positive_button2">ΟΚ</string> 109 <string name="cos_dlg_positive_button2">ΟΚ</string>
110 + <string name="cos_dlg_error_supermarket">Δεν υπάρχουν διαθέσιμα supermarkets</string>
110 <string name="cos_dlg_positive_button4">Δες το κουπόνι</string> 111 <string name="cos_dlg_positive_button4">Δες το κουπόνι</string>
111 <string name="cos_dlg_positive_button_text">Το δώρο σου ενεργοποιήθηκε επιτυχώς στο My Rewards!</string> 112 <string name="cos_dlg_positive_button_text">Το δώρο σου ενεργοποιήθηκε επιτυχώς στο My Rewards!</string>
112 <string name="cos_dlg_positive_button_text2">Το δώρο σου ενεργοποιήθηκε επιτυχώς στο καλάθι του SUPERMARKET DEALS!</string> 113 <string name="cos_dlg_positive_button_text2">Το δώρο σου ενεργοποιήθηκε επιτυχώς στο καλάθι του SUPERMARKET DEALS!</string>
......