Panagiotis Triantafyllou

new version, pass changes

......@@ -5,7 +5,7 @@ android.buildFeatures.buildConfig = true
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.5.4p3'
PUBLISH_VERSION = '4.5.5.4p4'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -55,8 +55,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;
......@@ -75,7 +75,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);
......@@ -85,10 +85,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);
......@@ -101,6 +102,7 @@ public class MarketPassActivity extends Activity implements View.OnClickListener
WarplyAnalyticsManager.logTrackersEvent(this, "screen", "MarketPassScreen");
mMapPressed = false;
mPassInfoPressed = false;
mOpenSMPressed = false;
}
@Override
......@@ -117,8 +119,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) {
......@@ -135,6 +137,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.openSupermarketCampaign(MarketPassActivity.this)));
}
}
}
......@@ -147,43 +163,46 @@ 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 (WarplyManagerHelper.getMarketPassDetails() != null) {
// if (mMarketPassDetails != null)
createBarcodeBitmap(WarplyManagerHelper.getMarketPassDetails().getBarcode());
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) {
for (int i = 0; i < WarplyManagerHelper.getMarketPassDetails().getSupermarkets().size(); i++) {
int tempIndex = i;
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
RelativeLayout v = (RelativeLayout) vi.inflate(R.layout.item_sheet_image, null);
for (int i = 0; i < WarplyManagerHelper.getMarketPassDetails().getSupermarkets().size(); i++) {
int tempIndex = i;
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
RelativeLayout v = (RelativeLayout) vi.inflate(R.layout.item_sheet_image, null);
ImageView merchantLogo = (ImageView) v.findViewById(R.id.iv_market_logo);
Glide.with(this)
ImageView merchantLogo = (ImageView) v.findViewById(R.id.iv_market_logo);
Glide.with(this)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(WarplyManagerHelper.getMarketPassDetails().getSupermarkets().get(i).getLogo())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(merchantLogo);
mLlParentLogosView.addView(v, tempIndex, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
.load(WarplyManagerHelper.getMarketPassDetails().getSupermarkets().get(i).getLogo())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(merchantLogo);
mLlParentLogosView.addView(v, tempIndex, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
}
}
// }
mCvMarketDetails.setVisibility(View.VISIBLE);
......
......@@ -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 openSupermarketCampaign(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
*/
......
......@@ -98,25 +98,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"
......@@ -135,11 +136,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>
......@@ -159,7 +161,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>
......@@ -172,11 +174,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>
......