Panagiotis Triantafyllou

merge changes

......@@ -60,8 +60,8 @@ public class MarketPassActivity extends Activity implements View.OnClickListener
private ImageView mIvBack, mIvInfo, mIvBarcode;
private TextView mFontHeader, mPassHeader, mPassSubtitle, mTvBarcode, mTvPassCount, mTvButtonMap;
private LinearLayout mLlMap, mLlParentLogosView;
private boolean mMapPressed = false, mPassInfoPressed = false;
private LinearLayout mLlMap, mLlParentLogosView, mLlOpenSM;
private boolean mMapPressed = false, mPassInfoPressed = false, mOpenSMPressed = false;
private MarketPassDetailsModel mMarketPassDetails;
private RelativeLayout mPbLoading;
private AlertDialog mAlertDialog;
......@@ -80,7 +80,7 @@ public class MarketPassActivity extends Activity implements View.OnClickListener
mFontHeader = findViewById(R.id.textView3);
mIvInfo = findViewById(R.id.iv_coupons_info);
mPassHeader = findViewById(R.id.tv_market_header);
mPassSubtitle = findViewById(R.id.tv_market_subtitle);
// mPassSubtitle = findViewById(R.id.tv_market_subtitle);
mTvBarcode = findViewById(R.id.tv_barcode_value);
mIvBarcode = findViewById(R.id.iv_barcode);
mTvPassCount = findViewById(R.id.tv_total_pass_title);
......@@ -90,10 +90,11 @@ public class MarketPassActivity extends Activity implements View.OnClickListener
mPbLoading = findViewById(R.id.pb_loading);
mPbLoading.setOnTouchListener((v, event) -> true);
mCvMarketDetails = findViewById(R.id.cv_market_details);
mLlOpenSM = findViewById(R.id.ll_total_coupons_value);
WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mFontHeader, mPassHeader);
WarpUtils.renderCustomFont(this, R.font.peridot_regular, mPassSubtitle, mTvBarcode, mTvPassCount);
WarpUtils.renderCustomFont(this, R.font.peridot_semi_bold, mTvButtonMap);
WarpUtils.renderCustomFont(this, R.font.peridot_regular, /*mPassSubtitle,*/ mTvPassCount);
WarpUtils.renderCustomFont(this, R.font.peridot_semi_bold, mTvBarcode, mTvButtonMap);
mPbLoading.setVisibility(View.VISIBLE);
// WarplyManager.getMarketPassDetails(mMarketPassDetailsCallback);
......@@ -159,6 +160,15 @@ public class MarketPassActivity extends Activity implements View.OnClickListener
}
});
ViewCompat.setAccessibilityDelegate(mLlOpenSM, new AccessibilityDelegateCompat() {
@Override
public void onInitializeAccessibilityNodeInfo(View host, @NonNull AccessibilityNodeInfoCompat info) {
super.onInitializeAccessibilityNodeInfo(host, info);
info.setClassName("android.widget.Button");
info.setContentDescription(getString(R.string.cos_market_pass_details));
}
});
initViews();
}
......@@ -168,6 +178,7 @@ public class MarketPassActivity extends Activity implements View.OnClickListener
WarplyAnalyticsManager.logTrackersEvent(this, "screen", "MarketPassScreen");
mMapPressed = false;
mPassInfoPressed = false;
mOpenSMPressed = false;
}
@Override
......@@ -184,8 +195,8 @@ public class MarketPassActivity extends Activity implements View.OnClickListener
return;
}
WarplyAnalyticsManager.logTrackersEvent(this, "click", "MarketPassInfoScreen");
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.openSupermarketCampaign(MarketPassActivity.this)));
WarplyAnalyticsManager.logTrackersEvent(this, "click", "MarketPassMap");
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.openSupermarketMap(MarketPassActivity.this)));
}
}
if (view.getId() == R.id.iv_coupons_info) {
......@@ -202,6 +213,20 @@ public class MarketPassActivity extends Activity implements View.OnClickListener
Intent intent = new Intent(MarketPassActivity.this, MarketPassInfoActivity.class);
startActivity(intent);
return;
}
}
if (view.getId() == R.id.ll_total_coupons_value) {
if (!mOpenSMPressed) {
mOpenSMPressed = true;
if (!WarplyManagerHelper.noInternetDialog(this, true)) {
WarplyManagerHelper.noInternetDialog(this);
return;
}
WarplyAnalyticsManager.logTrackersEvent(this, "click", "MarketPassMapCampaign");
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.openSupermarketPass(MarketPassActivity.this)));
}
}
}
......@@ -214,21 +239,24 @@ public class MarketPassActivity extends Activity implements View.OnClickListener
mIvBack.setOnClickListener(this);
mIvInfo.setOnClickListener(this);
mLlMap.setOnClickListener(this);
mLlOpenSM.setOnClickListener(this);
if (WarplyManagerHelper.getMarketPassDetails() != null) {
// if (mMarketPassDetails != null)
createBarcodeBitmap(WarplyManagerHelper.getMarketPassDetails().getBarcode());
// if (mMarketPassDetails != null) {
String passValue = String.format(Locale.US, "%.2f", WarplyManagerHelper.getMarketPassDetails().getTotalDiscount());
String fullText = String.format(getString(R.string.cos_market_pass_coupons_title), passValue);
int startIndex = fullText.indexOf(passValue);
int endIndex = startIndex + passValue.length();
SpannableStringBuilder sBuilder = new SpannableStringBuilder(fullText);
Typeface typefaceBold = ResourcesCompat.getFont(this, R.font.peridot_bold);
CustomTypefaceSpan typefaceBoldSpan = new CustomTypefaceSpan(typefaceBold);
sBuilder.setSpan(typefaceBoldSpan, startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvPassCount.setText(sBuilder, TextView.BufferType.SPANNABLE);
// String passValue = String.format(Locale.US, "%.2f", WarplyManagerHelper.getMarketPassDetails().getTotalDiscount());
// String fullText = String.format(getString(R.string.cos_market_pass_coupons_title), passValue);
// int startIndex = fullText.indexOf(passValue);
// int endIndex = startIndex + passValue.length();
// SpannableStringBuilder sBuilder = new SpannableStringBuilder(fullText);
// Typeface typefaceBold = ResourcesCompat.getFont(this, R.font.peridot_bold);
// CustomTypefaceSpan typefaceBoldSpan = new CustomTypefaceSpan(typefaceBold);
// sBuilder.setSpan(typefaceBoldSpan, startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
// mTvPassCount.setText(sBuilder, TextView.BufferType.SPANNABLE);
mTvPassCount.setText(R.string.cos_market_pass_details);
// }
// if (mMarketPassDetails != null) {
......
......@@ -147,7 +147,7 @@ public class WarplyManagerHelper {
mMarketPassDetails = marketPassDetails;
}
public static String openSupermarketCampaign(Context context) {
public static String openSupermarketMap(Context context) {
// if (WarplyProperty.getAppUuid(context).equals("f83dfde1145e4c2da69793abb2f579af")) {
// return "https://dev.supermarketdeals.eu/map";
// }
......@@ -180,6 +180,39 @@ public class WarplyManagerHelper {
return url;
}
public static String openSupermarketPass(Context context) {
// if (WarplyProperty.getAppUuid(context).equals("f83dfde1145e4c2da69793abb2f579af")) {
// return "https://dev.supermarketdeals.eu";
// }
//
// return "https://supermarketdeals.eu";
String url = "";
if (WarplyProperty.getAppUuid(context).equals("f83dfde1145e4c2da69793abb2f579af")) {
url = "https://dev.supermarketdeals.eu";
} else {
url = "https://supermarketdeals.eu";
}
JSONObject params = new JSONObject();
try {
params.putOpt("web_id", WarpUtils.getWebId(Warply.getWarplyContext()));
params.putOpt("app_uuid", WarplyProperty.getAppUuid(Warply.getWarplyContext()));
params.putOpt("api_key", WarpUtils.getApiKey(Warply.getWarplyContext()));
params.putOpt("session_uuid", "");
params.putOpt("access_token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token"));
params.putOpt("refresh_token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token"));
params.putOpt("client_id", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id"));
params.putOpt("client_secret", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret"));
} catch (JSONException e) {
e.printStackTrace();
}
WarpUtils.setWebviewParams(Warply.getWarplyContext(), params);
return url;
}
/**
* Open Warply campaign
*/
......
......@@ -100,25 +100,26 @@
android:textColor="@color/white"
android:textSize="20sp" />
<TextView
android:id="@+id/tv_market_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_market_header"
android:layout_marginTop="16dp"
android:letterSpacing="0.04"
android:text="@string/cos_market_pass_subtitle"
android:textColor="@color/white"
android:textSize="16sp"
app:lineHeight="22dp" />
<!-- <TextView-->
<!-- android:id="@+id/tv_market_subtitle"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_below="@+id/tv_market_header"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:letterSpacing="0.04"-->
<!-- android:text="@string/cos_market_pass_subtitle"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="16sp"-->
<!-- app:lineHeight="22dp" />-->
<!-- android:layout_marginTop="42dp"-->
<LinearLayout
android:id="@+id/ll_barcode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_market_subtitle"
android:layout_marginTop="42dp"
android:layout_marginBottom="36dp"
android:layout_below="@+id/tv_market_header"
android:layout_marginBottom="18dp"
android:layout_marginTop="16dp"
android:background="@drawable/background_white_grey_border"
android:gravity="center"
android:orientation="vertical"
......@@ -137,11 +138,12 @@
android:id="@+id/tv_barcode_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="2dp"
android:letterSpacing="0.00074"
android:textIsSelectable="true"
android:textColor="@color/cos_light_black"
android:textSize="18sp" />
android:textSize="19sp" />
</LinearLayout>
</RelativeLayout>
......@@ -161,7 +163,7 @@
android:includeFontPadding="false"
android:letterSpacing="0.04"
android:textColor="@color/white"
android:textSize="16sp"
android:textSize="14sp"
android:paddingHorizontal="24dp"
app:lineHeight="22dp" />
</LinearLayout>
......@@ -174,11 +176,11 @@
android:orientation="horizontal"
android:paddingVertical="24dp">
<!-- android:gravity="center"-->
<LinearLayout
android:id="@+id/ll_sm_logos"
android:layout_width="0dp"
android:layout_height="0dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/ll_map"
......
......@@ -193,6 +193,7 @@
<string name="cos_market_ab_subtitle">1. Ενεργοποίησε τον κωδικό στην ΑΒ PLUS στο kiosk του καταστήματος ή μέσω AB eshop/app στην ενότητα Συνεργασίες – SUPERMARKET DEALS.\n\n2. Κάνε χρήση της ΑΒ PLUS στις αγορές σου για να λάβεις τις διαθέσιμες εκπτώσεις.</string>
<string name="cos_market_pass_title">SUPERMARKET DEALS CARD</string>
<string name="cos_market_pass_subtitle">Χρησιμοποίησε το μοναδικό κωδικό σου για να κερδίσεις έκπτωση σε επιλεγμένα προϊόντα. Ανακάλυψε τα κουπόνια στο For You.</string>
<string name="cos_market_pass_details">Χρησιμοποίησε τη SUPERMARKET DEALS CARD σου για να κερδίσεις έκπτωση σε επιλεγμένα προϊόντα. Ανακάλυψε τα διαθέσιμα εκπτωτικά κουπόνια στο For You.</string>
<string name="cos_market_pass_return">Επιστροφή</string>
<string name="cos_market_pass_coupons_title">Με τα διαθέσιμα κουπόνια μπορείς να εξοικονομήσεις έως και %1$s€.</string>
<string name="cos_market_subtitle">Δημιούργησε το δικό σου ενιαίο κουπόνι προσφορών, και εξαργύρωσέ το στα supermarket της επιλογής σου γρήγορα και εύκολα με ένα μόνο κωδικό κουπονιού!</string>
......