Panagiotis Triantafyllou

unified screen basket part7

......@@ -17,6 +17,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.core.text.HtmlCompat;
......@@ -73,6 +74,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false,
mShopsPressed = false, mGiftPressed = false, mEshopPressed = false, mIsUnified = false,
mIsActiveUnified = false, mIsFindItPressed = false;
private AlertDialog mErrorAlertDialog;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -303,10 +305,14 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
JSONArray shopAvailability = new JSONArray(extraFields.optString("shop_availability"));
if (shopAvailability.length() > 0) {
showChooseMerchantDialog(shopAvailability);
} else {
errorDialog();
}
} catch (JSONException e) {
e.printStackTrace();
}
} else {
errorDialog();
}
}
}
......@@ -580,6 +586,18 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
}
}
private void errorDialog() {
if (!isFinishing()) {
mErrorAlertDialog = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_error_supermarket)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
})
.setCancelable(false)
.show();
}
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
......
......@@ -107,6 +107,7 @@
<string name="cos_dlg_positive_button">Ενεργοποίηση</string>
<string name="cos_dlg_negative_button">Απόρριψη</string>
<string name="cos_dlg_positive_button2">ΟΚ</string>
<string name="cos_dlg_error_supermarket">Δεν υπάρχουν διαθέσιμα supermarkets</string>
<string name="cos_dlg_positive_button4">Δες το κουπόνι</string>
<string name="cos_dlg_positive_button_text">Το δώρο σου ενεργοποιήθηκε επιτυχώς στο My Rewards!</string>
<string name="cos_dlg_positive_button_text2">Το δώρο σου ενεργοποιήθηκε επιτυχώς στο καλάθι του SUPERMARKET DEALS!</string>
......