Panagiotis Triantafyllou

redesign supermarket part1

Showing 23 changed files with 1955 additions and 151 deletions
......@@ -104,6 +104,9 @@ dependencies {
//------------------------------ Retrofit -----------------------------//
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
//------------------------------ Expandable Layout -----------------------------//
api 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
}
// In every export please update the version number
......
......@@ -48,6 +48,18 @@
android:theme="@style/SDKAppTheme" />
<activity
android:name="ly.warp.sdk.activities.LoyaltyMarketAnalysisActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name="ly.warp.sdk.activities.UnifiedCouponInfoActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name="ly.warp.sdk.activities.ActiveCouponsActivity"
android:exported="false"
android:screenOrientation="portrait"
......
......@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
......@@ -18,12 +19,16 @@ import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import net.cachapa.expandablelayout.ExpandableLayout;
import org.apmem.tools.layouts.FlowLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
......@@ -35,23 +40,30 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan;
import io.github.inflationx.calligraphy3.TypefaceUtils;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.ActiveDFYCouponEventModel;
import ly.warp.sdk.io.models.ActiveDFYCouponModel;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.UnifiedCoupon;
import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.views.adapters.ActiveCouponAdapter;
import ly.warp.sdk.views.adapters.MarketCouponAdapter;
public class LoyaltyWallet extends Activity implements View.OnClickListener, View.OnScrollChangeListener {
......@@ -64,21 +76,29 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
// Fields
// ===========================================================
private ImageView mIvBack, mIvDealsLogo, mIvProfilePhoto;
private ImageView mIvBack, mIvDealsLogo, mIvProfilePhoto, mIvExpArrow;
private TextView mTvUsername, mTvDealsValue, mTvDealsValueAll,
mTvUserBadge, mTvGiftsValue, mTvGiftsValueAll, mTvActiveCode, mTvActiveDate,
mTvActiveTitle, mTvActiveCouponsHeader;
mTvActiveTitle, mTvActiveCouponsHeader, mTvMarketValue, mTvMarketAll, mTvFavValue, mTvFavValueAll;
private ConstraintLayout mClDealsBanner, mClDealsView,
mClGiftsBanner, mClToolbar;
private LinearLayout mLlQuestionnaire, mLlUserBadge, mLlEmptyWallet, mLlDeals, mLlGifts;
mClGiftsBanner, mClToolbar, mClExp, mClMarket;
private LinearLayout mLlQuestionnaire, mLlUserBadge, mLlEmptyWallet, mLlDeals, mLlGifts,
mLlMarketView;
private FlowLayout mLlActiveCodesView;
private float couponDfyValue = 0.0f;
private RecyclerView mRecyclerCoupons;
private float couponDfyValue = 0.0f, mFavValue = 0.0f;
private RecyclerView mRecyclerCoupons, mRvMarketCoupons;
private ActiveCouponAdapter mAdapterCoupons;
private AlertDialog mAlertDialogNonTelco;
private ScrollView mScActiveCodes, mSvLoyaltyWallet;
private ScrollView mScActiveCodes;
private NestedScrollView mSvLoyaltyWallet;
private int mTimer = 0;
private Handler mSecondsHandler;
private ArrayList<UnifiedCoupon> mUnifiedCoupons = new ArrayList<UnifiedCoupon>();
private ArrayList<UnifiedCoupon> mUnifiedCouponsAll = new ArrayList<UnifiedCoupon>();
private float countValue = 0.0f;
private MarketCouponAdapter mAdapterMarketCoupons;
private ExpandableLayout mElGifts;
private boolean mIsStayCollapsed = true;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -97,8 +117,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mTvUserBadge = findViewById(R.id.tv_type);
mTvGiftsValue = findViewById(R.id.tv_gifts_value);
mTvGiftsValueAll = findViewById(R.id.tv_gifts_value_all);
mClDealsBanner = findViewById(R.id.cl_deals_cos);
mClGiftsBanner = findViewById(R.id.cl_deals_win);
mClDealsBanner = findViewById(R.id.cl_deals_win_inner_cos);
mClGiftsBanner = findViewById(R.id.cl_deals_win_inner);
mTvDealsValue = findViewById(R.id.tv_deals_value);
mTvDealsValueAll = findViewById(R.id.tv_deals_value_all);
mTvActiveCode = findViewById(R.id.tv_active_deals_text);
......@@ -115,6 +135,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mSvLoyaltyWallet = findViewById(R.id.sv_loyalty_wallet);
mClToolbar = findViewById(R.id.cl_loyalty_wallet_header);
mLlGifts = findViewById(R.id.ll_gifts_view);
mLlMarketView = findViewById(R.id.ll_market_view);
mRvMarketCoupons = findViewById(R.id.rv_market_coupons);
mRvMarketCoupons.setNestedScrollingEnabled(false);
mRvMarketCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mElGifts = findViewById(R.id.el_exp);
mClExp = findViewById(R.id.cl_exp);
mIvExpArrow = findViewById(R.id.iv_exp_arrow);
mTvMarketValue = findViewById(R.id.tv_market_value);
mTvMarketAll = findViewById(R.id.tv_market_value_all);
mClMarket = findViewById(R.id.cl_market_inner);
mTvFavValue = findViewById(R.id.tv_exp_value);
mTvFavValueAll = findViewById(R.id.tv_exp_value_all);
if (WarplyManagerHelper.getActiveDFYCoupons() != null) {
Collections.sort(WarplyManagerHelper.getActiveDFYCoupons(), new Comparator<ActiveDFYCouponModel>() {
......@@ -136,7 +168,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mRecyclerCoupons.setNestedScrollingEnabled(false);
mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
initViews();
// initViews();
WarplyManager.getUnifiedCoupons(mUnifiedCallback);
}
@Override
......@@ -198,7 +232,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
startActivityForResult(WarpViewActivity.createIntentFromURL(LoyaltyWallet.this, WarplyManagerHelper.openQuestionnaire()), 1000);
return;
}
if (view.getId() == R.id.cl_deals_cos) {
if (view.getId() == R.id.cl_deals_win_inner_cos) {
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
.concat("DealsBanner"));
......@@ -214,7 +248,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
return;
}
if (view.getId() == R.id.cl_deals_win) {
if (view.getId() == R.id.cl_deals_win_inner) {
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
.concat("LoyaltyBanner"));
......@@ -228,6 +262,31 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
startActivity(intent);
return;
}
if (view.getId() == R.id.cl_exp) {
if (!mIsStayCollapsed) {
mElGifts.toggle(true);
if (mElGifts.isExpanded()) {
mIvExpArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_up_dark_new));
} else {
mIvExpArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_down_dark_new));
}
}
return;
}
if (view.getId() == R.id.cl_market_inner) {
if (countValue > 0) {
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
.concat("MarketBanner"));
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_market_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
// Intent intent = new Intent(LoyaltyWallet.this, LoyaltyMarketAnalysisActivity.class); //TODO: uncomment it
// startActivity(intent);
}
return;
}
if (view.getId() == R.id.cl_mygifts) {
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
......@@ -329,6 +388,39 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
nonTelcoDialog();
}
if (mUnifiedCoupons != null && mUnifiedCoupons.size() > 0) {
ArrayList<UnifiedCoupon> unilist = new ArrayList<UnifiedCoupon>();
for (UnifiedCoupon unicpn : mUnifiedCoupons) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss", Locale.US);
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(unicpn.getCreated());
} catch (ParseException e) {
e.printStackTrace();
}
unicpn.setExpirationDate(newDate);
unilist.add(unicpn);
}
Collections.sort(unilist, (coupon1, coupon2) -> coupon2.getExpirationDate().compareTo(coupon1.getExpirationDate()));
mAdapterMarketCoupons = new MarketCouponAdapter(this, unilist);
mRvMarketCoupons.setAdapter(mAdapterMarketCoupons);
mAdapterMarketCoupons.getPositionClicks()
.doOnNext(coupon -> {
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("UnifiedCoupon").concat(":").concat(coupon.getBarcode()));
Intent intent = new Intent(LoyaltyWallet.this, UnifiedCouponInfoActivity.class);
intent.putExtra("coupon", (Serializable) coupon);
intent.putExtra("isFromWallet", true);
startActivity(intent);
// startActivityForResult(intent, 1002);
})
.doOnError(error -> {
})
.subscribe();
mLlMarketView.setVisibility(View.VISIBLE);
} else {
mLlMarketView.setVisibility(View.GONE);
}
if (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0) {
CouponList cpnlist = new CouponList();
for (Coupon cpn : WarplyManagerHelper.getCouponList()) {
......@@ -360,13 +452,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
.doOnError(error -> {
})
.subscribe();
mLlGifts.setVisibility(View.VISIBLE);
} else {
mLlGifts.setVisibility(View.GONE);
}
if (WarplyManagerHelper.getDealsCouponsSum() > 0) {
mTvDealsValue.setText(String.format(getString(R.string.cos_value), String.valueOf(/*couponDfyValue*/ WarplyManagerHelper.getDealsCouponsSum())));
// First Expandable Banner
String badgeValueFirst = String.format("%.02f", WarplyManagerHelper.getDealsCouponsSum());
mTvDealsValue.setText(String.format(getString(R.string.cos_value), badgeValueFirst));
SpannableStringBuilder sBuilder = new SpannableStringBuilder();
sBuilder
.append(getString(R.string.cos_wallet_text1))
......@@ -377,45 +470,63 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
sBuilder.setSpan(typefaceRegularSpan, 0, getString(R.string.cos_wallet_text1).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilder.setSpan(typefaceRegularSpan, getString(R.string.cos_wallet_text1).length() + String.valueOf(WarplyManagerHelper.getDealsCouponsSum()).length(), getString(R.string.cos_wallet_text1).length() + String.valueOf(WarplyManagerHelper.getDealsCouponsSum()).length() + getString(R.string.cos_wallet_text2).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilder.setSpan(typefaceBoldSpan, getString(R.string.cos_wallet_text1).length(), getString(R.string.cos_wallet_text1).length() + String.valueOf(WarplyManagerHelper.getDealsCouponsSum()).length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvDealsValueAll.setText(sBuilder, TextView.BufferType.SPANNABLE);
} else {
mClDealsBanner.setVisibility(View.GONE);
}
mFavValue += WarplyManagerHelper.getDealsCouponsSum();
if (WarplyManagerHelper.getLoyaltyBadge() != null) {
if (WarplyManagerHelper.getLoyaltyBadge().getCouponCount() > 0) {
// Second Expandable Banner
if (WarplyManagerHelper.getLoyaltyBadge() != null && (WarplyManagerHelper.getLoyaltyBadge().getCouponCount() > 0 || WarplyManagerHelper.getLoyaltyBadge().getCouponCount() == 0)) {
String badgeValue = String.format("%.02f", WarplyManagerHelper.getLoyaltyBadge().getValue());
mTvGiftsValue.setText(String.format(getString(R.string.cos_value), badgeValue));
SpannableStringBuilder sBuilder = new SpannableStringBuilder();
sBuilder
SpannableStringBuilder sBuilderSecond = new SpannableStringBuilder();
sBuilderSecond
.append(getString(R.string.cos_wallet_text3))
.append(String.format(getString(R.string.cos_value), badgeValue))
.append(getString(R.string.cos_wallet_text4))
.append(String.format(getString(R.string.cos_value2), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount())))
.append(getString(R.string.cos_wallet_text5));
CalligraphyTypefaceSpan typefaceRegularSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
CalligraphyTypefaceSpan typefaceRegularSpanSecond = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
CalligraphyTypefaceSpan typefaceRegularSpan2 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
CalligraphyTypefaceSpan typefaceRegularSpan3 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
CalligraphyTypefaceSpan typefaceBoldSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
CalligraphyTypefaceSpan typefaceBoldSpanSecond = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
CalligraphyTypefaceSpan typefaceBoldSpan2 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilder.setSpan(typefaceRegularSpan, 0, getString(R.string.cos_wallet_text3).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilder.setSpan(typefaceBoldSpan, getString(R.string.cos_wallet_text3).length(), getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilder.setSpan(typefaceRegularSpan2, getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1, getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilder.setSpan(typefaceBoldSpan2, getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length(), getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length() + String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilder.setSpan(typefaceRegularSpan3, getString(R.string.cos_wallet_text3).length() + 1 + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length() + String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()).length(), getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length() + String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()).length() + getString(R.string.cos_wallet_text5).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilderSecond.setSpan(typefaceRegularSpanSecond, 0, getString(R.string.cos_wallet_text3).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilderSecond.setSpan(typefaceBoldSpanSecond, getString(R.string.cos_wallet_text3).length(), getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilderSecond.setSpan(typefaceRegularSpan2, getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1, getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilderSecond.setSpan(typefaceBoldSpan2, getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length(), getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length() + String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilderSecond.setSpan(typefaceRegularSpan3, getString(R.string.cos_wallet_text3).length() + 1 + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length() + String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()).length(), getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length() + String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()).length() + getString(R.string.cos_wallet_text5).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvGiftsValueAll.setText(sBuilderSecond, TextView.BufferType.SPANNABLE);
mFavValue += WarplyManagerHelper.getLoyaltyBadge().getValue();
}
mTvGiftsValueAll.setText(sBuilder, TextView.BufferType.SPANNABLE);
// Third Expandable Banner
if (mUnifiedCouponsAll.size() > 0) {
countValue = 0.0f;
for (UnifiedCoupon unicou : mUnifiedCouponsAll) {
if (unicou.getCoupons() != null && unicou.getCoupons().size() > 0) {
for (Coupon inncou : unicou.getCoupons()) {
if (inncou.getStatus() == 0) {
countValue += Float.valueOf(inncou.getDiscount());
}
}
}
}
mFavValue += countValue;
if (countValue > 0) {
String badgeValue = String.format("%.02f", countValue);
mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
} else {
mClGiftsBanner.setVisibility(View.GONE);
String badgeValue = String.format("%.02f", 0.0f);
mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
}
} else {
mClGiftsBanner.setVisibility(View.GONE);
String badgeValue = String.format("%.02f", 0.0f);
mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
}
// Sum Expandable Banner
String allValue = String.format("%.02f", mFavValue);
mTvFavValue.setText(String.format(getString(R.string.cos_value), allValue));
if (WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() > 0) {
String codes = "";
if (WarplyManagerHelper.getActiveDFYCoupons().size() == 1) {
......@@ -452,11 +563,11 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_selectable, null);
TextView textView = (TextView) v.findViewById(R.id.tv_code_copy);
TextView textViewComma = (TextView) v.findViewById(R.id.tv_code_comma);
CalligraphyTypefaceSpan typefaceBoldSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
SpannableStringBuilder sBuilder = new SpannableStringBuilder(WarplyManagerHelper.getActiveDFYCoupons().get(i).getCode());
CalligraphyTypefaceSpan typefaceBoldSpanDFY = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
SpannableStringBuilder sBuilderDFY = new SpannableStringBuilder(WarplyManagerHelper.getActiveDFYCoupons().get(i).getCode());
SpannableStringBuilder sBuilderComma = new SpannableStringBuilder(getString(R.string.cos_comma));
sBuilder.setSpan(typefaceBoldSpan, 0, sBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilderComma.setSpan(typefaceBoldSpan, 0, sBuilderComma.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilderDFY.setSpan(typefaceBoldSpanDFY, 0, sBuilderDFY.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilderComma.setSpan(typefaceBoldSpanDFY, 0, sBuilderComma.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
textView.setText(sBuilder, TextView.BufferType.SPANNABLE);
textView.setTextIsSelectable(true);
textViewComma.setText(sBuilderComma, TextView.BufferType.SPANNABLE);
......@@ -467,6 +578,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mScActiveCodes.setVisibility(View.VISIBLE);
mLlActiveCodesView.setVisibility(View.VISIBLE);
mLlDeals.setVisibility(View.VISIBLE);
}
// mTvActiveCode.setText(codes);
} else {
......@@ -498,10 +610,17 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
}
if (mClDealsBanner.getVisibility() == View.GONE && mClGiftsBanner.getVisibility() == View.GONE
&& mLlDeals.getVisibility() == View.GONE && mLlGifts.getVisibility() == View.GONE) {
mLlEmptyWallet.setVisibility(View.VISIBLE);
}
if (mLlMarketView.getVisibility() == View.GONE
&& WarplyManagerHelper.getDealsCouponsSum() == 0
&& (WarplyManagerHelper.getLoyaltyBadge() != null && WarplyManagerHelper.getLoyaltyBadge().getCouponCount() == 0)
&& mLlDeals.getVisibility() == View.GONE) {
mIvExpArrow.setVisibility(View.GONE);
// mLlEmptyWallet.setVisibility(View.VISIBLE);
mIsStayCollapsed = true;
} else {
mIvExpArrow.setVisibility(View.VISIBLE);
mIsStayCollapsed = false;
} //TODO: change the case
mIvBack.setOnClickListener(this);
mLlQuestionnaire.setOnClickListener(this);
......@@ -510,6 +629,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mClGiftsBanner.setOnClickListener(this);
mClDealsView.setOnClickListener(this);
mSvLoyaltyWallet.setOnScrollChangeListener(this);
mClExp.setOnClickListener(this);
mClMarket.setOnClickListener(this);
}
private void nonTelcoDialog() {
......@@ -526,6 +647,31 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
}
private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() {
@Override
public void onSuccess(ArrayList<UnifiedCoupon> result) {
final ExecutorService executor = Executors.newFixedThreadPool(1);
executor.submit(() -> {
mUnifiedCouponsAll = result;
ArrayList<UnifiedCoupon> cpnlist = new ArrayList<UnifiedCoupon>();
for (UnifiedCoupon cpn : result) {
if (cpn.getStatus().equals("active")) {
cpnlist.add(cpn);
}
}
mUnifiedCoupons = cpnlist;
WarplyManagerHelper.setMarketCoupons(result);
new Handler(Looper.getMainLooper()).post(() -> initViews());
executor.shutdownNow();
});
}
@Override
public void onFailure(int errorCode) {
initViews();
}
};
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
......
package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.oned.EAN13Writer;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.UnifiedCoupon;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.views.adapters.ActiveCouponAdapter;
public class UnifiedCouponInfoActivity extends Activity implements View.OnClickListener {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private ImageView mIvBack, mIvBarcode, mIvMarketExpand;
private TextView mTvTerms, mTvCouponCode, mTvCouponDate, mTvMarketExpand,
mTvTermsValue, mTvFullBarcode;
private LinearLayout mLlShops, mLlBarcodeContainer, mLlTerms, mLlMarketCoupons, mLlMarketExpand;
private UnifiedCoupon mCoupon;
private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false,
mIsMarketExpand = true;
private RecyclerView mRecyclerCoupons;
private ActiveCouponAdapter mAdapterCoupons;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_unified_coupon_info);
UnifiedCoupon tempCoupon = (UnifiedCoupon) getIntent().getSerializableExtra("coupon");
if (tempCoupon != null) {
for (UnifiedCoupon couponItem : WarplyManagerHelper.getMarketCoupons()) {
if (couponItem.getBarcode().equals(tempCoupon.getBarcode())) {
mCoupon = couponItem;
break;
}
}
}
// mIsFromWallet = getIntent().getBooleanExtra("isFromWallet", false);
mIvBack = findViewById(R.id.iv_coupon_info_back);
mTvTerms = findViewById(R.id.tv_terms);
mTvCouponCode = findViewById(R.id.textView16);
mTvCouponDate = findViewById(R.id.textView17);
mIvBarcode = findViewById(R.id.iv_barcode);
mLlShops = findViewById(R.id.ll_shops);
mLlBarcodeContainer = findViewById(R.id.ll_barcode_container_items);
mLlTerms = findViewById(R.id.ll_terms_inner);
mTvTermsValue = findViewById(R.id.tv_terms_value);
mTvFullBarcode = findViewById(R.id.tv_full_barcode);
mLlMarketCoupons = findViewById(R.id.ll_market_coupons);
mLlMarketExpand = findViewById(R.id.ll_market_expand);
mTvMarketExpand = findViewById(R.id.tv_market_expand);
mIvMarketExpand = findViewById(R.id.iv_market_expand);
mRecyclerCoupons = findViewById(R.id.rv_active_market_coupons);
mRecyclerCoupons.setNestedScrollingEnabled(false);
mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
initViews();
}
@Override
public void onResume() {
super.onResume();
WarplyAnalyticsManager.logTrackersEvent(this, "screen", "UnifiedCouponScreen");
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_coupon_info_back) {
onBackPressed();
return;
}
if (view.getId() == R.id.ll_shops) {
WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShops");
if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(UnifiedCouponInfoActivity.this) == ConnectionResult.SUCCESS) {
Intent intent = new Intent(UnifiedCouponInfoActivity.this, ShopsActivity.class);
startActivity(intent);
return;
} else {
Intent intent = new Intent(UnifiedCouponInfoActivity.this, ShopsHuaweiActivity.class);
startActivity(intent);
return;
}
}
if (view.getId() == R.id.ll_terms_inner) {
if (mIsTermsShown) {
mTvTermsValue.setVisibility(View.GONE);
ImageView termsButtonArrow = mLlTerms.findViewById(R.id.iv_terms_arrow);
termsButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_down_dark_new));
mIsTermsShown = false;
} else {
mTvTermsValue.setVisibility(View.VISIBLE);
ImageView termsButtonArrow = mLlTerms.findViewById(R.id.iv_terms_arrow);
termsButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_up_dark_new));
mIsTermsShown = true;
}
return;
}
if (view.getId() == R.id.ll_market_expand) {
if (mIsMarketExpand) {
mLlMarketCoupons.setVisibility(View.GONE);
mTvMarketExpand.setText(getString(R.string.cos_show_market_coupons));
mIvMarketExpand.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_down_dark_new));
mIsMarketExpand = false;
} else {
mLlMarketCoupons.setVisibility(View.VISIBLE);
mTvMarketExpand.setText(getString(R.string.cos_hide_market_coupons));
mIvMarketExpand.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_up_dark_new));
mIsMarketExpand = true;
}
}
}
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
}
// ===========================================================
// Methods
// ===========================================================
private void initViews() {
mTvCouponCode.setText(mCoupon.getBarcode());
mLlMarketCoupons.setVisibility(View.GONE);
mTvMarketExpand.setText(getString(R.string.cos_show_market_coupons));
mIvMarketExpand.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_down_dark_new));
mIsMarketExpand = false;
if (mCoupon.getCoupons() != null && mCoupon.getCoupons().size() > 0) {
CouponList cpnlist = new CouponList();
for (Coupon cpn : mCoupon.getCoupons()) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(cpn.getExpiration());
} catch (ParseException e) {
e.printStackTrace();
}
cpn.setExpirationDate(newDate);
cpnlist.add(cpn);
}
Collections.sort(cpnlist, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate()));
for (Coupon tempItem : cpnlist) {
if (tempItem.getStatus() == 1) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(cpnlist.get(0).getExpiration());
} catch (ParseException e) {
e.printStackTrace();
}
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
mTvCouponDate.setText(String.format(getResources().getString(R.string.cos_mycoupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
break;
}
}
mAdapterCoupons = new ActiveCouponAdapter(this, cpnlist, false, true);
mRecyclerCoupons.setAdapter(mAdapterCoupons);
mAdapterCoupons.getPositionClicks()
.doOnNext(coupon -> {
// WarplyAnalyticsManager.logTrackersEvent(this, "click", ("MarketCoupon").concat(":").concat(coupon.getName()));
// Intent intent = new Intent(UnifiedCouponInfoActivity.this, CouponInfoActivity.class);
// intent.putExtra("coupon", (Serializable) coupon);
// intent.putExtra("isFromWallet", true);
// startActivityForResult(intent, 1002);
})
.doOnError(error -> {
})
.subscribe();
}
mIvBack.setOnClickListener(this);
mLlShops.setOnClickListener(this);
mLlTerms.setOnClickListener(this);
mLlMarketExpand.setOnClickListener(this);
String tempCoupon = "";
int result = 0;
try {
tempCoupon = mCoupon.getBarcode();
for (int i = 0; i < (12 - mCoupon.getBarcode().length()); i++) {
tempCoupon += "0";
}
} catch (Exception e) {
e.printStackTrace();
}
try {
for (int i = mCoupon.getBarcode().length() - 1; i >= 0; i--) {
result = result + Integer.parseInt(String.valueOf((mCoupon.getBarcode()).charAt(i))) * (1 + (2 * (i % 2)));
}
} catch (Exception e) {
e.printStackTrace();
}
tempCoupon = tempCoupon + (10 - (result % 10)) % 10;
createBarcodeBitmap(tempCoupon);
}
private void createBarcodeBitmap(String barcodeString) {
EAN13Writer writer = new EAN13Writer();
try {
BitMatrix bitMatrix = writer.encode(barcodeString, BarcodeFormat.EAN_13, 1024, 512);
int width = bitMatrix.getWidth();
int height = bitMatrix.getHeight();
Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
bmp.setPixel(x, y, bitMatrix.get(x, y) ? Color.BLACK : Color.WHITE);
}
}
mIvBarcode.setImageBitmap(bmp);
mTvFullBarcode.setText(barcodeString);
} catch (Exception e) {
e.printStackTrace();
mLlBarcodeContainer.setVisibility(View.GONE);
mIvBarcode.setVisibility(View.GONE);
}
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
import android.os.Parcel;
import android.os.Parcelable;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.constants.WarpConstants;
/**
* Created by Panagiotis Triantafyllou on 04-Apr-23.
*/
public class UnifiedCoupon implements Parcelable, Serializable {
private static final long serialVersionUID = -4754964462459705285L;
/* Constants used to export the campaign in JSON formal and vice versa */
private static final String BARCODE = "barcode";
private static final String CODE = "code";
private static final String CREATED = "created";
private static final String COUPONS = "coupons";
private static final String STATUS = "status";
private static final String DESCRIPTION = "description";
/* Member variables of the Campaign object */
private String barcode = "";
private String description = "";
private String status = "";
private int code = 0;
private String created = "";
private ArrayList<Coupon> coupons = new ArrayList();
private Date expirationDate = new Date();
public UnifiedCoupon() {
this.barcode = "";
this.description = "";
this.status = "";
this.code = 0;
this.created = "";
this.coupons = new ArrayList();
this.expirationDate = new Date();
}
/**
* Basic constructor used to create an object from a String, representing a
* JSON Object
*
* @param json The String, representing the JSON Object
* @throws JSONException Thrown if the String cannot be converted to JSON
*/
public UnifiedCoupon(String json) throws JSONException {
this(new JSONObject(json));
}
/**
* Constructor used to create an Object from a given JSON Object
*
* @param json JSON Object used to create the Coupon
*/
public UnifiedCoupon(JSONObject json) {
if (json != null) {
this.barcode = json.optString(BARCODE);
this.description = json.optString(DESCRIPTION);
this.status = json.optString(STATUS);
this.code = json.optInt(CODE);
this.created = json.optString(CREATED);
JSONArray jArray = null;
jArray = json.optJSONArray(COUPONS);
if (jArray != null && jArray.length() > 0) {
for (int i = 0; i < jArray.length(); i++) {
JSONObject jObj = jArray.optJSONObject(i);
this.coupons.add(new Coupon(jObj));
}
}
}
}
public UnifiedCoupon(Parcel source) {
this.barcode = source.readString();
this.description = source.readString();
this.status = source.readString();
this.code = source.readInt();
this.created = source.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.barcode);
dest.writeString(this.description);
dest.writeString(this.status);
dest.writeInt(this.code);
dest.writeString(this.created);
}
/**
* Converts the Unified Coupon into a JSON Object
*
* @return The JSON Object created from this Unified Coupon
*/
public JSONObject toJSONObject() {
JSONObject jObj = new JSONObject();
try {
jObj.putOpt(BARCODE, this.barcode);
jObj.putOpt(DESCRIPTION, this.description);
jObj.putOpt(STATUS, this.status);
jObj.putOpt(CODE, this.code);
jObj.putOpt(CREATED, this.created);
jObj.putOpt(COUPONS, this.coupons);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
}
}
return jObj;
}
/**
* String representation of the Unified Coupon, as a JSON object
*
* @return A String representation of JSON object
*/
public String toString() {
if (toJSONObject() != null)
return toJSONObject().toString();
return null;
}
/**
* String representation of the Coupon, as a human readable JSON object
*
* @return A human readable String representation of JSON object
*/
public String toHumanReadableString() {
String humanReadableString = null;
try {
humanReadableString = toJSONObject().toString(2);
} catch (JSONException e) {
WarpUtils.warn("Failed converting Unified Coupon JSON object to String", e);
}
return humanReadableString;
}
// ================================================================================
// Getters
// ================================================================================
public String getBarcode() {
return barcode;
}
public void setBarcode(String barcode) {
this.barcode = barcode;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getCreated() {
return created;
}
public void setCreated(String created) {
this.created = created;
}
public ArrayList<Coupon> getCoupons() {
return coupons;
}
public void setCoupons(ArrayList<Coupon> coupons) {
this.coupons = coupons;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getExpirationDate() {
return expirationDate;
}
public void setExpirationDate(Date expirationDate) {
this.expirationDate = expirationDate;
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<UnifiedCoupon> CREATOR = new Creator<UnifiedCoupon>() {
public UnifiedCoupon createFromParcel(Parcel source) {
return new UnifiedCoupon(source);
}
public UnifiedCoupon[] newArray(int size) {
return new UnifiedCoupon[size];
}
};
}
......@@ -54,6 +54,18 @@ public interface ApiService {
@Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
@Headers("Content-Type: application/json")
@POST("/oauth/{appUuid}/context")
Call<ResponseBody> getUnifiedCoupons(@Path("appUuid") String appUuid,
@Body RequestBody request,
@Header(WarpConstants.HEADER_DATE) String timeStamp,
@Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
@Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
@Header(WarpConstants.HEADER_CHANNEL) String channel,
@Header(WarpConstants.HEADER_WEB_ID) String webId,
@Header(WarpConstants.HEADER_SIGNATURE) String signature,
@Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
@Headers("Content-Type: application/json")
@POST("/api/mobile/v2/{appUuid}/context/")
Call<ResponseBody> getMerchants(@Path("appUuid") String appUuid,
@Body RequestBody request,
......
......@@ -74,6 +74,7 @@ import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.MerchantList;
import ly.warp.sdk.io.models.PushCampaign;
import ly.warp.sdk.io.models.UnifiedCoupon;
import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest;
import ly.warp.sdk.io.request.CosmoteSharingRequest;
......@@ -123,6 +124,7 @@ public class WarplyManagerHelper {
public static double mMetersWebview = 0.0d;
public static int mStepsWebview = 0;
public static int mSteps = 0;
private static ArrayList<UnifiedCoupon> mMarketCoupons = new ArrayList<>();
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -1247,6 +1249,13 @@ public class WarplyManagerHelper {
mDealsSum = sum;
}
public static ArrayList<UnifiedCoupon> getMarketCoupons() {
return mMarketCoupons;
}
public static void setMarketCoupons( ArrayList<UnifiedCoupon> marketCoupons) {
mMarketCoupons = marketCoupons;
}
public static boolean checkForLoyaltySDKNotification(Context context, Map<String, String> pushPayload) {
Bundle data = convertToBundle(pushPayload);
if (data == null || !data.containsKey("loyalty-action"))
......
......@@ -97,6 +97,7 @@ import ly.warp.sdk.io.models.SharingList;
import ly.warp.sdk.io.models.TagsCategoriesList;
import ly.warp.sdk.io.models.TagsList;
import ly.warp.sdk.io.models.TransactionsList;
import ly.warp.sdk.io.models.UnifiedCoupon;
import ly.warp.sdk.io.models.WarplyPacingEventModel;
import ly.warp.sdk.io.request.CosmoteCouponSharingRequest;
import ly.warp.sdk.io.request.CosmotePostEventRequest;
......@@ -1892,6 +1893,71 @@ public class WarplyManager {
});
}
public static void getUnifiedCoupons(final CallbackReceiver<ArrayList<UnifiedCoupon>> receiver) {
WarpUtils.log("************* WARPLY User Coupons Request ********************");
WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active");
WarpUtils.log("**************************************************");
ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
getUnifiedCouponsRetro(service, new Callback<ResponseBody>() {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> responseCoupons) {
if (responseCoupons.code() == 200 && responseCoupons.body() != null) {
JSONObject jobjCouponsResponse = null;
try {
jobjCouponsResponse = new JSONObject(responseCoupons.body().string());
} catch (Exception e) {
e.printStackTrace();
}
if (jobjCouponsResponse != null && jobjCouponsResponse.has("status") && jobjCouponsResponse.optInt("status", 2) == 1) {
ArrayList<UnifiedCoupon> couponList = new ArrayList<UnifiedCoupon>();
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_unified_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
JSONObject finalJobjCouponsResponse = jobjCouponsResponse;
final ExecutorService executor = Executors.newFixedThreadPool(1);
executor.submit(() -> {
JSONObject jCouponsBody = null;
try {
jCouponsBody = finalJobjCouponsResponse.optJSONObject("result");
if (jCouponsBody != null && jCouponsBody.length() > 0) {
JSONArray jCouponsInnerBody = null;
jCouponsInnerBody = jCouponsBody.optJSONArray("coupons");
if (jCouponsInnerBody != null && jCouponsInnerBody.length() > 0) {
for (int i = 0; i < jCouponsInnerBody.length(); i++) {
couponList.add(new UnifiedCoupon(jCouponsInnerBody.optJSONObject(i)));
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
new Handler(Looper.getMainLooper()).post(() -> receiver.onSuccess(couponList));
executor.shutdownNow();
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_unified_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_unified_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(responseCoupons.code());
}
}
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
});
}
public static void getUserCouponsWithCouponsets(WarplyUserCouponsRequest request, final CallbackReceiver<CouponList> receiver) {
WarpUtils.log("************* WARPLY User Coupons Request ********************");
WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active");
......@@ -2248,6 +2314,58 @@ public class WarplyManager {
});
}
private static void getUnifiedCouponsRetro(ApiService service, Callback<ResponseBody> callback) {
String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
String webId = WarpUtils.getWebId(Warply.getWarplyContext());
Map<String, Object> jsonParamsCouponsets = new ArrayMap<>();
Map<String, Object> jsonParams = new ArrayMap<>();
jsonParams.put("action", "retrieve_unified_coupons");
jsonParams.put("language", WarplyProperty.getLanguage(Warply.getWarplyContext()));
jsonParamsCouponsets.put("coupon", jsonParams);
RequestBody unifiedCouponsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsCouponsets)).toString());
Call<ResponseBody> unifiedCouponsCall = service.getUnifiedCoupons(
WarplyProperty.getAppUuid(Warply.getWarplyContext()),
unifiedCouponsRequest,
timeStamp,
"android:" + Warply.getWarplyContext().getPackageName(),
new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
"mobile",
webId,
WarpUtils.produceSignature(apiKey + timeStamp),
"Bearer " + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
);
unifiedCouponsCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
if (response.code() == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getUnifiedCouponsRetro(service, callback);
else
callback.onFailure(call, new Throwable());
}
@Override
public void onFailure(int errorCode) {
callback.onFailure(call, new Throwable());
}
});
} else {
callback.onResponse(call, response);
}
}
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
callback.onFailure(call, t);
}
});
}
private static void getMerchantsRetro(ApiService service, Callback<ResponseBody> callback) {
String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
......
package ly.warp.sdk.views.adapters;
import android.content.Context;
import android.os.Build;
import android.text.Html;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.subjects.PublishSubject;
import ly.warp.sdk.R;
......@@ -27,30 +26,33 @@ import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.utils.WarplyManagerHelper;
public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapter.ActiveCouponViewHolder> {
private Context mContext;
private CouponList mCoupons;
private final PublishSubject<Coupon> onClickSubject = PublishSubject.create();
private boolean mIsPast = false;
private boolean mIsPast = false, mIsCustom = false;
public ActiveCouponAdapter(Context mContext, CouponList campaignList) {
this.mContext = mContext;
this.mCoupons = campaignList;
this.mIsPast = false;
}
public ActiveCouponAdapter(Context mContext, CouponList campaignList, boolean past) {
this.mContext = mContext;
this.mCoupons = campaignList;
this.mIsPast = past;
}
public ActiveCouponAdapter(Context mContext, CouponList campaignList, boolean past, boolean custom) {
this.mContext = mContext;
this.mCoupons = campaignList;
this.mIsPast = past;
this.mIsCustom = custom;
}
public class ActiveCouponViewHolder extends RecyclerView.ViewHolder {
private ImageView ivCouponLogo, ivCouponBackground;
private TextView tvCouponTitle, tvCouponValue, tvCouponDate, tvCouponDescription;
private TextView tvCouponTitle, tvCouponValue, tvCouponDate, tvDateLimit,
tvCouponDescription, tvCouponDateExpired;
private ConstraintLayout clCustomLayout;
private LinearLayout lLDateLimit;
public ActiveCouponViewHolder(View view) {
super(view);
ivCouponBackground = view.findViewById(R.id.iv_past_coupon_background);
......@@ -59,9 +61,12 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
tvCouponValue = view.findViewById(R.id.tv_active_coupons_value);
tvCouponDate = view.findViewById(R.id.tv_active_coupons_date);
tvCouponDescription = view.findViewById(R.id.tv_active_coupons_description);
clCustomLayout = view.findViewById(R.id.cl_custom_layout);
tvCouponDateExpired = view.findViewById(R.id.tv_active_coupons_date_expired);
tvDateLimit = view.findViewById(R.id.tv_active_coupons_date_limit);
lLDateLimit = view.findViewById(R.id.ll_date_limit);
}
}
@Override
public int getItemCount() {
if (mCoupons == null)
......@@ -69,38 +74,144 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
else
return mCoupons.size();
}
public Coupon getItem(int id) {
return mCoupons.get(id);
}
public void updateData(CouponList couponList) {
mCoupons.clear();
mCoupons.addAll(couponList);
notifyDataSetChanged();
}
@Override
public ActiveCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView;
if (mIsPast)
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.past_coupon_layout, parent, false);
else if (mIsCustom)
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_coupon_layout, parent, false);
else
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.active_coupon_layout, parent, false);
return new ActiveCouponViewHolder(itemView);
}
@Override
public void onBindViewHolder(final ActiveCouponViewHolder holder, int position) {
Coupon couponItem = mCoupons.get(position);
Merchant merchant = new Merchant();
if (mIsPast)
holder.ivCouponBackground.setColorFilter(ContextCompat.getColor(mContext, R.color.grey_light3), android.graphics.PorterDuff.Mode.MULTIPLY);
if (couponItem != null) {
if (mIsCustom) {
if (couponItem.getStatus() == 1) {
holder.ivCouponLogo.setAlpha(1.0f);
holder.tvCouponTitle.setAlpha(1.0f);
holder.tvCouponValue.setAlpha(1.0f);
holder.tvCouponDescription.setAlpha(1.0f);
holder.clCustomLayout.setBackgroundResource(R.drawable.ic_coupon_background);
} else {
holder.ivCouponLogo.setAlpha(0.23f);
holder.tvCouponTitle.setAlpha(0.15f);
holder.tvCouponValue.setAlpha(0.15f);
holder.tvCouponDescription.setAlpha(0.15f);
holder.clCustomLayout.setBackgroundResource(R.drawable.ic_coupon_background_gray);
}
if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) {
for (Merchant mer : WarplyManagerHelper.getMerchantList()) {
if (mer.getUuid().equals(couponItem.getMerchantUuid())) {
merchant = mer;
break;
}
}
}
if (merchant == null) {
if (!TextUtils.isEmpty(couponItem.getImage())) {
Glide.with(mContext)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(couponItem.getImage())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(holder.ivCouponLogo);
} else {
Glide.with(mContext)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(holder.ivCouponLogo);
}
holder.tvCouponTitle.setText(couponItem.getName());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getDescription().equals("null") || TextUtils.isEmpty(couponItem.getDescription()) ? "" : couponItem.getDescription(), Html.FROM_HTML_MODE_COMPACT));
} else {
holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getDescription().equals("null") || TextUtils.isEmpty(couponItem.getDescription()) ? "" : couponItem.getDescription()));
}
} else {
if (!TextUtils.isEmpty(merchant.getImgPreview())) {
Glide.with(mContext)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(merchant.getImgPreview())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(holder.ivCouponLogo);
} else {
Glide.with(mContext)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(holder.ivCouponLogo);
}
holder.tvCouponTitle.setText(merchant.getAdminName());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText().equals("null") || TextUtils.isEmpty(couponItem.getInnerText()) ? "" : couponItem.getInnerText(), Html.FROM_HTML_MODE_COMPACT));
} else {
holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText().equals("null") || TextUtils.isEmpty(couponItem.getInnerText()) ? "" : couponItem.getInnerText()));
}
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(couponItem.getExpiration());
} catch (ParseException e) {
e.printStackTrace();
}
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
if (mIsPast)
holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_expired_date), simpleDateFormat.format(newDate != null ? newDate : "")));
else {
long days = getDaysBetweenDates(simpleDateFormat.format(new Date()), simpleDateFormat.format(newDate != null ? newDate : ""));
holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
if (couponItem.getStatus() == 1) {
if (days < 15) {
holder.tvCouponDate.setText("");
holder.tvCouponDate.setVisibility(View.VISIBLE);
holder.tvCouponDateExpired.setVisibility(View.GONE);
holder.tvDateLimit.setText(String.format(mContext.getString(R.string.cos_coupon_date_limit2), simpleDateFormat.format(newDate != null ? newDate : "")));
holder.lLDateLimit.setVisibility(View.VISIBLE);
} else {
holder.tvCouponDate.setVisibility(View.VISIBLE);
holder.tvCouponDateExpired.setVisibility(View.GONE);
holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
}
} else {
holder.tvCouponDate.setVisibility(View.GONE);
holder.tvCouponDateExpired.setVisibility(View.VISIBLE);
holder.tvCouponDateExpired.setText(mContext.getString(R.string.cos_market_coupon_expired));
}
}
if (TextUtils.isEmpty(couponItem.getDiscount_type())) {
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
} else {
if (couponItem.getDiscount_type().equals("value")) {
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
} else if (couponItem.getDiscount_type().equals("percentage")) {
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.percentage));
} else if (couponItem.getDiscount_type().equals("plus_one")) {
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.plus_one));
} else {
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
}
}
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
return;
}
if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) {
for (Merchant mer : WarplyManagerHelper.getMerchantList()) {
if (mer.getUuid().equals(couponItem.getMerchantUuid())) {
......@@ -109,7 +220,6 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
}
}
}
if (merchant == null) {
if (!TextUtils.isEmpty(couponItem.getImage())) {
Glide.with(mContext)
......@@ -125,10 +235,13 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(holder.ivCouponLogo);
}
holder.tvCouponTitle.setText(couponItem.getName());
if (!mIsPast) {
holder.tvCouponDescription.setText(HtmlCompat.fromHtml(couponItem.getInnerText(), HtmlCompat.FROM_HTML_MODE_COMPACT));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText(), Html.FROM_HTML_MODE_COMPACT));
} else {
holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText()));
}
}
} else {
if (!TextUtils.isEmpty(merchant.getImgPreview())) {
......@@ -145,13 +258,15 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(holder.ivCouponLogo);
}
holder.tvCouponTitle.setText(merchant.getAdminName());
if (!mIsPast) {
holder.tvCouponDescription.setText(HtmlCompat.fromHtml(couponItem.getInnerText(), HtmlCompat.FROM_HTML_MODE_COMPACT));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText(), Html.FROM_HTML_MODE_COMPACT));
} else {
holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText()));
}
}
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
......@@ -164,7 +279,6 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_expired_date), simpleDateFormat.format(newDate != null ? newDate : "")));
else
holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
if (TextUtils.isEmpty(couponItem.getDiscount_type())) {
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
} else {
......@@ -181,11 +295,26 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
}
}
private long getDaysBetweenDates(String start, String end) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
Date startDate, endDate;
long numberOfDays = 0;
try {
startDate = dateFormat.parse(start);
endDate = dateFormat.parse(end);
numberOfDays = getUnitBetweenDates(startDate, endDate, TimeUnit.DAYS);
} catch (ParseException e) {
e.printStackTrace();
}
return numberOfDays;
}
private long getUnitBetweenDates(Date startDate, Date endDate, TimeUnit unit) {
long timeDiff = endDate.getTime() - startDate.getTime();
return unit.convert(timeDiff, TimeUnit.MILLISECONDS);
}
public Observable<Coupon> getPositionClicks() {
return onClickSubject.cache();
}
private long getDifferenceDays(Date d1, Date d2) {
long diff = d2.getTime() - d1.getTime();
return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
......
package ly.warp.sdk.views.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.subjects.PublishSubject;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.UnifiedCoupon;
public class MarketCouponAdapter extends RecyclerView.Adapter<MarketCouponAdapter.ActiveCouponViewHolder> {
private Context mContext;
private ArrayList<UnifiedCoupon> mCoupons;
private final PublishSubject<UnifiedCoupon> onClickSubject = PublishSubject.create();
private boolean mIsPast = false;
public MarketCouponAdapter(Context mContext, ArrayList<UnifiedCoupon> campaignList) {
this.mContext = mContext;
this.mCoupons = campaignList;
this.mIsPast = false;
}
public MarketCouponAdapter(Context mContext, ArrayList<UnifiedCoupon> campaignList, boolean past) {
this.mContext = mContext;
this.mCoupons = campaignList;
this.mIsPast = past;
}
public class ActiveCouponViewHolder extends RecyclerView.ViewHolder {
private ImageView ivCouponBackground;
private TextView tvCouponTitle, tvCouponDate, tvCouponCount;
public ActiveCouponViewHolder(View view) {
super(view);
ivCouponBackground = view.findViewById(R.id.iv_past_coupon_background);
tvCouponTitle = view.findViewById(R.id.tv_market_coupons_title);
tvCouponDate = view.findViewById(R.id.tv_market_coupons_date);
tvCouponCount = view.findViewById(R.id.tv_market_coupons_count);
}
}
@Override
public int getItemCount() {
if (mCoupons == null)
return 0;
else
return mCoupons.size();
}
public UnifiedCoupon getItem(int id) {
return mCoupons.get(id);
}
public void updateData(ArrayList<UnifiedCoupon> couponList) {
mCoupons.clear();
mCoupons.addAll(couponList);
notifyDataSetChanged();
}
@Override
public ActiveCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView;
if (mIsPast)
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.past_coupon_layout, parent, false);
else
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.market_coupon_layout, parent, false);
return new ActiveCouponViewHolder(itemView);
}
@Override
public void onBindViewHolder(final ActiveCouponViewHolder holder, int position) {
UnifiedCoupon couponItem = mCoupons.get(position);
if (couponItem != null) {
int count = 0;
if (couponItem.getCoupons() != null && couponItem.getCoupons().size() > 0) {
ArrayList<Coupon> couponList = new ArrayList<Coupon>();
for (Coupon item : couponItem.getCoupons()) {
if (item.getStatus() == 1) {
count++;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(item.getExpiration());
} catch (ParseException e) {
e.printStackTrace();
}
item.setExpirationDate(newDate);
couponList.add(item);
}
}
Collections.sort(couponList, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate()));
if (couponList != null && couponList.size() > 0) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(couponList.get(0).getExpiration());
} catch (ParseException e) {
e.printStackTrace();
}
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
}
}
if (count > 1) {
holder.tvCouponCount.setText(String.format(mContext.getString(R.string.cos_market_active_coupons), String.valueOf(count)));
} else if (count == 1) {
holder.tvCouponCount.setText(String.format(mContext.getString(R.string.cos_market_active_coupons_single), String.valueOf(count)));
}
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
// Date newDate = new Date();
// try {
// newDate = simpleDateFormat.parse(couponItem.getExpiration());
// } catch (ParseException e) {
// e.printStackTrace();
// }
// simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
// if (mIsPast)
// holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_expired_date), simpleDateFormat.format(newDate != null ? newDate : "")));
// else
// holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
// if (TextUtils.isEmpty(couponItem.getDiscount_type())) {
// holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
// } else {
// if (couponItem.getDiscount_type().equals("value")) {
// holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
// } else if (couponItem.getDiscount_type().equals("percentage")) {
// holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.percentage));
// } else if (couponItem.getDiscount_type().equals("plus_one")) {
// holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.plus_one));
// } else {
// holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
// }
// }
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
}
}
public Observable<UnifiedCoupon> getPositionClicks() {
return onClickSubject.cache();
}
private long getDifferenceDays(Date d1, Date d2) {
long diff = d2.getTime() - d1.getTime();
return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#F0E6E6"/>
<corners android:radius="10dp"/>
<padding android:left="4dp" android:top="2dp" android:right="4dp" android:bottom="2dp" />
</shape>
\ No newline at end of file
......@@ -35,14 +35,14 @@
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
<androidx.core.widget.NestedScrollView
android:id="@+id/sv_loyalty_wallet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/cl_loyalty_wallet_header"
android:fillViewport="true"
android:scrollbars="none"
android:overScrollMode="never">
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
......@@ -94,10 +94,10 @@
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:includeFontPadding="false"
android:textColor="@color/cos_green12"
android:textSize="16sp"
android:layout_marginHorizontal="20dp"
tools:text="@string/cos_profile_preferences_placeholder" />
</LinearLayout>
......@@ -134,70 +134,125 @@
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_deals_cos"
android:id="@+id/cl_exp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="24dp">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_06_cos"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_begin="24dp" />
android:layout_marginHorizontal="4dp"
android:layout_marginTop="24dp"
android:background="@drawable/shape_cos_white_border"
android:paddingHorizontal="14dp"
android:paddingVertical="14dp">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_horizontal_50_cos"
android:id="@+id/gl_horizontal_64_exp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.64" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_deals_win_inner_cos"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/shape_cos_white_border"
<ImageView
android:id="@+id/iv_exp_logo"
android:layout_width="76dp"
android:layout_height="76dp"
android:layout_marginVertical="4dp"
android:src="@drawable/ic_foryou_polygon_new"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/gl_vertical_06_cos"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_16_cos"
<TextView
android:id="@+id/tv_exp_value"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.17" />
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:textColor="@color/cos_light_black"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="@+id/iv_exp_logo"
app:layout_constraintStart_toStartOf="@+id/iv_exp_logo"
app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_64_exp"
tools:text="18.00€" />
<TextView
android:id="@+id/tv_deals_value_all"
android:id="@+id/tv_exp_value_all"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginHorizontal="8dp"
android:includeFontPadding="false"
android:text="@string/cos_deals_win_title_cos"
android:text="@string/cos_for_you_all"
android:textColor="@color/cos_light_black"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/gl_vertical_16_cos"
app:layout_constraintEnd_toStartOf="@+id/iv_exp_arrow"
app:layout_constraintStart_toEndOf="@+id/iv_exp_logo"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_exp_arrow"
android:layout_width="14dp"
android:layout_height="14dp"
android:src="@drawable/ic_down_dark_new"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:visibility="gone"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<net.cachapa.expandablelayout.ExpandableLayout
android:id="@+id/el_exp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:el_duration="300"
app:el_expanded="false"
app:el_parallax="0.5">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_deals_win_inner_cos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="6dp"
android:background="@drawable/shape_cos_white_border"
android:paddingHorizontal="6dp"
android:paddingVertical="4dp">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_horizontal_50_cos"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.64" />
<ImageView
android:id="@+id/iv_deals_logo"
android:layout_width="76dp"
android:layout_height="76dp"
android:layout_marginVertical="4dp"
android:src="@drawable/ic_deals_polygon_new"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_deals_value_all"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:includeFontPadding="false"
android:text="@string/cos_deals_win_title_cos"
android:textColor="@color/cos_light_black"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_deals_logo"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_deals_value"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
......@@ -209,22 +264,18 @@
app:layout_constraintStart_toStartOf="@+id/iv_deals_logo"
app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_50_cos"
tools:text="18.00€" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_deals_win"
android:id="@+id/cl_deals_win_inner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="12dp">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_06"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_begin="24dp" />
android:layout_below="@+id/cl_deals_win_inner_cos"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="6dp"
android:background="@drawable/shape_cos_white_border"
android:paddingHorizontal="6dp"
android:paddingVertical="4dp">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_horizontal_50"
......@@ -233,63 +284,131 @@
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.64" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_deals_win_inner"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/shape_cos_white_border"
<ImageView
android:id="@+id/iv_gifts_logo"
android:layout_width="76dp"
android:layout_height="76dp"
android:src="@drawable/ic_gifts_polygon_new"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/gl_vertical_06"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_16"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.17" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_gifts_value_all"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginHorizontal="8dp"
android:includeFontPadding="false"
android:text="@string/cos_deals_win_title"
android:textColor="@color/cos_light_black"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/gl_vertical_16"
app:layout_constraintStart_toEndOf="@+id/iv_gifts_logo"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_gifts_value"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:textColor="@color/cos_light_black"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="@+id/iv_gifts_logo"
app:layout_constraintStart_toStartOf="@+id/iv_gifts_logo"
app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_50"
tools:text="20.00€" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_market_inner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/cl_deals_win_inner"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="6dp"
android:background="@drawable/shape_cos_white_border"
android:paddingHorizontal="6dp"
android:paddingVertical="4dp">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_horizontal_50_market"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.64" />
<ImageView
android:id="@+id/iv_gifts_logo"
android:id="@+id/iv_market_logo"
android:layout_width="76dp"
android:layout_height="76dp"
android:layout_marginVertical="4dp"
android:src="@drawable/ic_gifts_polygon_new"
android:src="@drawable/ic_market_polygon"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_gifts_value"
android:id="@+id/tv_market_value_all"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:includeFontPadding="false"
android:text="@string/cos_supermarket_win"
android:textColor="@color/cos_light_black"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_market_logo"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_market_value"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:textColor="@color/cos_light_black"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="@+id/iv_gifts_logo"
app:layout_constraintStart_toStartOf="@+id/iv_gifts_logo"
app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_50"
app:layout_constraintEnd_toEndOf="@+id/iv_market_logo"
app:layout_constraintStart_toStartOf="@+id/iv_market_logo"
app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_50_market"
tools:text="20.00€" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</net.cachapa.expandablelayout.ExpandableLayout>
<LinearLayout
android:id="@+id/ll_market_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/tv_market_header"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="10dp"
android:text="@string/cos_market_title"
android:textColor="@color/cos_light_black"
android:textSize="20sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_market_coupons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="2dp"
android:overScrollMode="never"
android:scrollbars="none" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_mygifts"
......@@ -393,7 +512,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:orientation="vertical">
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/tv_active_coupons_header"
......@@ -413,7 +534,8 @@
android:layout_height="wrap_content"
android:layout_marginHorizontal="2dp"
android:overScrollMode="never"
android:paddingBottom="40dp" />
android:paddingBottom="40dp"
android:scrollbars="none" />
<LinearLayout
android:id="@+id/ll_empty_wallet"
......@@ -444,5 +566,5 @@
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
......
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_loyalty_wallet_header"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@android:color/white">
<ImageView
android:id="@+id/iv_coupon_info_back"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:scaleType="centerInside"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_coupon_info_title"
android:textColor="@color/grey"
android:textSize="17sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/cl_loyalty_wallet_header">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never">
<LinearLayout
android:id="@+id/cl_loyalty_info_view_inner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:orientation="vertical"
android:paddingBottom="48dp">
<!-- <ImageView-->
<!-- android:id="@+id/imageView6"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="253dp"-->
<!-- android:layout_marginTop="0.5dp"-->
<!-- android:scaleType="centerCrop"-->
<!-- android:src="@drawable/unified_coupon_banner" />-->
<TextView
android:id="@+id/textView13"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:gravity="center"
android:paddingHorizontal="32dp"
android:text="@string/cos_unified_title"
android:textColor="#415564"
android:textSize="18sp" />
<TextView
android:id="@+id/textView14"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:paddingHorizontal="32dp"
android:text="@string/cos_unified_subtitle"
android:textColor="#415564"
android:textSize="16sp" />
<TextView
android:id="@+id/textView15"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="36dp"
android:text="Κωδικός Κουπονιού"
android:textColor="#415564"
android:textSize="18sp" />
<TextView
android:id="@+id/textView16"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="12dp"
android:background="@drawable/banner_border_light_grey"
android:gravity="center"
android:textColor="@color/grey"
android:textIsSelectable="true"
android:textSize="25dp"
tools:text="1A2C378" />
<LinearLayout
android:id="@+id/ll_barcode_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_barcode_container_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
tools:visibility="visible">
<View
android:id="@+id/view5"
android:layout_width="320dp"
android:layout_height="0.8dp"
android:background="#E6E6E6" />
<ImageView
android:id="@+id/iv_barcode"
android:layout_width="284dp"
android:layout_height="86dp"
android:layout_marginTop="16dp"
android:scaleType="fitXY"
tools:srcCompat="@tools:sample/avatars" />
<TextView
android:id="@+id/tv_full_barcode"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:textColor="@color/grey"
android:textSize="20sp"
android:visibility="gone"
tools:text="@string/cos_show_barcode" />
<View
android:id="@+id/view4"
android:layout_width="320dp"
android:layout_height="0.8dp"
android:layout_marginTop="20dp"
android:background="#E6E6E6" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/textView17"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:textColor="#415564"
tools:text="@string/cos_coupon_date" />
<LinearLayout
android:id="@+id/ll_market_expand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="48dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_market_expand"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_hide_market_coupons"
android:textColor="@color/grey"
android:textSize="16sp" />
<ImageView
android:id="@+id/iv_market_expand"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_marginStart="6dp"
android:src="@drawable/ic_up_dark_new" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_market_coupons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_active_market_coupons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="2dp"
android:overScrollMode="never" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_shops"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="24dp"
android:background="@drawable/selector_button_green"
android:gravity="center"
android:orientation="horizontal"
android:paddingVertical="8dp">
<TextView
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/cos_markets"
android:textColor="@color/white"
android:textSize="17dp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/rl_terms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="32dp"
android:gravity="center">
<LinearLayout
android:id="@+id/ll_terms_inner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_terms"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_coupon_terms_title"
android:textColor="@color/grey"
android:textSize="16sp" />
<ImageView
android:id="@+id/iv_terms_arrow"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_marginStart="6dp"
android:src="@drawable/ic_down_dark_new" />
</LinearLayout>
<TextView
android:id="@+id/tv_terms_value"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_terms_inner"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="16dp"
android:text="@string/cos_market_terms"
android:textColor="#415564"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_line">
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cl_custom_layout"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_marginHorizontal="4dp"
android:layout_marginVertical="4dp"
android:background="@drawable/ic_coupon_background">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_72_percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.72" />
<ImageView
android:id="@+id/iv_active_coupon"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginStart="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_gifts_for_you" />
<View
android:id="@+id/v_separator"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginVertical="16dp"
android:layout_marginStart="8dp"
android:background="@drawable/shape_dashed_vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_active_coupon"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/ll_coupon_info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_72_percent"
app:layout_constraintStart_toEndOf="@+id/v_separator"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_active_coupons_title"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#3A5266"
android:textSize="16sp"
tools:text="Εκπτωτικο κουπονι 10$ για αγορες στα ΙΚΕΑ" />
<TextView
android:id="@+id/tv_active_coupons_value"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#3A5266"
android:textSize="42sp"
tools:text="10$" />
<TextView
android:id="@+id/tv_active_coupons_date"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#617181"
android:textSize="12sp"
android:visibility="gone"
tools:text="@string/cos_active_coupon_date" />
<TextView
android:id="@+id/tv_active_coupons_date_expired"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#617181"
android:textSize="12sp"
android:visibility="gone"
tools:text="@string/cos_market_coupon_expired" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_date_limit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_market_limit"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="gone"
android:layout_marginBottom="36dp"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_coupon_info"
app:layout_constraintStart_toEndOf="@+id/v_separator"
tools:visibility="visible">
<!-- <ImageView-->
<!-- android:layout_width="14dp"-->
<!-- android:layout_height="14dp"-->
<!-- android:layout_marginEnd="4dp"-->
<!-- android:src="@drawable/timer_red" />-->
<TextView
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_coupon_date_limit"
android:textColor="#617181"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_active_coupons_date_limit"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_coupon_date_limit"
android:textColor="#FF6B6B"
android:textSize="12sp"
tools:text="@string/cos_coupon_date_limit2" />
</LinearLayout>
<TextView
android:id="@+id/tv_active_coupons_description"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="32dp"
android:maxLines="4"
android:textColor="#617181"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/gl_vertical_72_percent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Εκπτωση με ελάχιστες αγορές 100€" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_marginHorizontal="4dp"
android:layout_marginVertical="4dp"
android:background="@drawable/ic_coupon_background_new2">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_72_percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.72" />
<ImageView
android:id="@+id/iv_market_coupon"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginStart="24dp"
android:padding="18dp"
android:src="@drawable/ic_market_trolley"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/v_separator"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginVertical="16dp"
android:layout_marginStart="8dp"
android:background="@drawable/shape_dashed_vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_market_coupon"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/ll_coupon_info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_72_percent"
app:layout_constraintStart_toEndOf="@+id/v_separator"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_market_coupons_title"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="3"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
android:text="@string/cos_market_item_title" />
<TextView
fontPath="fonts/pf_square_sans_pro_bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#3A5266"
android:textSize="22sp"
android:text="" />
<TextView
android:id="@+id/tv_market_coupons_date"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_light_black"
android:textSize="12sp"
tools:text="@string/cos_active_coupon_date" />
</LinearLayout>
<TextView
android:id="@+id/tv_market_coupons_count"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="32dp"
android:maxLines="4"
android:textColor="@color/cos_light_black"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/gl_vertical_72_percent"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/cos_market_active_coupons" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -71,4 +71,5 @@
<color name="cos_gray">#9D9D9C</color>
<color name="cos_gray2">#848484</color>
<color name="cos_light_blue">#00A5E3</color>
<color name="cos_grey_dark2">#32485A</color>
</resources>
\ No newline at end of file
......
......@@ -73,8 +73,8 @@
<string name="cos_gift_it">Δώρισέ το</string>
<string name="cos_popup_more_title">COSMOTE MORE FOR YOU</string>
<string name="cos_popup_more_subtitle">Σε αυτή την ενότητα βρες έρευνες, παιχνίδια, διαγωνισμούς και επιβραβεύσεις για τις αθλητικές σου δραστηριότητες!</string>
<string name="cos_deals_win_title">Μέχρι τώρα έχεις κερδίσει %1$s€ σε προσφορές από %2$s κουπόνια!</string>
<string name="cos_deals_win_title_cos">Μέχρι τώρα έχεις κερδίσει %1$s€ με το DEALS for YOU!</string>
<string name="cos_deals_win_title">Έχεις κερδίσει&#160;%1$s€&#160;με το\nGIFTS for YOU!</string>
<string name="cos_deals_win_title_cos">Έχεις κερδίσει&#160;%1$s€&#160;με το\nDEALS for YOU!</string>
<string name="cos_mygifts">Τα δώρα μου</string>
<string name="cos_gifts_banner_title">Δώρα:</string>
<string name="cos_see_more">Δες περισσότερα</string>
......@@ -150,6 +150,25 @@
<string name="cos_dlg_no_shops_title">Καταστήματα συνεργάτη</string>
<string name="cos_dlg_no_shops_positive">Δες το eshop</string>
<string name="cos_profile_preferences_placeholder">Οι προτιμήσεις μου</string>
<string name="cos_market_title">SuperMarket Deals</string>
<string name="cos_rewards_title2">COSMOTE Επιβράβευση</string>
<string name="cos_market_item_title">COSMOTE\nSuperMarket\nDeals</string>
<string name="cos_market_active_coupons">έχεις %1$s ενεργά κουπόνια</string>
<string name="cos_market_active_coupons_single">έχεις %1$s ενεργό κουπόνι</string>
<string name="cos_unified_title">Εκπτωτικό κουπόνι COSMOTE SuperMarket Deals!</string>
<string name="cos_unified_subtitle">Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών.</string>
<string name="cos_markets">Δες τα supermarket</string>
<string name="cos_show_market_coupons">Εμφάνιση κουπονιών</string>
<string name="cos_hide_market_coupons">Απόκρυψη κουπονιών</string>
<string name="cos_market_terms">1. Το εκπτωτικό κουπόνι ισχύει έως την ημερομηνία που αναφέρεται παραπάνω\n
2. To εκπτωτικό κουπόνι αφορά στα ενεργά κουπόνια προσφορών όπως αναφέρονται παραπάνω.\n
3. Το εκπτωτικό κουπόνι μπορεί να χρησιμοποιηθεί σε μια μόνο συναλλαγή.\n
4. Εάν δεν γίνει χρήση ενός επιμέρους κουπονιού προσφοράς από το εκπτωτικό κουπόνι, το κουπόνι προσφοράς επιστρέφει στο καλάθι στην ενότητα COSMOTE SuperMarket Deals</string>
<string name="cos_market_coupon_expired">Το κουπόνι έληξε</string>
<string name="cos_coupon_date_limit">Ισχύει έως&#160;</string>
<string name="cos_coupon_date_limit2">%1$s</string>
<string name="cos_for_you_all">Μέχρι τώρα έχεις κερδίσει&#160;%1$s€&#160;στο For You!</string>
<string name="cos_supermarket_win">Έχεις κερδίσει&#160;%1$s€&#160;με τα\nSuperMarket Deals!</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......