Showing
23 changed files
with
1955 additions
and
151 deletions
... | @@ -104,6 +104,9 @@ dependencies { | ... | @@ -104,6 +104,9 @@ dependencies { |
104 | //------------------------------ Retrofit -----------------------------// | 104 | //------------------------------ Retrofit -----------------------------// |
105 | implementation 'com.squareup.retrofit2:retrofit:2.9.0' | 105 | implementation 'com.squareup.retrofit2:retrofit:2.9.0' |
106 | implementation 'com.squareup.retrofit2:converter-gson:2.9.0' | 106 | implementation 'com.squareup.retrofit2:converter-gson:2.9.0' |
107 | + | ||
108 | + //------------------------------ Expandable Layout -----------------------------// | ||
109 | + api 'net.cachapa.expandablelayout:expandablelayout:2.9.2' | ||
107 | } | 110 | } |
108 | 111 | ||
109 | // In every export please update the version number | 112 | // In every export please update the version number | ... | ... |
... | @@ -48,6 +48,18 @@ | ... | @@ -48,6 +48,18 @@ |
48 | android:theme="@style/SDKAppTheme" /> | 48 | android:theme="@style/SDKAppTheme" /> |
49 | 49 | ||
50 | <activity | 50 | <activity |
51 | + android:name="ly.warp.sdk.activities.LoyaltyMarketAnalysisActivity" | ||
52 | + android:exported="false" | ||
53 | + android:screenOrientation="portrait" | ||
54 | + android:theme="@style/SDKAppTheme" /> | ||
55 | + | ||
56 | + <activity | ||
57 | + android:name="ly.warp.sdk.activities.UnifiedCouponInfoActivity" | ||
58 | + android:exported="false" | ||
59 | + android:screenOrientation="portrait" | ||
60 | + android:theme="@style/SDKAppTheme" /> | ||
61 | + | ||
62 | + <activity | ||
51 | android:name="ly.warp.sdk.activities.ActiveCouponsActivity" | 63 | android:name="ly.warp.sdk.activities.ActiveCouponsActivity" |
52 | android:exported="false" | 64 | android:exported="false" |
53 | android:screenOrientation="portrait" | 65 | android:screenOrientation="portrait" | ... | ... |
... | @@ -5,6 +5,7 @@ import android.content.Context; | ... | @@ -5,6 +5,7 @@ import android.content.Context; |
5 | import android.content.Intent; | 5 | import android.content.Intent; |
6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
7 | import android.os.Handler; | 7 | import android.os.Handler; |
8 | +import android.os.Looper; | ||
8 | import android.text.SpannableStringBuilder; | 9 | import android.text.SpannableStringBuilder; |
9 | import android.text.Spanned; | 10 | import android.text.Spanned; |
10 | import android.text.TextUtils; | 11 | import android.text.TextUtils; |
... | @@ -18,12 +19,16 @@ import android.widget.TextView; | ... | @@ -18,12 +19,16 @@ import android.widget.TextView; |
18 | 19 | ||
19 | import androidx.appcompat.app.AlertDialog; | 20 | import androidx.appcompat.app.AlertDialog; |
20 | import androidx.constraintlayout.widget.ConstraintLayout; | 21 | import androidx.constraintlayout.widget.ConstraintLayout; |
22 | +import androidx.core.content.ContextCompat; | ||
23 | +import androidx.core.widget.NestedScrollView; | ||
21 | import androidx.recyclerview.widget.LinearLayoutManager; | 24 | import androidx.recyclerview.widget.LinearLayoutManager; |
22 | import androidx.recyclerview.widget.RecyclerView; | 25 | import androidx.recyclerview.widget.RecyclerView; |
23 | 26 | ||
24 | import com.bumptech.glide.Glide; | 27 | import com.bumptech.glide.Glide; |
25 | import com.bumptech.glide.load.engine.DiskCacheStrategy; | 28 | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
26 | 29 | ||
30 | +import net.cachapa.expandablelayout.ExpandableLayout; | ||
31 | + | ||
27 | import org.apmem.tools.layouts.FlowLayout; | 32 | import org.apmem.tools.layouts.FlowLayout; |
28 | import org.greenrobot.eventbus.EventBus; | 33 | import org.greenrobot.eventbus.EventBus; |
29 | import org.greenrobot.eventbus.Subscribe; | 34 | import org.greenrobot.eventbus.Subscribe; |
... | @@ -35,23 +40,30 @@ import java.util.ArrayList; | ... | @@ -35,23 +40,30 @@ import java.util.ArrayList; |
35 | import java.util.Collections; | 40 | import java.util.Collections; |
36 | import java.util.Comparator; | 41 | import java.util.Comparator; |
37 | import java.util.Date; | 42 | import java.util.Date; |
43 | +import java.util.Locale; | ||
44 | +import java.util.concurrent.ExecutorService; | ||
45 | +import java.util.concurrent.Executors; | ||
38 | import java.util.concurrent.TimeUnit; | 46 | import java.util.concurrent.TimeUnit; |
39 | 47 | ||
40 | import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan; | 48 | import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan; |
41 | import io.github.inflationx.calligraphy3.TypefaceUtils; | 49 | import io.github.inflationx.calligraphy3.TypefaceUtils; |
42 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; | 50 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; |
43 | import ly.warp.sdk.R; | 51 | import ly.warp.sdk.R; |
52 | +import ly.warp.sdk.io.callbacks.CallbackReceiver; | ||
44 | import ly.warp.sdk.io.models.ActiveDFYCouponEventModel; | 53 | import ly.warp.sdk.io.models.ActiveDFYCouponEventModel; |
45 | import ly.warp.sdk.io.models.ActiveDFYCouponModel; | 54 | import ly.warp.sdk.io.models.ActiveDFYCouponModel; |
46 | import ly.warp.sdk.io.models.Coupon; | 55 | import ly.warp.sdk.io.models.Coupon; |
47 | import ly.warp.sdk.io.models.CouponList; | 56 | import ly.warp.sdk.io.models.CouponList; |
48 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; | 57 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; |
58 | +import ly.warp.sdk.io.models.UnifiedCoupon; | ||
49 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; | 59 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; |
50 | import ly.warp.sdk.utils.WarpUtils; | 60 | import ly.warp.sdk.utils.WarpUtils; |
51 | import ly.warp.sdk.utils.WarplyManagerHelper; | 61 | import ly.warp.sdk.utils.WarplyManagerHelper; |
52 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; | 62 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; |
53 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; | 63 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; |
64 | +import ly.warp.sdk.utils.managers.WarplyManager; | ||
54 | import ly.warp.sdk.views.adapters.ActiveCouponAdapter; | 65 | import ly.warp.sdk.views.adapters.ActiveCouponAdapter; |
66 | +import ly.warp.sdk.views.adapters.MarketCouponAdapter; | ||
55 | 67 | ||
56 | 68 | ||
57 | public class LoyaltyWallet extends Activity implements View.OnClickListener, View.OnScrollChangeListener { | 69 | public class LoyaltyWallet extends Activity implements View.OnClickListener, View.OnScrollChangeListener { |
... | @@ -64,21 +76,29 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -64,21 +76,29 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
64 | // Fields | 76 | // Fields |
65 | // =========================================================== | 77 | // =========================================================== |
66 | 78 | ||
67 | - private ImageView mIvBack, mIvDealsLogo, mIvProfilePhoto; | 79 | + private ImageView mIvBack, mIvDealsLogo, mIvProfilePhoto, mIvExpArrow; |
68 | private TextView mTvUsername, mTvDealsValue, mTvDealsValueAll, | 80 | private TextView mTvUsername, mTvDealsValue, mTvDealsValueAll, |
69 | mTvUserBadge, mTvGiftsValue, mTvGiftsValueAll, mTvActiveCode, mTvActiveDate, | 81 | mTvUserBadge, mTvGiftsValue, mTvGiftsValueAll, mTvActiveCode, mTvActiveDate, |
70 | - mTvActiveTitle, mTvActiveCouponsHeader; | 82 | + mTvActiveTitle, mTvActiveCouponsHeader, mTvMarketValue, mTvMarketAll, mTvFavValue, mTvFavValueAll; |
71 | private ConstraintLayout mClDealsBanner, mClDealsView, | 83 | private ConstraintLayout mClDealsBanner, mClDealsView, |
72 | - mClGiftsBanner, mClToolbar; | 84 | + mClGiftsBanner, mClToolbar, mClExp, mClMarket; |
73 | - private LinearLayout mLlQuestionnaire, mLlUserBadge, mLlEmptyWallet, mLlDeals, mLlGifts; | 85 | + private LinearLayout mLlQuestionnaire, mLlUserBadge, mLlEmptyWallet, mLlDeals, mLlGifts, |
86 | + mLlMarketView; | ||
74 | private FlowLayout mLlActiveCodesView; | 87 | private FlowLayout mLlActiveCodesView; |
75 | - private float couponDfyValue = 0.0f; | 88 | + private float couponDfyValue = 0.0f, mFavValue = 0.0f; |
76 | - private RecyclerView mRecyclerCoupons; | 89 | + private RecyclerView mRecyclerCoupons, mRvMarketCoupons; |
77 | private ActiveCouponAdapter mAdapterCoupons; | 90 | private ActiveCouponAdapter mAdapterCoupons; |
78 | private AlertDialog mAlertDialogNonTelco; | 91 | private AlertDialog mAlertDialogNonTelco; |
79 | - private ScrollView mScActiveCodes, mSvLoyaltyWallet; | 92 | + private ScrollView mScActiveCodes; |
93 | + private NestedScrollView mSvLoyaltyWallet; | ||
80 | private int mTimer = 0; | 94 | private int mTimer = 0; |
81 | private Handler mSecondsHandler; | 95 | private Handler mSecondsHandler; |
96 | + private ArrayList<UnifiedCoupon> mUnifiedCoupons = new ArrayList<UnifiedCoupon>(); | ||
97 | + private ArrayList<UnifiedCoupon> mUnifiedCouponsAll = new ArrayList<UnifiedCoupon>(); | ||
98 | + private float countValue = 0.0f; | ||
99 | + private MarketCouponAdapter mAdapterMarketCoupons; | ||
100 | + private ExpandableLayout mElGifts; | ||
101 | + private boolean mIsStayCollapsed = true; | ||
82 | 102 | ||
83 | // =========================================================== | 103 | // =========================================================== |
84 | // Methods for/from SuperClass/Interfaces | 104 | // Methods for/from SuperClass/Interfaces |
... | @@ -97,8 +117,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -97,8 +117,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
97 | mTvUserBadge = findViewById(R.id.tv_type); | 117 | mTvUserBadge = findViewById(R.id.tv_type); |
98 | mTvGiftsValue = findViewById(R.id.tv_gifts_value); | 118 | mTvGiftsValue = findViewById(R.id.tv_gifts_value); |
99 | mTvGiftsValueAll = findViewById(R.id.tv_gifts_value_all); | 119 | mTvGiftsValueAll = findViewById(R.id.tv_gifts_value_all); |
100 | - mClDealsBanner = findViewById(R.id.cl_deals_cos); | 120 | + mClDealsBanner = findViewById(R.id.cl_deals_win_inner_cos); |
101 | - mClGiftsBanner = findViewById(R.id.cl_deals_win); | 121 | + mClGiftsBanner = findViewById(R.id.cl_deals_win_inner); |
102 | mTvDealsValue = findViewById(R.id.tv_deals_value); | 122 | mTvDealsValue = findViewById(R.id.tv_deals_value); |
103 | mTvDealsValueAll = findViewById(R.id.tv_deals_value_all); | 123 | mTvDealsValueAll = findViewById(R.id.tv_deals_value_all); |
104 | mTvActiveCode = findViewById(R.id.tv_active_deals_text); | 124 | mTvActiveCode = findViewById(R.id.tv_active_deals_text); |
... | @@ -115,6 +135,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -115,6 +135,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
115 | mSvLoyaltyWallet = findViewById(R.id.sv_loyalty_wallet); | 135 | mSvLoyaltyWallet = findViewById(R.id.sv_loyalty_wallet); |
116 | mClToolbar = findViewById(R.id.cl_loyalty_wallet_header); | 136 | mClToolbar = findViewById(R.id.cl_loyalty_wallet_header); |
117 | mLlGifts = findViewById(R.id.ll_gifts_view); | 137 | mLlGifts = findViewById(R.id.ll_gifts_view); |
138 | + mLlMarketView = findViewById(R.id.ll_market_view); | ||
139 | + mRvMarketCoupons = findViewById(R.id.rv_market_coupons); | ||
140 | + mRvMarketCoupons.setNestedScrollingEnabled(false); | ||
141 | + mRvMarketCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | ||
142 | + mElGifts = findViewById(R.id.el_exp); | ||
143 | + mClExp = findViewById(R.id.cl_exp); | ||
144 | + mIvExpArrow = findViewById(R.id.iv_exp_arrow); | ||
145 | + mTvMarketValue = findViewById(R.id.tv_market_value); | ||
146 | + mTvMarketAll = findViewById(R.id.tv_market_value_all); | ||
147 | + mClMarket = findViewById(R.id.cl_market_inner); | ||
148 | + mTvFavValue = findViewById(R.id.tv_exp_value); | ||
149 | + mTvFavValueAll = findViewById(R.id.tv_exp_value_all); | ||
118 | 150 | ||
119 | if (WarplyManagerHelper.getActiveDFYCoupons() != null) { | 151 | if (WarplyManagerHelper.getActiveDFYCoupons() != null) { |
120 | Collections.sort(WarplyManagerHelper.getActiveDFYCoupons(), new Comparator<ActiveDFYCouponModel>() { | 152 | Collections.sort(WarplyManagerHelper.getActiveDFYCoupons(), new Comparator<ActiveDFYCouponModel>() { |
... | @@ -136,7 +168,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -136,7 +168,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
136 | mRecyclerCoupons.setNestedScrollingEnabled(false); | 168 | mRecyclerCoupons.setNestedScrollingEnabled(false); |
137 | mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | 169 | mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); |
138 | 170 | ||
139 | - initViews(); | 171 | +// initViews(); |
172 | + | ||
173 | + WarplyManager.getUnifiedCoupons(mUnifiedCallback); | ||
140 | } | 174 | } |
141 | 175 | ||
142 | @Override | 176 | @Override |
... | @@ -198,7 +232,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -198,7 +232,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
198 | startActivityForResult(WarpViewActivity.createIntentFromURL(LoyaltyWallet.this, WarplyManagerHelper.openQuestionnaire()), 1000); | 232 | startActivityForResult(WarpViewActivity.createIntentFromURL(LoyaltyWallet.this, WarplyManagerHelper.openQuestionnaire()), 1000); |
199 | return; | 233 | return; |
200 | } | 234 | } |
201 | - if (view.getId() == R.id.cl_deals_cos) { | 235 | + if (view.getId() == R.id.cl_deals_win_inner_cos) { |
202 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") | 236 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") |
203 | .concat(":") | 237 | .concat(":") |
204 | .concat("DealsBanner")); | 238 | .concat("DealsBanner")); |
... | @@ -214,7 +248,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -214,7 +248,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
214 | EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | 248 | EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); |
215 | return; | 249 | return; |
216 | } | 250 | } |
217 | - if (view.getId() == R.id.cl_deals_win) { | 251 | + if (view.getId() == R.id.cl_deals_win_inner) { |
218 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") | 252 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") |
219 | .concat(":") | 253 | .concat(":") |
220 | .concat("LoyaltyBanner")); | 254 | .concat("LoyaltyBanner")); |
... | @@ -228,6 +262,31 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -228,6 +262,31 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
228 | startActivity(intent); | 262 | startActivity(intent); |
229 | return; | 263 | return; |
230 | } | 264 | } |
265 | + if (view.getId() == R.id.cl_exp) { | ||
266 | + if (!mIsStayCollapsed) { | ||
267 | + mElGifts.toggle(true); | ||
268 | + if (mElGifts.isExpanded()) { | ||
269 | + mIvExpArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_up_dark_new)); | ||
270 | + } else { | ||
271 | + mIvExpArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_down_dark_new)); | ||
272 | + } | ||
273 | + } | ||
274 | + return; | ||
275 | + } | ||
276 | + if (view.getId() == R.id.cl_market_inner) { | ||
277 | + if (countValue > 0) { | ||
278 | + WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") | ||
279 | + .concat(":") | ||
280 | + .concat("MarketBanner")); | ||
281 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
282 | + analyticsEvent.setEventName("did_tap_market_badge"); | ||
283 | + analyticsEvent.setParameter("screen", "Loyalty Wallet"); | ||
284 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
285 | +// Intent intent = new Intent(LoyaltyWallet.this, LoyaltyMarketAnalysisActivity.class); //TODO: uncomment it | ||
286 | +// startActivity(intent); | ||
287 | + } | ||
288 | + return; | ||
289 | + } | ||
231 | if (view.getId() == R.id.cl_mygifts) { | 290 | if (view.getId() == R.id.cl_mygifts) { |
232 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") | 291 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") |
233 | .concat(":") | 292 | .concat(":") |
... | @@ -329,6 +388,39 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -329,6 +388,39 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
329 | nonTelcoDialog(); | 388 | nonTelcoDialog(); |
330 | } | 389 | } |
331 | 390 | ||
391 | + if (mUnifiedCoupons != null && mUnifiedCoupons.size() > 0) { | ||
392 | + ArrayList<UnifiedCoupon> unilist = new ArrayList<UnifiedCoupon>(); | ||
393 | + for (UnifiedCoupon unicpn : mUnifiedCoupons) { | ||
394 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss", Locale.US); | ||
395 | + Date newDate = new Date(); | ||
396 | + try { | ||
397 | + newDate = simpleDateFormat.parse(unicpn.getCreated()); | ||
398 | + } catch (ParseException e) { | ||
399 | + e.printStackTrace(); | ||
400 | + } | ||
401 | + unicpn.setExpirationDate(newDate); | ||
402 | + unilist.add(unicpn); | ||
403 | + } | ||
404 | + Collections.sort(unilist, (coupon1, coupon2) -> coupon2.getExpirationDate().compareTo(coupon1.getExpirationDate())); | ||
405 | + mAdapterMarketCoupons = new MarketCouponAdapter(this, unilist); | ||
406 | + mRvMarketCoupons.setAdapter(mAdapterMarketCoupons); | ||
407 | + mAdapterMarketCoupons.getPositionClicks() | ||
408 | + .doOnNext(coupon -> { | ||
409 | + WarplyAnalyticsManager.logTrackersEvent(this, "click", ("UnifiedCoupon").concat(":").concat(coupon.getBarcode())); | ||
410 | + Intent intent = new Intent(LoyaltyWallet.this, UnifiedCouponInfoActivity.class); | ||
411 | + intent.putExtra("coupon", (Serializable) coupon); | ||
412 | + intent.putExtra("isFromWallet", true); | ||
413 | + startActivity(intent); | ||
414 | +// startActivityForResult(intent, 1002); | ||
415 | + }) | ||
416 | + .doOnError(error -> { | ||
417 | + }) | ||
418 | + .subscribe(); | ||
419 | + mLlMarketView.setVisibility(View.VISIBLE); | ||
420 | + } else { | ||
421 | + mLlMarketView.setVisibility(View.GONE); | ||
422 | + } | ||
423 | + | ||
332 | if (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0) { | 424 | if (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0) { |
333 | CouponList cpnlist = new CouponList(); | 425 | CouponList cpnlist = new CouponList(); |
334 | for (Coupon cpn : WarplyManagerHelper.getCouponList()) { | 426 | for (Coupon cpn : WarplyManagerHelper.getCouponList()) { |
... | @@ -360,13 +452,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -360,13 +452,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
360 | .doOnError(error -> { | 452 | .doOnError(error -> { |
361 | }) | 453 | }) |
362 | .subscribe(); | 454 | .subscribe(); |
455 | + mLlGifts.setVisibility(View.VISIBLE); | ||
363 | } else { | 456 | } else { |
364 | mLlGifts.setVisibility(View.GONE); | 457 | mLlGifts.setVisibility(View.GONE); |
365 | } | 458 | } |
366 | 459 | ||
367 | - if (WarplyManagerHelper.getDealsCouponsSum() > 0) { | 460 | + // First Expandable Banner |
368 | - mTvDealsValue.setText(String.format(getString(R.string.cos_value), String.valueOf(/*couponDfyValue*/ WarplyManagerHelper.getDealsCouponsSum()))); | 461 | + String badgeValueFirst = String.format("%.02f", WarplyManagerHelper.getDealsCouponsSum()); |
369 | - | 462 | + mTvDealsValue.setText(String.format(getString(R.string.cos_value), badgeValueFirst)); |
370 | SpannableStringBuilder sBuilder = new SpannableStringBuilder(); | 463 | SpannableStringBuilder sBuilder = new SpannableStringBuilder(); |
371 | sBuilder | 464 | sBuilder |
372 | .append(getString(R.string.cos_wallet_text1)) | 465 | .append(getString(R.string.cos_wallet_text1)) |
... | @@ -377,45 +470,63 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -377,45 +470,63 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
377 | sBuilder.setSpan(typefaceRegularSpan, 0, getString(R.string.cos_wallet_text1).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); | 470 | sBuilder.setSpan(typefaceRegularSpan, 0, getString(R.string.cos_wallet_text1).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
378 | 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); | 471 | 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); |
379 | 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); | 472 | 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); |
380 | - | ||
381 | mTvDealsValueAll.setText(sBuilder, TextView.BufferType.SPANNABLE); | 473 | mTvDealsValueAll.setText(sBuilder, TextView.BufferType.SPANNABLE); |
382 | - } else { | 474 | + mFavValue += WarplyManagerHelper.getDealsCouponsSum(); |
383 | - mClDealsBanner.setVisibility(View.GONE); | ||
384 | - } | ||
385 | 475 | ||
386 | - if (WarplyManagerHelper.getLoyaltyBadge() != null) { | 476 | + // Second Expandable Banner |
387 | - if (WarplyManagerHelper.getLoyaltyBadge().getCouponCount() > 0) { | 477 | + if (WarplyManagerHelper.getLoyaltyBadge() != null && (WarplyManagerHelper.getLoyaltyBadge().getCouponCount() > 0 || WarplyManagerHelper.getLoyaltyBadge().getCouponCount() == 0)) { |
388 | String badgeValue = String.format("%.02f", WarplyManagerHelper.getLoyaltyBadge().getValue()); | 478 | String badgeValue = String.format("%.02f", WarplyManagerHelper.getLoyaltyBadge().getValue()); |
389 | - | ||
390 | mTvGiftsValue.setText(String.format(getString(R.string.cos_value), badgeValue)); | 479 | mTvGiftsValue.setText(String.format(getString(R.string.cos_value), badgeValue)); |
391 | - | 480 | + SpannableStringBuilder sBuilderSecond = new SpannableStringBuilder(); |
392 | - SpannableStringBuilder sBuilder = new SpannableStringBuilder(); | 481 | + sBuilderSecond |
393 | - sBuilder | ||
394 | .append(getString(R.string.cos_wallet_text3)) | 482 | .append(getString(R.string.cos_wallet_text3)) |
395 | .append(String.format(getString(R.string.cos_value), badgeValue)) | 483 | .append(String.format(getString(R.string.cos_value), badgeValue)) |
396 | .append(getString(R.string.cos_wallet_text4)) | 484 | .append(getString(R.string.cos_wallet_text4)) |
397 | .append(String.format(getString(R.string.cos_value2), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()))) | 485 | .append(String.format(getString(R.string.cos_value2), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()))) |
398 | .append(getString(R.string.cos_wallet_text5)); | 486 | .append(getString(R.string.cos_wallet_text5)); |
399 | - | 487 | + CalligraphyTypefaceSpan typefaceRegularSpanSecond = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf")); |
400 | - CalligraphyTypefaceSpan typefaceRegularSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf")); | ||
401 | CalligraphyTypefaceSpan typefaceRegularSpan2 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf")); | 488 | CalligraphyTypefaceSpan typefaceRegularSpan2 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf")); |
402 | CalligraphyTypefaceSpan typefaceRegularSpan3 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf")); | 489 | CalligraphyTypefaceSpan typefaceRegularSpan3 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf")); |
403 | - CalligraphyTypefaceSpan typefaceBoldSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf")); | 490 | + CalligraphyTypefaceSpan typefaceBoldSpanSecond = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf")); |
404 | CalligraphyTypefaceSpan typefaceBoldSpan2 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf")); | 491 | CalligraphyTypefaceSpan typefaceBoldSpan2 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf")); |
405 | - sBuilder.setSpan(typefaceRegularSpan, 0, getString(R.string.cos_wallet_text3).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); | 492 | + sBuilderSecond.setSpan(typefaceRegularSpanSecond, 0, getString(R.string.cos_wallet_text3).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
406 | - sBuilder.setSpan(typefaceBoldSpan, getString(R.string.cos_wallet_text3).length(), getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); | 493 | + sBuilderSecond.setSpan(typefaceBoldSpanSecond, getString(R.string.cos_wallet_text3).length(), getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
407 | - 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); | 494 | + 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); |
408 | - 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); | 495 | + 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); |
409 | - 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); | 496 | + 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); |
497 | + mTvGiftsValueAll.setText(sBuilderSecond, TextView.BufferType.SPANNABLE); | ||
498 | + mFavValue += WarplyManagerHelper.getLoyaltyBadge().getValue(); | ||
499 | + } | ||
410 | 500 | ||
411 | - mTvGiftsValueAll.setText(sBuilder, TextView.BufferType.SPANNABLE); | 501 | + // Third Expandable Banner |
502 | + if (mUnifiedCouponsAll.size() > 0) { | ||
503 | + countValue = 0.0f; | ||
504 | + for (UnifiedCoupon unicou : mUnifiedCouponsAll) { | ||
505 | + if (unicou.getCoupons() != null && unicou.getCoupons().size() > 0) { | ||
506 | + for (Coupon inncou : unicou.getCoupons()) { | ||
507 | + if (inncou.getStatus() == 0) { | ||
508 | + countValue += Float.valueOf(inncou.getDiscount()); | ||
509 | + } | ||
510 | + } | ||
511 | + } | ||
512 | + } | ||
513 | + mFavValue += countValue; | ||
514 | + if (countValue > 0) { | ||
515 | + String badgeValue = String.format("%.02f", countValue); | ||
516 | + mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue)); | ||
412 | } else { | 517 | } else { |
413 | - mClGiftsBanner.setVisibility(View.GONE); | 518 | + String badgeValue = String.format("%.02f", 0.0f); |
519 | + mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue)); | ||
414 | } | 520 | } |
415 | } else { | 521 | } else { |
416 | - mClGiftsBanner.setVisibility(View.GONE); | 522 | + String badgeValue = String.format("%.02f", 0.0f); |
523 | + mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue)); | ||
417 | } | 524 | } |
418 | 525 | ||
526 | + // Sum Expandable Banner | ||
527 | + String allValue = String.format("%.02f", mFavValue); | ||
528 | + mTvFavValue.setText(String.format(getString(R.string.cos_value), allValue)); | ||
529 | + | ||
419 | if (WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() > 0) { | 530 | if (WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() > 0) { |
420 | String codes = ""; | 531 | String codes = ""; |
421 | if (WarplyManagerHelper.getActiveDFYCoupons().size() == 1) { | 532 | if (WarplyManagerHelper.getActiveDFYCoupons().size() == 1) { |
... | @@ -452,11 +563,11 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -452,11 +563,11 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
452 | LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_selectable, null); | 563 | LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_selectable, null); |
453 | TextView textView = (TextView) v.findViewById(R.id.tv_code_copy); | 564 | TextView textView = (TextView) v.findViewById(R.id.tv_code_copy); |
454 | TextView textViewComma = (TextView) v.findViewById(R.id.tv_code_comma); | 565 | TextView textViewComma = (TextView) v.findViewById(R.id.tv_code_comma); |
455 | - CalligraphyTypefaceSpan typefaceBoldSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf")); | 566 | + CalligraphyTypefaceSpan typefaceBoldSpanDFY = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf")); |
456 | - SpannableStringBuilder sBuilder = new SpannableStringBuilder(WarplyManagerHelper.getActiveDFYCoupons().get(i).getCode()); | 567 | + SpannableStringBuilder sBuilderDFY = new SpannableStringBuilder(WarplyManagerHelper.getActiveDFYCoupons().get(i).getCode()); |
457 | SpannableStringBuilder sBuilderComma = new SpannableStringBuilder(getString(R.string.cos_comma)); | 568 | SpannableStringBuilder sBuilderComma = new SpannableStringBuilder(getString(R.string.cos_comma)); |
458 | - sBuilder.setSpan(typefaceBoldSpan, 0, sBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); | 569 | + sBuilderDFY.setSpan(typefaceBoldSpanDFY, 0, sBuilderDFY.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
459 | - sBuilderComma.setSpan(typefaceBoldSpan, 0, sBuilderComma.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); | 570 | + sBuilderComma.setSpan(typefaceBoldSpanDFY, 0, sBuilderComma.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
460 | textView.setText(sBuilder, TextView.BufferType.SPANNABLE); | 571 | textView.setText(sBuilder, TextView.BufferType.SPANNABLE); |
461 | textView.setTextIsSelectable(true); | 572 | textView.setTextIsSelectable(true); |
462 | textViewComma.setText(sBuilderComma, TextView.BufferType.SPANNABLE); | 573 | textViewComma.setText(sBuilderComma, TextView.BufferType.SPANNABLE); |
... | @@ -467,6 +578,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -467,6 +578,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
467 | 578 | ||
468 | mScActiveCodes.setVisibility(View.VISIBLE); | 579 | mScActiveCodes.setVisibility(View.VISIBLE); |
469 | mLlActiveCodesView.setVisibility(View.VISIBLE); | 580 | mLlActiveCodesView.setVisibility(View.VISIBLE); |
581 | + mLlDeals.setVisibility(View.VISIBLE); | ||
470 | } | 582 | } |
471 | // mTvActiveCode.setText(codes); | 583 | // mTvActiveCode.setText(codes); |
472 | } else { | 584 | } else { |
... | @@ -498,10 +610,17 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -498,10 +610,17 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
498 | } | 610 | } |
499 | } | 611 | } |
500 | 612 | ||
501 | - if (mClDealsBanner.getVisibility() == View.GONE && mClGiftsBanner.getVisibility() == View.GONE | 613 | + if (mLlMarketView.getVisibility() == View.GONE |
502 | - && mLlDeals.getVisibility() == View.GONE && mLlGifts.getVisibility() == View.GONE) { | 614 | + && WarplyManagerHelper.getDealsCouponsSum() == 0 |
503 | - mLlEmptyWallet.setVisibility(View.VISIBLE); | 615 | + && (WarplyManagerHelper.getLoyaltyBadge() != null && WarplyManagerHelper.getLoyaltyBadge().getCouponCount() == 0) |
504 | - } | 616 | + && mLlDeals.getVisibility() == View.GONE) { |
617 | + mIvExpArrow.setVisibility(View.GONE); | ||
618 | +// mLlEmptyWallet.setVisibility(View.VISIBLE); | ||
619 | + mIsStayCollapsed = true; | ||
620 | + } else { | ||
621 | + mIvExpArrow.setVisibility(View.VISIBLE); | ||
622 | + mIsStayCollapsed = false; | ||
623 | + } //TODO: change the case | ||
505 | 624 | ||
506 | mIvBack.setOnClickListener(this); | 625 | mIvBack.setOnClickListener(this); |
507 | mLlQuestionnaire.setOnClickListener(this); | 626 | mLlQuestionnaire.setOnClickListener(this); |
... | @@ -510,6 +629,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -510,6 +629,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
510 | mClGiftsBanner.setOnClickListener(this); | 629 | mClGiftsBanner.setOnClickListener(this); |
511 | mClDealsView.setOnClickListener(this); | 630 | mClDealsView.setOnClickListener(this); |
512 | mSvLoyaltyWallet.setOnScrollChangeListener(this); | 631 | mSvLoyaltyWallet.setOnScrollChangeListener(this); |
632 | + mClExp.setOnClickListener(this); | ||
633 | + mClMarket.setOnClickListener(this); | ||
513 | } | 634 | } |
514 | 635 | ||
515 | private void nonTelcoDialog() { | 636 | private void nonTelcoDialog() { |
... | @@ -526,6 +647,31 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -526,6 +647,31 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
526 | } | 647 | } |
527 | } | 648 | } |
528 | 649 | ||
650 | + private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() { | ||
651 | + @Override | ||
652 | + public void onSuccess(ArrayList<UnifiedCoupon> result) { | ||
653 | + final ExecutorService executor = Executors.newFixedThreadPool(1); | ||
654 | + executor.submit(() -> { | ||
655 | + mUnifiedCouponsAll = result; | ||
656 | + ArrayList<UnifiedCoupon> cpnlist = new ArrayList<UnifiedCoupon>(); | ||
657 | + for (UnifiedCoupon cpn : result) { | ||
658 | + if (cpn.getStatus().equals("active")) { | ||
659 | + cpnlist.add(cpn); | ||
660 | + } | ||
661 | + } | ||
662 | + mUnifiedCoupons = cpnlist; | ||
663 | + WarplyManagerHelper.setMarketCoupons(result); | ||
664 | + new Handler(Looper.getMainLooper()).post(() -> initViews()); | ||
665 | + executor.shutdownNow(); | ||
666 | + }); | ||
667 | + } | ||
668 | + | ||
669 | + @Override | ||
670 | + public void onFailure(int errorCode) { | ||
671 | + initViews(); | ||
672 | + } | ||
673 | + }; | ||
674 | + | ||
529 | // =========================================================== | 675 | // =========================================================== |
530 | // Inner and Anonymous Classes | 676 | // Inner and Anonymous Classes |
531 | // =========================================================== | 677 | // =========================================================== | ... | ... |
1 | +package ly.warp.sdk.activities; | ||
2 | + | ||
3 | +import android.app.Activity; | ||
4 | +import android.content.Context; | ||
5 | +import android.content.Intent; | ||
6 | +import android.graphics.Bitmap; | ||
7 | +import android.graphics.Color; | ||
8 | +import android.os.Bundle; | ||
9 | +import android.view.View; | ||
10 | +import android.widget.ImageView; | ||
11 | +import android.widget.LinearLayout; | ||
12 | +import android.widget.TextView; | ||
13 | + | ||
14 | +import androidx.core.content.ContextCompat; | ||
15 | +import androidx.recyclerview.widget.LinearLayoutManager; | ||
16 | +import androidx.recyclerview.widget.RecyclerView; | ||
17 | + | ||
18 | +import com.google.android.gms.common.ConnectionResult; | ||
19 | +import com.google.android.gms.common.GoogleApiAvailability; | ||
20 | +import com.google.zxing.BarcodeFormat; | ||
21 | +import com.google.zxing.common.BitMatrix; | ||
22 | +import com.google.zxing.oned.EAN13Writer; | ||
23 | + | ||
24 | +import java.text.ParseException; | ||
25 | +import java.text.SimpleDateFormat; | ||
26 | +import java.util.Collections; | ||
27 | +import java.util.Date; | ||
28 | + | ||
29 | +import io.github.inflationx.viewpump.ViewPumpContextWrapper; | ||
30 | +import ly.warp.sdk.R; | ||
31 | +import ly.warp.sdk.io.models.Coupon; | ||
32 | +import ly.warp.sdk.io.models.CouponList; | ||
33 | +import ly.warp.sdk.io.models.UnifiedCoupon; | ||
34 | +import ly.warp.sdk.utils.WarplyManagerHelper; | ||
35 | +import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; | ||
36 | +import ly.warp.sdk.views.adapters.ActiveCouponAdapter; | ||
37 | + | ||
38 | + | ||
39 | +public class UnifiedCouponInfoActivity extends Activity implements View.OnClickListener { | ||
40 | + | ||
41 | + // =========================================================== | ||
42 | + // Constants | ||
43 | + // =========================================================== | ||
44 | + | ||
45 | + // =========================================================== | ||
46 | + // Fields | ||
47 | + // =========================================================== | ||
48 | + | ||
49 | + private ImageView mIvBack, mIvBarcode, mIvMarketExpand; | ||
50 | + private TextView mTvTerms, mTvCouponCode, mTvCouponDate, mTvMarketExpand, | ||
51 | + mTvTermsValue, mTvFullBarcode; | ||
52 | + private LinearLayout mLlShops, mLlBarcodeContainer, mLlTerms, mLlMarketCoupons, mLlMarketExpand; | ||
53 | + private UnifiedCoupon mCoupon; | ||
54 | + private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false, | ||
55 | + mIsMarketExpand = true; | ||
56 | + private RecyclerView mRecyclerCoupons; | ||
57 | + private ActiveCouponAdapter mAdapterCoupons; | ||
58 | + | ||
59 | + // =========================================================== | ||
60 | + // Methods for/from SuperClass/Interfaces | ||
61 | + // =========================================================== | ||
62 | + | ||
63 | + @Override | ||
64 | + public void onCreate(Bundle savedInstanceState) { | ||
65 | + super.onCreate(savedInstanceState); | ||
66 | + setContentView(R.layout.activity_unified_coupon_info); | ||
67 | + | ||
68 | + UnifiedCoupon tempCoupon = (UnifiedCoupon) getIntent().getSerializableExtra("coupon"); | ||
69 | + if (tempCoupon != null) { | ||
70 | + for (UnifiedCoupon couponItem : WarplyManagerHelper.getMarketCoupons()) { | ||
71 | + if (couponItem.getBarcode().equals(tempCoupon.getBarcode())) { | ||
72 | + mCoupon = couponItem; | ||
73 | + break; | ||
74 | + } | ||
75 | + } | ||
76 | + } | ||
77 | +// mIsFromWallet = getIntent().getBooleanExtra("isFromWallet", false); | ||
78 | + | ||
79 | + mIvBack = findViewById(R.id.iv_coupon_info_back); | ||
80 | + mTvTerms = findViewById(R.id.tv_terms); | ||
81 | + mTvCouponCode = findViewById(R.id.textView16); | ||
82 | + mTvCouponDate = findViewById(R.id.textView17); | ||
83 | + mIvBarcode = findViewById(R.id.iv_barcode); | ||
84 | + mLlShops = findViewById(R.id.ll_shops); | ||
85 | + mLlBarcodeContainer = findViewById(R.id.ll_barcode_container_items); | ||
86 | + mLlTerms = findViewById(R.id.ll_terms_inner); | ||
87 | + mTvTermsValue = findViewById(R.id.tv_terms_value); | ||
88 | + mTvFullBarcode = findViewById(R.id.tv_full_barcode); | ||
89 | + mLlMarketCoupons = findViewById(R.id.ll_market_coupons); | ||
90 | + mLlMarketExpand = findViewById(R.id.ll_market_expand); | ||
91 | + mTvMarketExpand = findViewById(R.id.tv_market_expand); | ||
92 | + mIvMarketExpand = findViewById(R.id.iv_market_expand); | ||
93 | + mRecyclerCoupons = findViewById(R.id.rv_active_market_coupons); | ||
94 | + mRecyclerCoupons.setNestedScrollingEnabled(false); | ||
95 | + mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | ||
96 | + | ||
97 | + initViews(); | ||
98 | + } | ||
99 | + | ||
100 | + @Override | ||
101 | + public void onResume() { | ||
102 | + super.onResume(); | ||
103 | + WarplyAnalyticsManager.logTrackersEvent(this, "screen", "UnifiedCouponScreen"); | ||
104 | + } | ||
105 | + | ||
106 | + @Override | ||
107 | + public void onClick(View view) { | ||
108 | + if (view.getId() == R.id.iv_coupon_info_back) { | ||
109 | + onBackPressed(); | ||
110 | + return; | ||
111 | + } | ||
112 | + if (view.getId() == R.id.ll_shops) { | ||
113 | + WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShops"); | ||
114 | + | ||
115 | + if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(UnifiedCouponInfoActivity.this) == ConnectionResult.SUCCESS) { | ||
116 | + Intent intent = new Intent(UnifiedCouponInfoActivity.this, ShopsActivity.class); | ||
117 | + startActivity(intent); | ||
118 | + return; | ||
119 | + } else { | ||
120 | + Intent intent = new Intent(UnifiedCouponInfoActivity.this, ShopsHuaweiActivity.class); | ||
121 | + startActivity(intent); | ||
122 | + return; | ||
123 | + } | ||
124 | + } | ||
125 | + if (view.getId() == R.id.ll_terms_inner) { | ||
126 | + if (mIsTermsShown) { | ||
127 | + mTvTermsValue.setVisibility(View.GONE); | ||
128 | + ImageView termsButtonArrow = mLlTerms.findViewById(R.id.iv_terms_arrow); | ||
129 | + termsButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_down_dark_new)); | ||
130 | + mIsTermsShown = false; | ||
131 | + } else { | ||
132 | + mTvTermsValue.setVisibility(View.VISIBLE); | ||
133 | + ImageView termsButtonArrow = mLlTerms.findViewById(R.id.iv_terms_arrow); | ||
134 | + termsButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_up_dark_new)); | ||
135 | + mIsTermsShown = true; | ||
136 | + } | ||
137 | + return; | ||
138 | + } | ||
139 | + if (view.getId() == R.id.ll_market_expand) { | ||
140 | + if (mIsMarketExpand) { | ||
141 | + mLlMarketCoupons.setVisibility(View.GONE); | ||
142 | + mTvMarketExpand.setText(getString(R.string.cos_show_market_coupons)); | ||
143 | + mIvMarketExpand.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_down_dark_new)); | ||
144 | + mIsMarketExpand = false; | ||
145 | + } else { | ||
146 | + mLlMarketCoupons.setVisibility(View.VISIBLE); | ||
147 | + mTvMarketExpand.setText(getString(R.string.cos_hide_market_coupons)); | ||
148 | + mIvMarketExpand.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_up_dark_new)); | ||
149 | + mIsMarketExpand = true; | ||
150 | + } | ||
151 | + } | ||
152 | + } | ||
153 | + | ||
154 | + @Override | ||
155 | + protected void attachBaseContext(Context newBase) { | ||
156 | + super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase)); | ||
157 | + } | ||
158 | + | ||
159 | + // =========================================================== | ||
160 | + // Methods | ||
161 | + // =========================================================== | ||
162 | + | ||
163 | + private void initViews() { | ||
164 | + mTvCouponCode.setText(mCoupon.getBarcode()); | ||
165 | + | ||
166 | + mLlMarketCoupons.setVisibility(View.GONE); | ||
167 | + mTvMarketExpand.setText(getString(R.string.cos_show_market_coupons)); | ||
168 | + mIvMarketExpand.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_down_dark_new)); | ||
169 | + mIsMarketExpand = false; | ||
170 | + | ||
171 | + if (mCoupon.getCoupons() != null && mCoupon.getCoupons().size() > 0) { | ||
172 | + CouponList cpnlist = new CouponList(); | ||
173 | + for (Coupon cpn : mCoupon.getCoupons()) { | ||
174 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
175 | + Date newDate = new Date(); | ||
176 | + try { | ||
177 | + newDate = simpleDateFormat.parse(cpn.getExpiration()); | ||
178 | + } catch (ParseException e) { | ||
179 | + e.printStackTrace(); | ||
180 | + } | ||
181 | + cpn.setExpirationDate(newDate); | ||
182 | + cpnlist.add(cpn); | ||
183 | + } | ||
184 | + | ||
185 | + Collections.sort(cpnlist, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate())); | ||
186 | + for (Coupon tempItem : cpnlist) { | ||
187 | + if (tempItem.getStatus() == 1) { | ||
188 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
189 | + Date newDate = new Date(); | ||
190 | + try { | ||
191 | + newDate = simpleDateFormat.parse(cpnlist.get(0).getExpiration()); | ||
192 | + } catch (ParseException e) { | ||
193 | + e.printStackTrace(); | ||
194 | + } | ||
195 | + simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); | ||
196 | + mTvCouponDate.setText(String.format(getResources().getString(R.string.cos_mycoupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); | ||
197 | + break; | ||
198 | + } | ||
199 | + } | ||
200 | + | ||
201 | + mAdapterCoupons = new ActiveCouponAdapter(this, cpnlist, false, true); | ||
202 | + mRecyclerCoupons.setAdapter(mAdapterCoupons); | ||
203 | + mAdapterCoupons.getPositionClicks() | ||
204 | + .doOnNext(coupon -> { | ||
205 | +// WarplyAnalyticsManager.logTrackersEvent(this, "click", ("MarketCoupon").concat(":").concat(coupon.getName())); | ||
206 | +// Intent intent = new Intent(UnifiedCouponInfoActivity.this, CouponInfoActivity.class); | ||
207 | +// intent.putExtra("coupon", (Serializable) coupon); | ||
208 | +// intent.putExtra("isFromWallet", true); | ||
209 | +// startActivityForResult(intent, 1002); | ||
210 | + }) | ||
211 | + .doOnError(error -> { | ||
212 | + }) | ||
213 | + .subscribe(); | ||
214 | + } | ||
215 | + | ||
216 | + mIvBack.setOnClickListener(this); | ||
217 | + mLlShops.setOnClickListener(this); | ||
218 | + mLlTerms.setOnClickListener(this); | ||
219 | + mLlMarketExpand.setOnClickListener(this); | ||
220 | + | ||
221 | + String tempCoupon = ""; | ||
222 | + int result = 0; | ||
223 | + try { | ||
224 | + tempCoupon = mCoupon.getBarcode(); | ||
225 | + for (int i = 0; i < (12 - mCoupon.getBarcode().length()); i++) { | ||
226 | + tempCoupon += "0"; | ||
227 | + } | ||
228 | + } catch (Exception e) { | ||
229 | + e.printStackTrace(); | ||
230 | + } | ||
231 | + | ||
232 | + try { | ||
233 | + for (int i = mCoupon.getBarcode().length() - 1; i >= 0; i--) { | ||
234 | + result = result + Integer.parseInt(String.valueOf((mCoupon.getBarcode()).charAt(i))) * (1 + (2 * (i % 2))); | ||
235 | + } | ||
236 | + } catch (Exception e) { | ||
237 | + e.printStackTrace(); | ||
238 | + } | ||
239 | + | ||
240 | + tempCoupon = tempCoupon + (10 - (result % 10)) % 10; | ||
241 | + createBarcodeBitmap(tempCoupon); | ||
242 | + } | ||
243 | + | ||
244 | + private void createBarcodeBitmap(String barcodeString) { | ||
245 | + EAN13Writer writer = new EAN13Writer(); | ||
246 | + try { | ||
247 | + BitMatrix bitMatrix = writer.encode(barcodeString, BarcodeFormat.EAN_13, 1024, 512); | ||
248 | + int width = bitMatrix.getWidth(); | ||
249 | + int height = bitMatrix.getHeight(); | ||
250 | + Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565); | ||
251 | + for (int x = 0; x < width; x++) { | ||
252 | + for (int y = 0; y < height; y++) { | ||
253 | + bmp.setPixel(x, y, bitMatrix.get(x, y) ? Color.BLACK : Color.WHITE); | ||
254 | + } | ||
255 | + } | ||
256 | + mIvBarcode.setImageBitmap(bmp); | ||
257 | + mTvFullBarcode.setText(barcodeString); | ||
258 | + | ||
259 | + } catch (Exception e) { | ||
260 | + e.printStackTrace(); | ||
261 | + mLlBarcodeContainer.setVisibility(View.GONE); | ||
262 | + mIvBarcode.setVisibility(View.GONE); | ||
263 | + } | ||
264 | + } | ||
265 | + | ||
266 | + // =========================================================== | ||
267 | + // Inner and Anonymous Classes | ||
268 | + // =========================================================== | ||
269 | + | ||
270 | +} |
1 | +/* | ||
2 | + * Copyright 2010-2013 Warply Ltd. All rights reserved. | ||
3 | + * | ||
4 | + * Redistribution and use in source and binary forms, without modification, are | ||
5 | + * permitted provided that the following conditions are met: | ||
6 | + * | ||
7 | + * 1. Redistributions of source code must retain the above copyright notice, | ||
8 | + * this list of conditions and the following disclaimer. | ||
9 | + * | ||
10 | + * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
11 | + * this list of conditions and the following disclaimer in the documentation | ||
12 | + * and/or other materials provided with the distribution. | ||
13 | + * | ||
14 | + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR | ||
15 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
17 | + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
19 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
20 | + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
21 | + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
22 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
23 | + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | + */ | ||
25 | + | ||
26 | +package ly.warp.sdk.io.models; | ||
27 | + | ||
28 | +import android.os.Parcel; | ||
29 | +import android.os.Parcelable; | ||
30 | + | ||
31 | +import org.json.JSONArray; | ||
32 | +import org.json.JSONException; | ||
33 | +import org.json.JSONObject; | ||
34 | + | ||
35 | +import java.io.Serializable; | ||
36 | +import java.util.ArrayList; | ||
37 | +import java.util.Date; | ||
38 | + | ||
39 | +import ly.warp.sdk.utils.WarpUtils; | ||
40 | +import ly.warp.sdk.utils.constants.WarpConstants; | ||
41 | + | ||
42 | +/** | ||
43 | + * Created by Panagiotis Triantafyllou on 04-Apr-23. | ||
44 | + */ | ||
45 | + | ||
46 | +public class UnifiedCoupon implements Parcelable, Serializable { | ||
47 | + | ||
48 | + private static final long serialVersionUID = -4754964462459705285L; | ||
49 | + | ||
50 | + /* Constants used to export the campaign in JSON formal and vice versa */ | ||
51 | + | ||
52 | + private static final String BARCODE = "barcode"; | ||
53 | + private static final String CODE = "code"; | ||
54 | + private static final String CREATED = "created"; | ||
55 | + private static final String COUPONS = "coupons"; | ||
56 | + private static final String STATUS = "status"; | ||
57 | + private static final String DESCRIPTION = "description"; | ||
58 | + | ||
59 | + /* Member variables of the Campaign object */ | ||
60 | + | ||
61 | + private String barcode = ""; | ||
62 | + private String description = ""; | ||
63 | + private String status = ""; | ||
64 | + private int code = 0; | ||
65 | + private String created = ""; | ||
66 | + private ArrayList<Coupon> coupons = new ArrayList(); | ||
67 | + private Date expirationDate = new Date(); | ||
68 | + | ||
69 | + public UnifiedCoupon() { | ||
70 | + this.barcode = ""; | ||
71 | + this.description = ""; | ||
72 | + this.status = ""; | ||
73 | + this.code = 0; | ||
74 | + this.created = ""; | ||
75 | + this.coupons = new ArrayList(); | ||
76 | + this.expirationDate = new Date(); | ||
77 | + } | ||
78 | + | ||
79 | + /** | ||
80 | + * Basic constructor used to create an object from a String, representing a | ||
81 | + * JSON Object | ||
82 | + * | ||
83 | + * @param json The String, representing the JSON Object | ||
84 | + * @throws JSONException Thrown if the String cannot be converted to JSON | ||
85 | + */ | ||
86 | + public UnifiedCoupon(String json) throws JSONException { | ||
87 | + this(new JSONObject(json)); | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
91 | + * Constructor used to create an Object from a given JSON Object | ||
92 | + * | ||
93 | + * @param json JSON Object used to create the Coupon | ||
94 | + */ | ||
95 | + public UnifiedCoupon(JSONObject json) { | ||
96 | + if (json != null) { | ||
97 | + this.barcode = json.optString(BARCODE); | ||
98 | + this.description = json.optString(DESCRIPTION); | ||
99 | + this.status = json.optString(STATUS); | ||
100 | + this.code = json.optInt(CODE); | ||
101 | + this.created = json.optString(CREATED); | ||
102 | + JSONArray jArray = null; | ||
103 | + jArray = json.optJSONArray(COUPONS); | ||
104 | + if (jArray != null && jArray.length() > 0) { | ||
105 | + for (int i = 0; i < jArray.length(); i++) { | ||
106 | + JSONObject jObj = jArray.optJSONObject(i); | ||
107 | + this.coupons.add(new Coupon(jObj)); | ||
108 | + } | ||
109 | + } | ||
110 | + } | ||
111 | + } | ||
112 | + | ||
113 | + public UnifiedCoupon(Parcel source) { | ||
114 | + this.barcode = source.readString(); | ||
115 | + this.description = source.readString(); | ||
116 | + this.status = source.readString(); | ||
117 | + this.code = source.readInt(); | ||
118 | + this.created = source.readString(); | ||
119 | + } | ||
120 | + | ||
121 | + @Override | ||
122 | + public void writeToParcel(Parcel dest, int flags) { | ||
123 | + dest.writeString(this.barcode); | ||
124 | + dest.writeString(this.description); | ||
125 | + dest.writeString(this.status); | ||
126 | + dest.writeInt(this.code); | ||
127 | + dest.writeString(this.created); | ||
128 | + } | ||
129 | + | ||
130 | + /** | ||
131 | + * Converts the Unified Coupon into a JSON Object | ||
132 | + * | ||
133 | + * @return The JSON Object created from this Unified Coupon | ||
134 | + */ | ||
135 | + public JSONObject toJSONObject() { | ||
136 | + JSONObject jObj = new JSONObject(); | ||
137 | + try { | ||
138 | + jObj.putOpt(BARCODE, this.barcode); | ||
139 | + jObj.putOpt(DESCRIPTION, this.description); | ||
140 | + jObj.putOpt(STATUS, this.status); | ||
141 | + jObj.putOpt(CODE, this.code); | ||
142 | + jObj.putOpt(CREATED, this.created); | ||
143 | + jObj.putOpt(COUPONS, this.coupons); | ||
144 | + } catch (JSONException e) { | ||
145 | + if (WarpConstants.DEBUG) { | ||
146 | + e.printStackTrace(); | ||
147 | + } | ||
148 | + } | ||
149 | + return jObj; | ||
150 | + } | ||
151 | + | ||
152 | + /** | ||
153 | + * String representation of the Unified Coupon, as a JSON object | ||
154 | + * | ||
155 | + * @return A String representation of JSON object | ||
156 | + */ | ||
157 | + public String toString() { | ||
158 | + if (toJSONObject() != null) | ||
159 | + return toJSONObject().toString(); | ||
160 | + return null; | ||
161 | + } | ||
162 | + | ||
163 | + /** | ||
164 | + * String representation of the Coupon, as a human readable JSON object | ||
165 | + * | ||
166 | + * @return A human readable String representation of JSON object | ||
167 | + */ | ||
168 | + public String toHumanReadableString() { | ||
169 | + String humanReadableString = null; | ||
170 | + try { | ||
171 | + humanReadableString = toJSONObject().toString(2); | ||
172 | + } catch (JSONException e) { | ||
173 | + WarpUtils.warn("Failed converting Unified Coupon JSON object to String", e); | ||
174 | + } | ||
175 | + return humanReadableString; | ||
176 | + } | ||
177 | + | ||
178 | + // ================================================================================ | ||
179 | + // Getters | ||
180 | + // ================================================================================ | ||
181 | + | ||
182 | + | ||
183 | + public String getBarcode() { | ||
184 | + return barcode; | ||
185 | + } | ||
186 | + | ||
187 | + public void setBarcode(String barcode) { | ||
188 | + this.barcode = barcode; | ||
189 | + } | ||
190 | + | ||
191 | + public int getCode() { | ||
192 | + return code; | ||
193 | + } | ||
194 | + | ||
195 | + public void setCode(int code) { | ||
196 | + this.code = code; | ||
197 | + } | ||
198 | + | ||
199 | + public String getCreated() { | ||
200 | + return created; | ||
201 | + } | ||
202 | + | ||
203 | + public void setCreated(String created) { | ||
204 | + this.created = created; | ||
205 | + } | ||
206 | + | ||
207 | + public ArrayList<Coupon> getCoupons() { | ||
208 | + return coupons; | ||
209 | + } | ||
210 | + | ||
211 | + public void setCoupons(ArrayList<Coupon> coupons) { | ||
212 | + this.coupons = coupons; | ||
213 | + } | ||
214 | + | ||
215 | + public String getStatus() { | ||
216 | + return status; | ||
217 | + } | ||
218 | + | ||
219 | + public void setStatus(String status) { | ||
220 | + this.status = status; | ||
221 | + } | ||
222 | + | ||
223 | + public String getDescription() { | ||
224 | + return description; | ||
225 | + } | ||
226 | + | ||
227 | + public void setDescription(String description) { | ||
228 | + this.description = description; | ||
229 | + } | ||
230 | + | ||
231 | + public Date getExpirationDate() { | ||
232 | + return expirationDate; | ||
233 | + } | ||
234 | + | ||
235 | + public void setExpirationDate(Date expirationDate) { | ||
236 | + this.expirationDate = expirationDate; | ||
237 | + } | ||
238 | + | ||
239 | + @Override | ||
240 | + public int describeContents() { | ||
241 | + return 0; | ||
242 | + } | ||
243 | + | ||
244 | + public static final Creator<UnifiedCoupon> CREATOR = new Creator<UnifiedCoupon>() { | ||
245 | + public UnifiedCoupon createFromParcel(Parcel source) { | ||
246 | + return new UnifiedCoupon(source); | ||
247 | + } | ||
248 | + | ||
249 | + public UnifiedCoupon[] newArray(int size) { | ||
250 | + return new UnifiedCoupon[size]; | ||
251 | + } | ||
252 | + }; | ||
253 | +} |
... | @@ -54,6 +54,18 @@ public interface ApiService { | ... | @@ -54,6 +54,18 @@ public interface ApiService { |
54 | @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer); | 54 | @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer); |
55 | 55 | ||
56 | @Headers("Content-Type: application/json") | 56 | @Headers("Content-Type: application/json") |
57 | + @POST("/oauth/{appUuid}/context") | ||
58 | + Call<ResponseBody> getUnifiedCoupons(@Path("appUuid") String appUuid, | ||
59 | + @Body RequestBody request, | ||
60 | + @Header(WarpConstants.HEADER_DATE) String timeStamp, | ||
61 | + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, | ||
62 | + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, | ||
63 | + @Header(WarpConstants.HEADER_CHANNEL) String channel, | ||
64 | + @Header(WarpConstants.HEADER_WEB_ID) String webId, | ||
65 | + @Header(WarpConstants.HEADER_SIGNATURE) String signature, | ||
66 | + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer); | ||
67 | + | ||
68 | + @Headers("Content-Type: application/json") | ||
57 | @POST("/api/mobile/v2/{appUuid}/context/") | 69 | @POST("/api/mobile/v2/{appUuid}/context/") |
58 | Call<ResponseBody> getMerchants(@Path("appUuid") String appUuid, | 70 | Call<ResponseBody> getMerchants(@Path("appUuid") String appUuid, |
59 | @Body RequestBody request, | 71 | @Body RequestBody request, | ... | ... |
... | @@ -74,6 +74,7 @@ import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage; | ... | @@ -74,6 +74,7 @@ import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage; |
74 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; | 74 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; |
75 | import ly.warp.sdk.io.models.MerchantList; | 75 | import ly.warp.sdk.io.models.MerchantList; |
76 | import ly.warp.sdk.io.models.PushCampaign; | 76 | import ly.warp.sdk.io.models.PushCampaign; |
77 | +import ly.warp.sdk.io.models.UnifiedCoupon; | ||
77 | import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; | 78 | import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; |
78 | import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; | 79 | import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; |
79 | import ly.warp.sdk.io.request.CosmoteSharingRequest; | 80 | import ly.warp.sdk.io.request.CosmoteSharingRequest; |
... | @@ -123,6 +124,7 @@ public class WarplyManagerHelper { | ... | @@ -123,6 +124,7 @@ public class WarplyManagerHelper { |
123 | public static double mMetersWebview = 0.0d; | 124 | public static double mMetersWebview = 0.0d; |
124 | public static int mStepsWebview = 0; | 125 | public static int mStepsWebview = 0; |
125 | public static int mSteps = 0; | 126 | public static int mSteps = 0; |
127 | + private static ArrayList<UnifiedCoupon> mMarketCoupons = new ArrayList<>(); | ||
126 | 128 | ||
127 | // =========================================================== | 129 | // =========================================================== |
128 | // Methods for/from SuperClass/Interfaces | 130 | // Methods for/from SuperClass/Interfaces |
... | @@ -1247,6 +1249,13 @@ public class WarplyManagerHelper { | ... | @@ -1247,6 +1249,13 @@ public class WarplyManagerHelper { |
1247 | mDealsSum = sum; | 1249 | mDealsSum = sum; |
1248 | } | 1250 | } |
1249 | 1251 | ||
1252 | + public static ArrayList<UnifiedCoupon> getMarketCoupons() { | ||
1253 | + return mMarketCoupons; | ||
1254 | + } | ||
1255 | + public static void setMarketCoupons( ArrayList<UnifiedCoupon> marketCoupons) { | ||
1256 | + mMarketCoupons = marketCoupons; | ||
1257 | + } | ||
1258 | + | ||
1250 | public static boolean checkForLoyaltySDKNotification(Context context, Map<String, String> pushPayload) { | 1259 | public static boolean checkForLoyaltySDKNotification(Context context, Map<String, String> pushPayload) { |
1251 | Bundle data = convertToBundle(pushPayload); | 1260 | Bundle data = convertToBundle(pushPayload); |
1252 | if (data == null || !data.containsKey("loyalty-action")) | 1261 | if (data == null || !data.containsKey("loyalty-action")) | ... | ... |
... | @@ -97,6 +97,7 @@ import ly.warp.sdk.io.models.SharingList; | ... | @@ -97,6 +97,7 @@ import ly.warp.sdk.io.models.SharingList; |
97 | import ly.warp.sdk.io.models.TagsCategoriesList; | 97 | import ly.warp.sdk.io.models.TagsCategoriesList; |
98 | import ly.warp.sdk.io.models.TagsList; | 98 | import ly.warp.sdk.io.models.TagsList; |
99 | import ly.warp.sdk.io.models.TransactionsList; | 99 | import ly.warp.sdk.io.models.TransactionsList; |
100 | +import ly.warp.sdk.io.models.UnifiedCoupon; | ||
100 | import ly.warp.sdk.io.models.WarplyPacingEventModel; | 101 | import ly.warp.sdk.io.models.WarplyPacingEventModel; |
101 | import ly.warp.sdk.io.request.CosmoteCouponSharingRequest; | 102 | import ly.warp.sdk.io.request.CosmoteCouponSharingRequest; |
102 | import ly.warp.sdk.io.request.CosmotePostEventRequest; | 103 | import ly.warp.sdk.io.request.CosmotePostEventRequest; |
... | @@ -1892,6 +1893,71 @@ public class WarplyManager { | ... | @@ -1892,6 +1893,71 @@ public class WarplyManager { |
1892 | }); | 1893 | }); |
1893 | } | 1894 | } |
1894 | 1895 | ||
1896 | + public static void getUnifiedCoupons(final CallbackReceiver<ArrayList<UnifiedCoupon>> receiver) { | ||
1897 | + WarpUtils.log("************* WARPLY User Coupons Request ********************"); | ||
1898 | + WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active"); | ||
1899 | + WarpUtils.log("**************************************************"); | ||
1900 | + ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class); | ||
1901 | + getUnifiedCouponsRetro(service, new Callback<ResponseBody>() { | ||
1902 | + @Override | ||
1903 | + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> responseCoupons) { | ||
1904 | + if (responseCoupons.code() == 200 && responseCoupons.body() != null) { | ||
1905 | + JSONObject jobjCouponsResponse = null; | ||
1906 | + try { | ||
1907 | + jobjCouponsResponse = new JSONObject(responseCoupons.body().string()); | ||
1908 | + } catch (Exception e) { | ||
1909 | + e.printStackTrace(); | ||
1910 | + } | ||
1911 | + if (jobjCouponsResponse != null && jobjCouponsResponse.has("status") && jobjCouponsResponse.optInt("status", 2) == 1) { | ||
1912 | + ArrayList<UnifiedCoupon> couponList = new ArrayList<UnifiedCoupon>(); | ||
1913 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
1914 | + dynatraceEvent.setEventName("custom_success_unified_coupons_loyalty"); | ||
1915 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
1916 | + JSONObject finalJobjCouponsResponse = jobjCouponsResponse; | ||
1917 | + final ExecutorService executor = Executors.newFixedThreadPool(1); | ||
1918 | + executor.submit(() -> { | ||
1919 | + JSONObject jCouponsBody = null; | ||
1920 | + try { | ||
1921 | + jCouponsBody = finalJobjCouponsResponse.optJSONObject("result"); | ||
1922 | + if (jCouponsBody != null && jCouponsBody.length() > 0) { | ||
1923 | + JSONArray jCouponsInnerBody = null; | ||
1924 | + jCouponsInnerBody = jCouponsBody.optJSONArray("coupons"); | ||
1925 | + if (jCouponsInnerBody != null && jCouponsInnerBody.length() > 0) { | ||
1926 | + for (int i = 0; i < jCouponsInnerBody.length(); i++) { | ||
1927 | + couponList.add(new UnifiedCoupon(jCouponsInnerBody.optJSONObject(i))); | ||
1928 | + } | ||
1929 | + } | ||
1930 | + } | ||
1931 | + } catch (Exception e) { | ||
1932 | + e.printStackTrace(); | ||
1933 | + } | ||
1934 | + new Handler(Looper.getMainLooper()).post(() -> receiver.onSuccess(couponList)); | ||
1935 | + executor.shutdownNow(); | ||
1936 | + }); | ||
1937 | + } else { | ||
1938 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
1939 | + dynatraceEvent.setEventName("custom_error_unified_coupons_loyalty"); | ||
1940 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
1941 | + receiver.onFailure(2); | ||
1942 | + } | ||
1943 | + } else { | ||
1944 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
1945 | + dynatraceEvent.setEventName("custom_error_unified_coupons_loyalty"); | ||
1946 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
1947 | + receiver.onFailure(responseCoupons.code()); | ||
1948 | + } | ||
1949 | + } | ||
1950 | + | ||
1951 | + @Override | ||
1952 | + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) { | ||
1953 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
1954 | + dynatraceEvent.setEventName("custom_error_user_coupons_loyalty"); | ||
1955 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
1956 | + receiver.onFailure(2); | ||
1957 | + } | ||
1958 | + }); | ||
1959 | + } | ||
1960 | + | ||
1895 | public static void getUserCouponsWithCouponsets(WarplyUserCouponsRequest request, final CallbackReceiver<CouponList> receiver) { | 1961 | public static void getUserCouponsWithCouponsets(WarplyUserCouponsRequest request, final CallbackReceiver<CouponList> receiver) { |
1896 | WarpUtils.log("************* WARPLY User Coupons Request ********************"); | 1962 | WarpUtils.log("************* WARPLY User Coupons Request ********************"); |
1897 | WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active"); | 1963 | WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active"); |
... | @@ -2248,6 +2314,58 @@ public class WarplyManager { | ... | @@ -2248,6 +2314,58 @@ public class WarplyManager { |
2248 | }); | 2314 | }); |
2249 | } | 2315 | } |
2250 | 2316 | ||
2317 | + private static void getUnifiedCouponsRetro(ApiService service, Callback<ResponseBody> callback) { | ||
2318 | + String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); | ||
2319 | + String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); | ||
2320 | + String webId = WarpUtils.getWebId(Warply.getWarplyContext()); | ||
2321 | + Map<String, Object> jsonParamsCouponsets = new ArrayMap<>(); | ||
2322 | + Map<String, Object> jsonParams = new ArrayMap<>(); | ||
2323 | + jsonParams.put("action", "retrieve_unified_coupons"); | ||
2324 | + jsonParams.put("language", WarplyProperty.getLanguage(Warply.getWarplyContext())); | ||
2325 | + jsonParamsCouponsets.put("coupon", jsonParams); | ||
2326 | + RequestBody unifiedCouponsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsCouponsets)).toString()); | ||
2327 | + Call<ResponseBody> unifiedCouponsCall = service.getUnifiedCoupons( | ||
2328 | + WarplyProperty.getAppUuid(Warply.getWarplyContext()), | ||
2329 | + unifiedCouponsRequest, | ||
2330 | + timeStamp, | ||
2331 | + "android:" + Warply.getWarplyContext().getPackageName(), | ||
2332 | + new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(), | ||
2333 | + "mobile", | ||
2334 | + webId, | ||
2335 | + WarpUtils.produceSignature(apiKey + timeStamp), | ||
2336 | + "Bearer " + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token") | ||
2337 | + ); | ||
2338 | + unifiedCouponsCall.enqueue(new Callback<ResponseBody>() { | ||
2339 | + @Override | ||
2340 | + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) { | ||
2341 | + if (response.code() == 401) { | ||
2342 | + refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() { | ||
2343 | + @Override | ||
2344 | + public void onSuccess(JSONObject result) { | ||
2345 | + int status = result.optInt("status", 2); | ||
2346 | + if (status == 1) | ||
2347 | + getUnifiedCouponsRetro(service, callback); | ||
2348 | + else | ||
2349 | + callback.onFailure(call, new Throwable()); | ||
2350 | + } | ||
2351 | + | ||
2352 | + @Override | ||
2353 | + public void onFailure(int errorCode) { | ||
2354 | + callback.onFailure(call, new Throwable()); | ||
2355 | + } | ||
2356 | + }); | ||
2357 | + } else { | ||
2358 | + callback.onResponse(call, response); | ||
2359 | + } | ||
2360 | + } | ||
2361 | + | ||
2362 | + @Override | ||
2363 | + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) { | ||
2364 | + callback.onFailure(call, t); | ||
2365 | + } | ||
2366 | + }); | ||
2367 | + } | ||
2368 | + | ||
2251 | private static void getMerchantsRetro(ApiService service, Callback<ResponseBody> callback) { | 2369 | private static void getMerchantsRetro(ApiService service, Callback<ResponseBody> callback) { |
2252 | String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); | 2370 | String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); |
2253 | String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); | 2371 | String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); | ... | ... |
1 | package ly.warp.sdk.views.adapters; | 1 | package ly.warp.sdk.views.adapters; |
2 | - | ||
3 | import android.content.Context; | 2 | import android.content.Context; |
3 | +import android.os.Build; | ||
4 | +import android.text.Html; | ||
4 | import android.text.TextUtils; | 5 | import android.text.TextUtils; |
5 | import android.view.LayoutInflater; | 6 | import android.view.LayoutInflater; |
6 | import android.view.View; | 7 | import android.view.View; |
7 | import android.view.ViewGroup; | 8 | import android.view.ViewGroup; |
8 | import android.widget.ImageView; | 9 | import android.widget.ImageView; |
10 | +import android.widget.LinearLayout; | ||
9 | import android.widget.TextView; | 11 | import android.widget.TextView; |
10 | - | 12 | +import androidx.constraintlayout.widget.ConstraintLayout; |
11 | import androidx.core.content.ContextCompat; | 13 | import androidx.core.content.ContextCompat; |
12 | -import androidx.core.text.HtmlCompat; | ||
13 | import androidx.recyclerview.widget.RecyclerView; | 14 | import androidx.recyclerview.widget.RecyclerView; |
14 | - | ||
15 | import com.bumptech.glide.Glide; | 15 | import com.bumptech.glide.Glide; |
16 | import com.bumptech.glide.load.engine.DiskCacheStrategy; | 16 | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
17 | - | ||
18 | import java.text.ParseException; | 17 | import java.text.ParseException; |
19 | import java.text.SimpleDateFormat; | 18 | import java.text.SimpleDateFormat; |
20 | import java.util.Date; | 19 | import java.util.Date; |
20 | +import java.util.Locale; | ||
21 | import java.util.concurrent.TimeUnit; | 21 | import java.util.concurrent.TimeUnit; |
22 | - | ||
23 | import io.reactivex.Observable; | 22 | import io.reactivex.Observable; |
24 | import io.reactivex.subjects.PublishSubject; | 23 | import io.reactivex.subjects.PublishSubject; |
25 | import ly.warp.sdk.R; | 24 | import ly.warp.sdk.R; |
... | @@ -27,30 +26,33 @@ import ly.warp.sdk.io.models.Coupon; | ... | @@ -27,30 +26,33 @@ import ly.warp.sdk.io.models.Coupon; |
27 | import ly.warp.sdk.io.models.CouponList; | 26 | import ly.warp.sdk.io.models.CouponList; |
28 | import ly.warp.sdk.io.models.Merchant; | 27 | import ly.warp.sdk.io.models.Merchant; |
29 | import ly.warp.sdk.utils.WarplyManagerHelper; | 28 | import ly.warp.sdk.utils.WarplyManagerHelper; |
30 | - | ||
31 | public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapter.ActiveCouponViewHolder> { | 29 | public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapter.ActiveCouponViewHolder> { |
32 | - | ||
33 | private Context mContext; | 30 | private Context mContext; |
34 | private CouponList mCoupons; | 31 | private CouponList mCoupons; |
35 | private final PublishSubject<Coupon> onClickSubject = PublishSubject.create(); | 32 | private final PublishSubject<Coupon> onClickSubject = PublishSubject.create(); |
36 | - private boolean mIsPast = false; | 33 | + private boolean mIsPast = false, mIsCustom = false; |
37 | - | ||
38 | public ActiveCouponAdapter(Context mContext, CouponList campaignList) { | 34 | public ActiveCouponAdapter(Context mContext, CouponList campaignList) { |
39 | this.mContext = mContext; | 35 | this.mContext = mContext; |
40 | this.mCoupons = campaignList; | 36 | this.mCoupons = campaignList; |
41 | this.mIsPast = false; | 37 | this.mIsPast = false; |
42 | } | 38 | } |
43 | - | ||
44 | public ActiveCouponAdapter(Context mContext, CouponList campaignList, boolean past) { | 39 | public ActiveCouponAdapter(Context mContext, CouponList campaignList, boolean past) { |
45 | this.mContext = mContext; | 40 | this.mContext = mContext; |
46 | this.mCoupons = campaignList; | 41 | this.mCoupons = campaignList; |
47 | this.mIsPast = past; | 42 | this.mIsPast = past; |
48 | } | 43 | } |
49 | - | 44 | + public ActiveCouponAdapter(Context mContext, CouponList campaignList, boolean past, boolean custom) { |
45 | + this.mContext = mContext; | ||
46 | + this.mCoupons = campaignList; | ||
47 | + this.mIsPast = past; | ||
48 | + this.mIsCustom = custom; | ||
49 | + } | ||
50 | public class ActiveCouponViewHolder extends RecyclerView.ViewHolder { | 50 | public class ActiveCouponViewHolder extends RecyclerView.ViewHolder { |
51 | private ImageView ivCouponLogo, ivCouponBackground; | 51 | private ImageView ivCouponLogo, ivCouponBackground; |
52 | - private TextView tvCouponTitle, tvCouponValue, tvCouponDate, tvCouponDescription; | 52 | + private TextView tvCouponTitle, tvCouponValue, tvCouponDate, tvDateLimit, |
53 | - | 53 | + tvCouponDescription, tvCouponDateExpired; |
54 | + private ConstraintLayout clCustomLayout; | ||
55 | + private LinearLayout lLDateLimit; | ||
54 | public ActiveCouponViewHolder(View view) { | 56 | public ActiveCouponViewHolder(View view) { |
55 | super(view); | 57 | super(view); |
56 | ivCouponBackground = view.findViewById(R.id.iv_past_coupon_background); | 58 | ivCouponBackground = view.findViewById(R.id.iv_past_coupon_background); |
... | @@ -59,9 +61,12 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte | ... | @@ -59,9 +61,12 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte |
59 | tvCouponValue = view.findViewById(R.id.tv_active_coupons_value); | 61 | tvCouponValue = view.findViewById(R.id.tv_active_coupons_value); |
60 | tvCouponDate = view.findViewById(R.id.tv_active_coupons_date); | 62 | tvCouponDate = view.findViewById(R.id.tv_active_coupons_date); |
61 | tvCouponDescription = view.findViewById(R.id.tv_active_coupons_description); | 63 | tvCouponDescription = view.findViewById(R.id.tv_active_coupons_description); |
64 | + clCustomLayout = view.findViewById(R.id.cl_custom_layout); | ||
65 | + tvCouponDateExpired = view.findViewById(R.id.tv_active_coupons_date_expired); | ||
66 | + tvDateLimit = view.findViewById(R.id.tv_active_coupons_date_limit); | ||
67 | + lLDateLimit = view.findViewById(R.id.ll_date_limit); | ||
62 | } | 68 | } |
63 | } | 69 | } |
64 | - | ||
65 | @Override | 70 | @Override |
66 | public int getItemCount() { | 71 | public int getItemCount() { |
67 | if (mCoupons == null) | 72 | if (mCoupons == null) |
... | @@ -69,38 +74,144 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte | ... | @@ -69,38 +74,144 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte |
69 | else | 74 | else |
70 | return mCoupons.size(); | 75 | return mCoupons.size(); |
71 | } | 76 | } |
72 | - | ||
73 | - | ||
74 | public Coupon getItem(int id) { | 77 | public Coupon getItem(int id) { |
75 | return mCoupons.get(id); | 78 | return mCoupons.get(id); |
76 | } | 79 | } |
77 | - | ||
78 | public void updateData(CouponList couponList) { | 80 | public void updateData(CouponList couponList) { |
79 | mCoupons.clear(); | 81 | mCoupons.clear(); |
80 | mCoupons.addAll(couponList); | 82 | mCoupons.addAll(couponList); |
81 | notifyDataSetChanged(); | 83 | notifyDataSetChanged(); |
82 | } | 84 | } |
83 | - | ||
84 | - | ||
85 | @Override | 85 | @Override |
86 | public ActiveCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 86 | public ActiveCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
87 | View itemView; | 87 | View itemView; |
88 | if (mIsPast) | 88 | if (mIsPast) |
89 | itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.past_coupon_layout, parent, false); | 89 | itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.past_coupon_layout, parent, false); |
90 | + else if (mIsCustom) | ||
91 | + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_coupon_layout, parent, false); | ||
90 | else | 92 | else |
91 | itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.active_coupon_layout, parent, false); | 93 | itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.active_coupon_layout, parent, false); |
92 | return new ActiveCouponViewHolder(itemView); | 94 | return new ActiveCouponViewHolder(itemView); |
93 | } | 95 | } |
94 | - | ||
95 | @Override | 96 | @Override |
96 | public void onBindViewHolder(final ActiveCouponViewHolder holder, int position) { | 97 | public void onBindViewHolder(final ActiveCouponViewHolder holder, int position) { |
97 | Coupon couponItem = mCoupons.get(position); | 98 | Coupon couponItem = mCoupons.get(position); |
98 | Merchant merchant = new Merchant(); | 99 | Merchant merchant = new Merchant(); |
99 | - | ||
100 | if (mIsPast) | 100 | if (mIsPast) |
101 | holder.ivCouponBackground.setColorFilter(ContextCompat.getColor(mContext, R.color.grey_light3), android.graphics.PorterDuff.Mode.MULTIPLY); | 101 | holder.ivCouponBackground.setColorFilter(ContextCompat.getColor(mContext, R.color.grey_light3), android.graphics.PorterDuff.Mode.MULTIPLY); |
102 | - | ||
103 | if (couponItem != null) { | 102 | if (couponItem != null) { |
103 | + if (mIsCustom) { | ||
104 | + if (couponItem.getStatus() == 1) { | ||
105 | + holder.ivCouponLogo.setAlpha(1.0f); | ||
106 | + holder.tvCouponTitle.setAlpha(1.0f); | ||
107 | + holder.tvCouponValue.setAlpha(1.0f); | ||
108 | + holder.tvCouponDescription.setAlpha(1.0f); | ||
109 | + holder.clCustomLayout.setBackgroundResource(R.drawable.ic_coupon_background); | ||
110 | + } else { | ||
111 | + holder.ivCouponLogo.setAlpha(0.23f); | ||
112 | + holder.tvCouponTitle.setAlpha(0.15f); | ||
113 | + holder.tvCouponValue.setAlpha(0.15f); | ||
114 | + holder.tvCouponDescription.setAlpha(0.15f); | ||
115 | + holder.clCustomLayout.setBackgroundResource(R.drawable.ic_coupon_background_gray); | ||
116 | + } | ||
117 | + if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) { | ||
118 | + for (Merchant mer : WarplyManagerHelper.getMerchantList()) { | ||
119 | + if (mer.getUuid().equals(couponItem.getMerchantUuid())) { | ||
120 | + merchant = mer; | ||
121 | + break; | ||
122 | + } | ||
123 | + } | ||
124 | + } | ||
125 | + if (merchant == null) { | ||
126 | + if (!TextUtils.isEmpty(couponItem.getImage())) { | ||
127 | + Glide.with(mContext) | ||
128 | +// .setDefaultRequestOptions( | ||
129 | +// RequestOptions | ||
130 | +// .placeholderOf(R.drawable.ic_default_contact_photo) | ||
131 | +// .error(R.drawable.ic_default_contact_photo)) | ||
132 | + .load(couponItem.getImage()) | ||
133 | + .diskCacheStrategy(DiskCacheStrategy.DATA) | ||
134 | + .into(holder.ivCouponLogo); | ||
135 | + } else { | ||
136 | + Glide.with(mContext) | ||
137 | + .load(R.drawable.ic_cosmote_logo_horizontal_grey) | ||
138 | + .into(holder.ivCouponLogo); | ||
139 | + } | ||
140 | + holder.tvCouponTitle.setText(couponItem.getName()); | ||
141 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | ||
142 | + holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getDescription().equals("null") || TextUtils.isEmpty(couponItem.getDescription()) ? "" : couponItem.getDescription(), Html.FROM_HTML_MODE_COMPACT)); | ||
143 | + } else { | ||
144 | + holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getDescription().equals("null") || TextUtils.isEmpty(couponItem.getDescription()) ? "" : couponItem.getDescription())); | ||
145 | + } | ||
146 | + } else { | ||
147 | + if (!TextUtils.isEmpty(merchant.getImgPreview())) { | ||
148 | + Glide.with(mContext) | ||
149 | +// .setDefaultRequestOptions( | ||
150 | +// RequestOptions | ||
151 | +// .placeholderOf(R.drawable.ic_default_contact_photo) | ||
152 | +// .error(R.drawable.ic_default_contact_photo)) | ||
153 | + .load(merchant.getImgPreview()) | ||
154 | + .diskCacheStrategy(DiskCacheStrategy.DATA) | ||
155 | + .into(holder.ivCouponLogo); | ||
156 | + } else { | ||
157 | + Glide.with(mContext) | ||
158 | + .load(R.drawable.ic_cosmote_logo_horizontal_grey) | ||
159 | + .into(holder.ivCouponLogo); | ||
160 | + } | ||
161 | + holder.tvCouponTitle.setText(merchant.getAdminName()); | ||
162 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | ||
163 | + holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText().equals("null") || TextUtils.isEmpty(couponItem.getInnerText()) ? "" : couponItem.getInnerText(), Html.FROM_HTML_MODE_COMPACT)); | ||
164 | + } else { | ||
165 | + holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText().equals("null") || TextUtils.isEmpty(couponItem.getInnerText()) ? "" : couponItem.getInnerText())); | ||
166 | + } | ||
167 | + } | ||
168 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
169 | + Date newDate = new Date(); | ||
170 | + try { | ||
171 | + newDate = simpleDateFormat.parse(couponItem.getExpiration()); | ||
172 | + } catch (ParseException e) { | ||
173 | + e.printStackTrace(); | ||
174 | + } | ||
175 | + simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); | ||
176 | + if (mIsPast) | ||
177 | + holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_expired_date), simpleDateFormat.format(newDate != null ? newDate : ""))); | ||
178 | + else { | ||
179 | + long days = getDaysBetweenDates(simpleDateFormat.format(new Date()), simpleDateFormat.format(newDate != null ? newDate : "")); | ||
180 | + holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); | ||
181 | + if (couponItem.getStatus() == 1) { | ||
182 | + if (days < 15) { | ||
183 | + holder.tvCouponDate.setText(""); | ||
184 | + holder.tvCouponDate.setVisibility(View.VISIBLE); | ||
185 | + holder.tvCouponDateExpired.setVisibility(View.GONE); | ||
186 | + holder.tvDateLimit.setText(String.format(mContext.getString(R.string.cos_coupon_date_limit2), simpleDateFormat.format(newDate != null ? newDate : ""))); | ||
187 | + holder.lLDateLimit.setVisibility(View.VISIBLE); | ||
188 | + } else { | ||
189 | + holder.tvCouponDate.setVisibility(View.VISIBLE); | ||
190 | + holder.tvCouponDateExpired.setVisibility(View.GONE); | ||
191 | + holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); | ||
192 | + } | ||
193 | + } else { | ||
194 | + holder.tvCouponDate.setVisibility(View.GONE); | ||
195 | + holder.tvCouponDateExpired.setVisibility(View.VISIBLE); | ||
196 | + holder.tvCouponDateExpired.setText(mContext.getString(R.string.cos_market_coupon_expired)); | ||
197 | + } | ||
198 | + } | ||
199 | + if (TextUtils.isEmpty(couponItem.getDiscount_type())) { | ||
200 | + holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro)); | ||
201 | + } else { | ||
202 | + if (couponItem.getDiscount_type().equals("value")) { | ||
203 | + holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro)); | ||
204 | + } else if (couponItem.getDiscount_type().equals("percentage")) { | ||
205 | + holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.percentage)); | ||
206 | + } else if (couponItem.getDiscount_type().equals("plus_one")) { | ||
207 | + holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.plus_one)); | ||
208 | + } else { | ||
209 | + holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro)); | ||
210 | + } | ||
211 | + } | ||
212 | + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem)); | ||
213 | + return; | ||
214 | + } | ||
104 | if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) { | 215 | if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) { |
105 | for (Merchant mer : WarplyManagerHelper.getMerchantList()) { | 216 | for (Merchant mer : WarplyManagerHelper.getMerchantList()) { |
106 | if (mer.getUuid().equals(couponItem.getMerchantUuid())) { | 217 | if (mer.getUuid().equals(couponItem.getMerchantUuid())) { |
... | @@ -109,7 +220,6 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte | ... | @@ -109,7 +220,6 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte |
109 | } | 220 | } |
110 | } | 221 | } |
111 | } | 222 | } |
112 | - | ||
113 | if (merchant == null) { | 223 | if (merchant == null) { |
114 | if (!TextUtils.isEmpty(couponItem.getImage())) { | 224 | if (!TextUtils.isEmpty(couponItem.getImage())) { |
115 | Glide.with(mContext) | 225 | Glide.with(mContext) |
... | @@ -125,10 +235,13 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte | ... | @@ -125,10 +235,13 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte |
125 | .load(R.drawable.ic_cosmote_logo_horizontal_grey) | 235 | .load(R.drawable.ic_cosmote_logo_horizontal_grey) |
126 | .into(holder.ivCouponLogo); | 236 | .into(holder.ivCouponLogo); |
127 | } | 237 | } |
128 | - | ||
129 | holder.tvCouponTitle.setText(couponItem.getName()); | 238 | holder.tvCouponTitle.setText(couponItem.getName()); |
130 | if (!mIsPast) { | 239 | if (!mIsPast) { |
131 | - holder.tvCouponDescription.setText(HtmlCompat.fromHtml(couponItem.getInnerText(), HtmlCompat.FROM_HTML_MODE_COMPACT)); | 240 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
241 | + holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText(), Html.FROM_HTML_MODE_COMPACT)); | ||
242 | + } else { | ||
243 | + holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText())); | ||
244 | + } | ||
132 | } | 245 | } |
133 | } else { | 246 | } else { |
134 | if (!TextUtils.isEmpty(merchant.getImgPreview())) { | 247 | if (!TextUtils.isEmpty(merchant.getImgPreview())) { |
... | @@ -145,13 +258,15 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte | ... | @@ -145,13 +258,15 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte |
145 | .load(R.drawable.ic_cosmote_logo_horizontal_grey) | 258 | .load(R.drawable.ic_cosmote_logo_horizontal_grey) |
146 | .into(holder.ivCouponLogo); | 259 | .into(holder.ivCouponLogo); |
147 | } | 260 | } |
148 | - | ||
149 | holder.tvCouponTitle.setText(merchant.getAdminName()); | 261 | holder.tvCouponTitle.setText(merchant.getAdminName()); |
150 | if (!mIsPast) { | 262 | if (!mIsPast) { |
151 | - holder.tvCouponDescription.setText(HtmlCompat.fromHtml(couponItem.getInnerText(), HtmlCompat.FROM_HTML_MODE_COMPACT)); | 263 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
264 | + holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText(), Html.FROM_HTML_MODE_COMPACT)); | ||
265 | + } else { | ||
266 | + holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText())); | ||
267 | + } | ||
152 | } | 268 | } |
153 | } | 269 | } |
154 | - | ||
155 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | 270 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); |
156 | Date newDate = new Date(); | 271 | Date newDate = new Date(); |
157 | try { | 272 | try { |
... | @@ -164,7 +279,6 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte | ... | @@ -164,7 +279,6 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte |
164 | holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_expired_date), simpleDateFormat.format(newDate != null ? newDate : ""))); | 279 | holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_expired_date), simpleDateFormat.format(newDate != null ? newDate : ""))); |
165 | else | 280 | else |
166 | holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); | 281 | holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); |
167 | - | ||
168 | if (TextUtils.isEmpty(couponItem.getDiscount_type())) { | 282 | if (TextUtils.isEmpty(couponItem.getDiscount_type())) { |
169 | holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro)); | 283 | holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro)); |
170 | } else { | 284 | } else { |
... | @@ -181,11 +295,26 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte | ... | @@ -181,11 +295,26 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte |
181 | holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem)); | 295 | holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem)); |
182 | } | 296 | } |
183 | } | 297 | } |
184 | - | 298 | + private long getDaysBetweenDates(String start, String end) { |
299 | + SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); | ||
300 | + Date startDate, endDate; | ||
301 | + long numberOfDays = 0; | ||
302 | + try { | ||
303 | + startDate = dateFormat.parse(start); | ||
304 | + endDate = dateFormat.parse(end); | ||
305 | + numberOfDays = getUnitBetweenDates(startDate, endDate, TimeUnit.DAYS); | ||
306 | + } catch (ParseException e) { | ||
307 | + e.printStackTrace(); | ||
308 | + } | ||
309 | + return numberOfDays; | ||
310 | + } | ||
311 | + private long getUnitBetweenDates(Date startDate, Date endDate, TimeUnit unit) { | ||
312 | + long timeDiff = endDate.getTime() - startDate.getTime(); | ||
313 | + return unit.convert(timeDiff, TimeUnit.MILLISECONDS); | ||
314 | + } | ||
185 | public Observable<Coupon> getPositionClicks() { | 315 | public Observable<Coupon> getPositionClicks() { |
186 | return onClickSubject.cache(); | 316 | return onClickSubject.cache(); |
187 | } | 317 | } |
188 | - | ||
189 | private long getDifferenceDays(Date d1, Date d2) { | 318 | private long getDifferenceDays(Date d1, Date d2) { |
190 | long diff = d2.getTime() - d1.getTime(); | 319 | long diff = d2.getTime() - d1.getTime(); |
191 | return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS); | 320 | return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS); | ... | ... |
1 | +package ly.warp.sdk.views.adapters; | ||
2 | + | ||
3 | +import android.content.Context; | ||
4 | +import android.view.LayoutInflater; | ||
5 | +import android.view.View; | ||
6 | +import android.view.ViewGroup; | ||
7 | +import android.widget.ImageView; | ||
8 | +import android.widget.TextView; | ||
9 | + | ||
10 | +import androidx.recyclerview.widget.RecyclerView; | ||
11 | + | ||
12 | +import java.text.ParseException; | ||
13 | +import java.text.SimpleDateFormat; | ||
14 | +import java.util.ArrayList; | ||
15 | +import java.util.Collections; | ||
16 | +import java.util.Date; | ||
17 | +import java.util.concurrent.TimeUnit; | ||
18 | + | ||
19 | +import io.reactivex.Observable; | ||
20 | +import io.reactivex.subjects.PublishSubject; | ||
21 | +import ly.warp.sdk.R; | ||
22 | +import ly.warp.sdk.io.models.Coupon; | ||
23 | +import ly.warp.sdk.io.models.UnifiedCoupon; | ||
24 | + | ||
25 | +public class MarketCouponAdapter extends RecyclerView.Adapter<MarketCouponAdapter.ActiveCouponViewHolder> { | ||
26 | + | ||
27 | + private Context mContext; | ||
28 | + private ArrayList<UnifiedCoupon> mCoupons; | ||
29 | + private final PublishSubject<UnifiedCoupon> onClickSubject = PublishSubject.create(); | ||
30 | + private boolean mIsPast = false; | ||
31 | + | ||
32 | + public MarketCouponAdapter(Context mContext, ArrayList<UnifiedCoupon> campaignList) { | ||
33 | + this.mContext = mContext; | ||
34 | + this.mCoupons = campaignList; | ||
35 | + this.mIsPast = false; | ||
36 | + } | ||
37 | + | ||
38 | + public MarketCouponAdapter(Context mContext, ArrayList<UnifiedCoupon> campaignList, boolean past) { | ||
39 | + this.mContext = mContext; | ||
40 | + this.mCoupons = campaignList; | ||
41 | + this.mIsPast = past; | ||
42 | + } | ||
43 | + | ||
44 | + public class ActiveCouponViewHolder extends RecyclerView.ViewHolder { | ||
45 | + private ImageView ivCouponBackground; | ||
46 | + private TextView tvCouponTitle, tvCouponDate, tvCouponCount; | ||
47 | + | ||
48 | + public ActiveCouponViewHolder(View view) { | ||
49 | + super(view); | ||
50 | + ivCouponBackground = view.findViewById(R.id.iv_past_coupon_background); | ||
51 | + tvCouponTitle = view.findViewById(R.id.tv_market_coupons_title); | ||
52 | + tvCouponDate = view.findViewById(R.id.tv_market_coupons_date); | ||
53 | + tvCouponCount = view.findViewById(R.id.tv_market_coupons_count); | ||
54 | + } | ||
55 | + } | ||
56 | + | ||
57 | + @Override | ||
58 | + public int getItemCount() { | ||
59 | + if (mCoupons == null) | ||
60 | + return 0; | ||
61 | + else | ||
62 | + return mCoupons.size(); | ||
63 | + } | ||
64 | + | ||
65 | + | ||
66 | + public UnifiedCoupon getItem(int id) { | ||
67 | + return mCoupons.get(id); | ||
68 | + } | ||
69 | + | ||
70 | + public void updateData(ArrayList<UnifiedCoupon> couponList) { | ||
71 | + mCoupons.clear(); | ||
72 | + mCoupons.addAll(couponList); | ||
73 | + notifyDataSetChanged(); | ||
74 | + } | ||
75 | + | ||
76 | + | ||
77 | + @Override | ||
78 | + public ActiveCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
79 | + View itemView; | ||
80 | + if (mIsPast) | ||
81 | + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.past_coupon_layout, parent, false); | ||
82 | + else | ||
83 | + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.market_coupon_layout, parent, false); | ||
84 | + return new ActiveCouponViewHolder(itemView); | ||
85 | + } | ||
86 | + | ||
87 | + @Override | ||
88 | + public void onBindViewHolder(final ActiveCouponViewHolder holder, int position) { | ||
89 | + UnifiedCoupon couponItem = mCoupons.get(position); | ||
90 | + | ||
91 | + if (couponItem != null) { | ||
92 | + int count = 0; | ||
93 | + if (couponItem.getCoupons() != null && couponItem.getCoupons().size() > 0) { | ||
94 | + ArrayList<Coupon> couponList = new ArrayList<Coupon>(); | ||
95 | + for (Coupon item : couponItem.getCoupons()) { | ||
96 | + if (item.getStatus() == 1) { | ||
97 | + count++; | ||
98 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
99 | + Date newDate = new Date(); | ||
100 | + try { | ||
101 | + newDate = simpleDateFormat.parse(item.getExpiration()); | ||
102 | + } catch (ParseException e) { | ||
103 | + e.printStackTrace(); | ||
104 | + } | ||
105 | + item.setExpirationDate(newDate); | ||
106 | + couponList.add(item); | ||
107 | + } | ||
108 | + } | ||
109 | + | ||
110 | + Collections.sort(couponList, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate())); | ||
111 | + | ||
112 | + if (couponList != null && couponList.size() > 0) { | ||
113 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
114 | + Date newDate = new Date(); | ||
115 | + try { | ||
116 | + newDate = simpleDateFormat.parse(couponList.get(0).getExpiration()); | ||
117 | + } catch (ParseException e) { | ||
118 | + e.printStackTrace(); | ||
119 | + } | ||
120 | + simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); | ||
121 | + holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); | ||
122 | + } | ||
123 | + } | ||
124 | + | ||
125 | + if (count > 1) { | ||
126 | + holder.tvCouponCount.setText(String.format(mContext.getString(R.string.cos_market_active_coupons), String.valueOf(count))); | ||
127 | + } else if (count == 1) { | ||
128 | + holder.tvCouponCount.setText(String.format(mContext.getString(R.string.cos_market_active_coupons_single), String.valueOf(count))); | ||
129 | + } | ||
130 | + | ||
131 | + | ||
132 | +// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
133 | +// Date newDate = new Date(); | ||
134 | +// try { | ||
135 | +// newDate = simpleDateFormat.parse(couponItem.getExpiration()); | ||
136 | +// } catch (ParseException e) { | ||
137 | +// e.printStackTrace(); | ||
138 | +// } | ||
139 | +// simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); | ||
140 | +// if (mIsPast) | ||
141 | +// holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_expired_date), simpleDateFormat.format(newDate != null ? newDate : ""))); | ||
142 | +// else | ||
143 | +// holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); | ||
144 | + | ||
145 | +// if (TextUtils.isEmpty(couponItem.getDiscount_type())) { | ||
146 | +// holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro)); | ||
147 | +// } else { | ||
148 | +// if (couponItem.getDiscount_type().equals("value")) { | ||
149 | +// holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro)); | ||
150 | +// } else if (couponItem.getDiscount_type().equals("percentage")) { | ||
151 | +// holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.percentage)); | ||
152 | +// } else if (couponItem.getDiscount_type().equals("plus_one")) { | ||
153 | +// holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.plus_one)); | ||
154 | +// } else { | ||
155 | +// holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro)); | ||
156 | +// } | ||
157 | +// } | ||
158 | + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem)); | ||
159 | + } | ||
160 | + } | ||
161 | + | ||
162 | + public Observable<UnifiedCoupon> getPositionClicks() { | ||
163 | + return onClickSubject.cache(); | ||
164 | + } | ||
165 | + | ||
166 | + private long getDifferenceDays(Date d1, Date d2) { | ||
167 | + long diff = d2.getTime() - d1.getTime(); | ||
168 | + return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS); | ||
169 | + } | ||
170 | +} |
12 KB
3.09 KB
3.51 KB
6.61 KB
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
3 | + <solid android:color="#F0E6E6"/> | ||
4 | + <corners android:radius="10dp"/> | ||
5 | + <padding android:left="4dp" android:top="2dp" android:right="4dp" android:bottom="2dp" /> | ||
6 | +</shape> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -35,14 +35,14 @@ | ... | @@ -35,14 +35,14 @@ |
35 | app:layout_constraintTop_toTopOf="parent" /> | 35 | app:layout_constraintTop_toTopOf="parent" /> |
36 | </androidx.constraintlayout.widget.ConstraintLayout> | 36 | </androidx.constraintlayout.widget.ConstraintLayout> |
37 | 37 | ||
38 | - <ScrollView | 38 | + <androidx.core.widget.NestedScrollView |
39 | android:id="@+id/sv_loyalty_wallet" | 39 | android:id="@+id/sv_loyalty_wallet" |
40 | android:layout_width="match_parent" | 40 | android:layout_width="match_parent" |
41 | android:layout_height="match_parent" | 41 | android:layout_height="match_parent" |
42 | android:layout_below="@+id/cl_loyalty_wallet_header" | 42 | android:layout_below="@+id/cl_loyalty_wallet_header" |
43 | android:fillViewport="true" | 43 | android:fillViewport="true" |
44 | - android:scrollbars="none" | 44 | + android:overScrollMode="never" |
45 | - android:overScrollMode="never"> | 45 | + android:scrollbars="none"> |
46 | 46 | ||
47 | <LinearLayout | 47 | <LinearLayout |
48 | android:layout_width="match_parent" | 48 | android:layout_width="match_parent" |
... | @@ -94,10 +94,10 @@ | ... | @@ -94,10 +94,10 @@ |
94 | fontPath="fonts/PeridotPE-Bold.ttf" | 94 | fontPath="fonts/PeridotPE-Bold.ttf" |
95 | android:layout_width="wrap_content" | 95 | android:layout_width="wrap_content" |
96 | android:layout_height="wrap_content" | 96 | android:layout_height="wrap_content" |
97 | + android:layout_marginHorizontal="20dp" | ||
97 | android:includeFontPadding="false" | 98 | android:includeFontPadding="false" |
98 | android:textColor="@color/cos_green12" | 99 | android:textColor="@color/cos_green12" |
99 | android:textSize="16sp" | 100 | android:textSize="16sp" |
100 | - android:layout_marginHorizontal="20dp" | ||
101 | tools:text="@string/cos_profile_preferences_placeholder" /> | 101 | tools:text="@string/cos_profile_preferences_placeholder" /> |
102 | </LinearLayout> | 102 | </LinearLayout> |
103 | 103 | ||
... | @@ -134,70 +134,125 @@ | ... | @@ -134,70 +134,125 @@ |
134 | android:orientation="vertical"> | 134 | android:orientation="vertical"> |
135 | 135 | ||
136 | <androidx.constraintlayout.widget.ConstraintLayout | 136 | <androidx.constraintlayout.widget.ConstraintLayout |
137 | - android:id="@+id/cl_deals_cos" | 137 | + android:id="@+id/cl_exp" |
138 | android:layout_width="match_parent" | 138 | android:layout_width="match_parent" |
139 | android:layout_height="wrap_content" | 139 | android:layout_height="wrap_content" |
140 | - android:layout_marginHorizontal="8dp" | 140 | + android:layout_marginHorizontal="4dp" |
141 | - android:layout_marginTop="24dp"> | 141 | + android:layout_marginTop="24dp" |
142 | - | 142 | + android:background="@drawable/shape_cos_white_border" |
143 | - <androidx.constraintlayout.widget.Guideline | 143 | + android:paddingHorizontal="14dp" |
144 | - android:id="@+id/gl_vertical_06_cos" | 144 | + android:paddingVertical="14dp"> |
145 | - android:layout_width="wrap_content" | ||
146 | - android:layout_height="match_parent" | ||
147 | - android:orientation="vertical" | ||
148 | - app:layout_constraintGuide_begin="24dp" /> | ||
149 | 145 | ||
150 | <androidx.constraintlayout.widget.Guideline | 146 | <androidx.constraintlayout.widget.Guideline |
151 | - android:id="@+id/gl_horizontal_50_cos" | 147 | + android:id="@+id/gl_horizontal_64_exp" |
152 | android:layout_width="wrap_content" | 148 | android:layout_width="wrap_content" |
153 | android:layout_height="match_parent" | 149 | android:layout_height="match_parent" |
154 | android:orientation="horizontal" | 150 | android:orientation="horizontal" |
155 | app:layout_constraintGuide_percent="0.64" /> | 151 | app:layout_constraintGuide_percent="0.64" /> |
156 | 152 | ||
157 | - <androidx.constraintlayout.widget.ConstraintLayout | 153 | + <ImageView |
158 | - android:id="@+id/cl_deals_win_inner_cos" | 154 | + android:id="@+id/iv_exp_logo" |
159 | - android:layout_width="0dp" | 155 | + android:layout_width="76dp" |
160 | - android:layout_height="0dp" | 156 | + android:layout_height="76dp" |
161 | - android:background="@drawable/shape_cos_white_border" | 157 | + android:layout_marginVertical="4dp" |
158 | + android:src="@drawable/ic_foryou_polygon_new" | ||
162 | app:layout_constraintBottom_toBottomOf="parent" | 159 | app:layout_constraintBottom_toBottomOf="parent" |
163 | - app:layout_constraintEnd_toEndOf="parent" | 160 | + app:layout_constraintStart_toStartOf="parent" |
164 | - app:layout_constraintStart_toEndOf="@+id/gl_vertical_06_cos" | 161 | + app:layout_constraintTop_toTopOf="parent" /> |
165 | - app:layout_constraintTop_toTopOf="parent"> | ||
166 | 162 | ||
167 | - <androidx.constraintlayout.widget.Guideline | 163 | + <TextView |
168 | - android:id="@+id/gl_vertical_16_cos" | 164 | + android:id="@+id/tv_exp_value" |
165 | + fontPath="fonts/PeridotPE-Bold.ttf" | ||
169 | android:layout_width="wrap_content" | 166 | android:layout_width="wrap_content" |
170 | - android:layout_height="match_parent" | 167 | + android:layout_height="wrap_content" |
171 | - android:orientation="vertical" | 168 | + android:includeFontPadding="false" |
172 | - app:layout_constraintGuide_percent="0.17" /> | 169 | + android:textColor="@color/cos_light_black" |
170 | + android:textSize="14sp" | ||
171 | + app:layout_constraintEnd_toEndOf="@+id/iv_exp_logo" | ||
172 | + app:layout_constraintStart_toStartOf="@+id/iv_exp_logo" | ||
173 | + app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_64_exp" | ||
174 | + tools:text="18.00€" /> | ||
173 | 175 | ||
174 | <TextView | 176 | <TextView |
175 | - android:id="@+id/tv_deals_value_all" | 177 | + android:id="@+id/tv_exp_value_all" |
176 | fontPath="fonts/PeridotPE-Regular.ttf" | 178 | fontPath="fonts/PeridotPE-Regular.ttf" |
177 | android:layout_width="0dp" | 179 | android:layout_width="0dp" |
178 | android:layout_height="wrap_content" | 180 | android:layout_height="wrap_content" |
179 | - android:layout_marginEnd="16dp" | 181 | + android:layout_marginHorizontal="8dp" |
180 | android:includeFontPadding="false" | 182 | android:includeFontPadding="false" |
181 | - android:text="@string/cos_deals_win_title_cos" | 183 | + android:text="@string/cos_for_you_all" |
182 | android:textColor="@color/cos_light_black" | 184 | android:textColor="@color/cos_light_black" |
183 | android:textSize="15sp" | 185 | android:textSize="15sp" |
184 | app:layout_constraintBottom_toBottomOf="parent" | 186 | app:layout_constraintBottom_toBottomOf="parent" |
185 | - app:layout_constraintEnd_toEndOf="parent" | 187 | + app:layout_constraintEnd_toStartOf="@+id/iv_exp_arrow" |
186 | - app:layout_constraintStart_toStartOf="@+id/gl_vertical_16_cos" | 188 | + app:layout_constraintStart_toEndOf="@+id/iv_exp_logo" |
187 | app:layout_constraintTop_toTopOf="parent" /> | 189 | app:layout_constraintTop_toTopOf="parent" /> |
190 | + | ||
191 | + <ImageView | ||
192 | + android:id="@+id/iv_exp_arrow" | ||
193 | + android:layout_width="14dp" | ||
194 | + android:layout_height="14dp" | ||
195 | + android:src="@drawable/ic_down_dark_new" | ||
196 | + app:layout_constraintBottom_toBottomOf="parent" | ||
197 | + app:layout_constraintEnd_toEndOf="parent" | ||
198 | + app:layout_constraintTop_toTopOf="parent" | ||
199 | + android:visibility="gone"/> | ||
188 | </androidx.constraintlayout.widget.ConstraintLayout> | 200 | </androidx.constraintlayout.widget.ConstraintLayout> |
189 | 201 | ||
202 | + <net.cachapa.expandablelayout.ExpandableLayout | ||
203 | + android:id="@+id/el_exp" | ||
204 | + android:layout_width="match_parent" | ||
205 | + android:layout_height="wrap_content" | ||
206 | + app:el_duration="300" | ||
207 | + app:el_expanded="false" | ||
208 | + app:el_parallax="0.5"> | ||
209 | + | ||
210 | + <RelativeLayout | ||
211 | + android:layout_width="match_parent" | ||
212 | + android:layout_height="wrap_content"> | ||
213 | + | ||
214 | + <androidx.constraintlayout.widget.ConstraintLayout | ||
215 | + android:id="@+id/cl_deals_win_inner_cos" | ||
216 | + android:layout_width="match_parent" | ||
217 | + android:layout_height="wrap_content" | ||
218 | + android:layout_marginHorizontal="16dp" | ||
219 | + android:layout_marginTop="6dp" | ||
220 | + android:background="@drawable/shape_cos_white_border" | ||
221 | + android:paddingHorizontal="6dp" | ||
222 | + android:paddingVertical="4dp"> | ||
223 | + | ||
224 | + <androidx.constraintlayout.widget.Guideline | ||
225 | + android:id="@+id/gl_horizontal_50_cos" | ||
226 | + android:layout_width="wrap_content" | ||
227 | + android:layout_height="match_parent" | ||
228 | + android:orientation="horizontal" | ||
229 | + app:layout_constraintGuide_percent="0.64" /> | ||
230 | + | ||
190 | <ImageView | 231 | <ImageView |
191 | android:id="@+id/iv_deals_logo" | 232 | android:id="@+id/iv_deals_logo" |
192 | android:layout_width="76dp" | 233 | android:layout_width="76dp" |
193 | android:layout_height="76dp" | 234 | android:layout_height="76dp" |
194 | - android:layout_marginVertical="4dp" | ||
195 | android:src="@drawable/ic_deals_polygon_new" | 235 | android:src="@drawable/ic_deals_polygon_new" |
196 | app:layout_constraintBottom_toBottomOf="parent" | 236 | app:layout_constraintBottom_toBottomOf="parent" |
197 | app:layout_constraintStart_toStartOf="parent" | 237 | app:layout_constraintStart_toStartOf="parent" |
198 | app:layout_constraintTop_toTopOf="parent" /> | 238 | app:layout_constraintTop_toTopOf="parent" /> |
199 | 239 | ||
200 | <TextView | 240 | <TextView |
241 | + android:id="@+id/tv_deals_value_all" | ||
242 | + fontPath="fonts/PeridotPE-Regular.ttf" | ||
243 | + android:layout_width="0dp" | ||
244 | + android:layout_height="wrap_content" | ||
245 | + android:layout_marginHorizontal="8dp" | ||
246 | + android:includeFontPadding="false" | ||
247 | + android:text="@string/cos_deals_win_title_cos" | ||
248 | + android:textColor="@color/cos_light_black" | ||
249 | + android:textSize="15sp" | ||
250 | + app:layout_constraintBottom_toBottomOf="parent" | ||
251 | + app:layout_constraintEnd_toEndOf="parent" | ||
252 | + app:layout_constraintStart_toEndOf="@+id/iv_deals_logo" | ||
253 | + app:layout_constraintTop_toTopOf="parent" /> | ||
254 | + | ||
255 | + <TextView | ||
201 | android:id="@+id/tv_deals_value" | 256 | android:id="@+id/tv_deals_value" |
202 | fontPath="fonts/PeridotPE-Bold.ttf" | 257 | fontPath="fonts/PeridotPE-Bold.ttf" |
203 | android:layout_width="wrap_content" | 258 | android:layout_width="wrap_content" |
... | @@ -209,22 +264,18 @@ | ... | @@ -209,22 +264,18 @@ |
209 | app:layout_constraintStart_toStartOf="@+id/iv_deals_logo" | 264 | app:layout_constraintStart_toStartOf="@+id/iv_deals_logo" |
210 | app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_50_cos" | 265 | app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_50_cos" |
211 | tools:text="18.00€" /> | 266 | tools:text="18.00€" /> |
212 | - | ||
213 | </androidx.constraintlayout.widget.ConstraintLayout> | 267 | </androidx.constraintlayout.widget.ConstraintLayout> |
214 | 268 | ||
215 | <androidx.constraintlayout.widget.ConstraintLayout | 269 | <androidx.constraintlayout.widget.ConstraintLayout |
216 | - android:id="@+id/cl_deals_win" | 270 | + android:id="@+id/cl_deals_win_inner" |
217 | android:layout_width="match_parent" | 271 | android:layout_width="match_parent" |
218 | android:layout_height="wrap_content" | 272 | android:layout_height="wrap_content" |
219 | - android:layout_marginHorizontal="8dp" | 273 | + android:layout_below="@+id/cl_deals_win_inner_cos" |
220 | - android:layout_marginTop="12dp"> | 274 | + android:layout_marginHorizontal="16dp" |
221 | - | 275 | + android:layout_marginTop="6dp" |
222 | - <androidx.constraintlayout.widget.Guideline | 276 | + android:background="@drawable/shape_cos_white_border" |
223 | - android:id="@+id/gl_vertical_06" | 277 | + android:paddingHorizontal="6dp" |
224 | - android:layout_width="wrap_content" | 278 | + android:paddingVertical="4dp"> |
225 | - android:layout_height="match_parent" | ||
226 | - android:orientation="vertical" | ||
227 | - app:layout_constraintGuide_begin="24dp" /> | ||
228 | 279 | ||
229 | <androidx.constraintlayout.widget.Guideline | 280 | <androidx.constraintlayout.widget.Guideline |
230 | android:id="@+id/gl_horizontal_50" | 281 | android:id="@+id/gl_horizontal_50" |
... | @@ -233,63 +284,131 @@ | ... | @@ -233,63 +284,131 @@ |
233 | android:orientation="horizontal" | 284 | android:orientation="horizontal" |
234 | app:layout_constraintGuide_percent="0.64" /> | 285 | app:layout_constraintGuide_percent="0.64" /> |
235 | 286 | ||
236 | - <androidx.constraintlayout.widget.ConstraintLayout | 287 | + <ImageView |
237 | - android:id="@+id/cl_deals_win_inner" | 288 | + android:id="@+id/iv_gifts_logo" |
238 | - android:layout_width="0dp" | 289 | + android:layout_width="76dp" |
239 | - android:layout_height="0dp" | 290 | + android:layout_height="76dp" |
240 | - android:background="@drawable/shape_cos_white_border" | 291 | + android:src="@drawable/ic_gifts_polygon_new" |
241 | app:layout_constraintBottom_toBottomOf="parent" | 292 | app:layout_constraintBottom_toBottomOf="parent" |
242 | - app:layout_constraintEnd_toEndOf="parent" | 293 | + app:layout_constraintStart_toStartOf="parent" |
243 | - app:layout_constraintStart_toEndOf="@+id/gl_vertical_06" | 294 | + app:layout_constraintTop_toTopOf="parent" /> |
244 | - app:layout_constraintTop_toTopOf="parent"> | ||
245 | - | ||
246 | - <androidx.constraintlayout.widget.Guideline | ||
247 | - android:id="@+id/gl_vertical_16" | ||
248 | - android:layout_width="wrap_content" | ||
249 | - android:layout_height="match_parent" | ||
250 | - android:orientation="vertical" | ||
251 | - app:layout_constraintGuide_percent="0.17" /> | ||
252 | 295 | ||
253 | <TextView | 296 | <TextView |
254 | android:id="@+id/tv_gifts_value_all" | 297 | android:id="@+id/tv_gifts_value_all" |
255 | fontPath="fonts/PeridotPE-Regular.ttf" | 298 | fontPath="fonts/PeridotPE-Regular.ttf" |
256 | android:layout_width="0dp" | 299 | android:layout_width="0dp" |
257 | android:layout_height="wrap_content" | 300 | android:layout_height="wrap_content" |
258 | - android:layout_marginEnd="16dp" | 301 | + android:layout_marginHorizontal="8dp" |
259 | android:includeFontPadding="false" | 302 | android:includeFontPadding="false" |
260 | android:text="@string/cos_deals_win_title" | 303 | android:text="@string/cos_deals_win_title" |
261 | android:textColor="@color/cos_light_black" | 304 | android:textColor="@color/cos_light_black" |
262 | android:textSize="15sp" | 305 | android:textSize="15sp" |
263 | app:layout_constraintBottom_toBottomOf="parent" | 306 | app:layout_constraintBottom_toBottomOf="parent" |
264 | app:layout_constraintEnd_toEndOf="parent" | 307 | app:layout_constraintEnd_toEndOf="parent" |
265 | - app:layout_constraintStart_toStartOf="@+id/gl_vertical_16" | 308 | + app:layout_constraintStart_toEndOf="@+id/iv_gifts_logo" |
266 | app:layout_constraintTop_toTopOf="parent" /> | 309 | app:layout_constraintTop_toTopOf="parent" /> |
310 | + | ||
311 | + <TextView | ||
312 | + android:id="@+id/tv_gifts_value" | ||
313 | + fontPath="fonts/PeridotPE-Bold.ttf" | ||
314 | + android:layout_width="wrap_content" | ||
315 | + android:layout_height="wrap_content" | ||
316 | + android:includeFontPadding="false" | ||
317 | + android:textColor="@color/cos_light_black" | ||
318 | + android:textSize="14sp" | ||
319 | + app:layout_constraintEnd_toEndOf="@+id/iv_gifts_logo" | ||
320 | + app:layout_constraintStart_toStartOf="@+id/iv_gifts_logo" | ||
321 | + app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_50" | ||
322 | + tools:text="20.00€" /> | ||
267 | </androidx.constraintlayout.widget.ConstraintLayout> | 323 | </androidx.constraintlayout.widget.ConstraintLayout> |
268 | 324 | ||
325 | + <androidx.constraintlayout.widget.ConstraintLayout | ||
326 | + android:id="@+id/cl_market_inner" | ||
327 | + android:layout_width="match_parent" | ||
328 | + android:layout_height="wrap_content" | ||
329 | + android:layout_below="@+id/cl_deals_win_inner" | ||
330 | + android:layout_marginHorizontal="16dp" | ||
331 | + android:layout_marginTop="6dp" | ||
332 | + android:background="@drawable/shape_cos_white_border" | ||
333 | + android:paddingHorizontal="6dp" | ||
334 | + android:paddingVertical="4dp"> | ||
335 | + | ||
336 | + <androidx.constraintlayout.widget.Guideline | ||
337 | + android:id="@+id/gl_horizontal_50_market" | ||
338 | + android:layout_width="wrap_content" | ||
339 | + android:layout_height="match_parent" | ||
340 | + android:orientation="horizontal" | ||
341 | + app:layout_constraintGuide_percent="0.64" /> | ||
342 | + | ||
269 | <ImageView | 343 | <ImageView |
270 | - android:id="@+id/iv_gifts_logo" | 344 | + android:id="@+id/iv_market_logo" |
271 | android:layout_width="76dp" | 345 | android:layout_width="76dp" |
272 | android:layout_height="76dp" | 346 | android:layout_height="76dp" |
273 | - android:layout_marginVertical="4dp" | 347 | + android:src="@drawable/ic_market_polygon" |
274 | - android:src="@drawable/ic_gifts_polygon_new" | ||
275 | app:layout_constraintBottom_toBottomOf="parent" | 348 | app:layout_constraintBottom_toBottomOf="parent" |
276 | app:layout_constraintStart_toStartOf="parent" | 349 | app:layout_constraintStart_toStartOf="parent" |
277 | app:layout_constraintTop_toTopOf="parent" /> | 350 | app:layout_constraintTop_toTopOf="parent" /> |
278 | 351 | ||
279 | <TextView | 352 | <TextView |
280 | - android:id="@+id/tv_gifts_value" | 353 | + android:id="@+id/tv_market_value_all" |
354 | + fontPath="fonts/PeridotPE-Regular.ttf" | ||
355 | + android:layout_width="0dp" | ||
356 | + android:layout_height="wrap_content" | ||
357 | + android:layout_marginHorizontal="8dp" | ||
358 | + android:includeFontPadding="false" | ||
359 | + android:text="@string/cos_supermarket_win" | ||
360 | + android:textColor="@color/cos_light_black" | ||
361 | + android:textSize="15sp" | ||
362 | + app:layout_constraintBottom_toBottomOf="parent" | ||
363 | + app:layout_constraintEnd_toEndOf="parent" | ||
364 | + app:layout_constraintStart_toEndOf="@+id/iv_market_logo" | ||
365 | + app:layout_constraintTop_toTopOf="parent" /> | ||
366 | + | ||
367 | + <TextView | ||
368 | + android:id="@+id/tv_market_value" | ||
281 | fontPath="fonts/PeridotPE-Bold.ttf" | 369 | fontPath="fonts/PeridotPE-Bold.ttf" |
282 | android:layout_width="wrap_content" | 370 | android:layout_width="wrap_content" |
283 | android:layout_height="wrap_content" | 371 | android:layout_height="wrap_content" |
284 | android:includeFontPadding="false" | 372 | android:includeFontPadding="false" |
285 | android:textColor="@color/cos_light_black" | 373 | android:textColor="@color/cos_light_black" |
286 | android:textSize="14sp" | 374 | android:textSize="14sp" |
287 | - app:layout_constraintEnd_toEndOf="@+id/iv_gifts_logo" | 375 | + app:layout_constraintEnd_toEndOf="@+id/iv_market_logo" |
288 | - app:layout_constraintStart_toStartOf="@+id/iv_gifts_logo" | 376 | + app:layout_constraintStart_toStartOf="@+id/iv_market_logo" |
289 | - app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_50" | 377 | + app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_50_market" |
290 | tools:text="20.00€" /> | 378 | tools:text="20.00€" /> |
291 | - | ||
292 | </androidx.constraintlayout.widget.ConstraintLayout> | 379 | </androidx.constraintlayout.widget.ConstraintLayout> |
380 | + </RelativeLayout> | ||
381 | + </net.cachapa.expandablelayout.ExpandableLayout> | ||
382 | + | ||
383 | + <LinearLayout | ||
384 | + android:id="@+id/ll_market_view" | ||
385 | + android:layout_width="match_parent" | ||
386 | + android:layout_height="wrap_content" | ||
387 | + android:layout_marginTop="24dp" | ||
388 | + android:orientation="vertical" | ||
389 | + android:visibility="gone" | ||
390 | + tools:visibility="visible"> | ||
391 | + | ||
392 | + <TextView | ||
393 | + android:id="@+id/tv_market_header" | ||
394 | + fontPath="fonts/BTCosmo-Bold.ttf" | ||
395 | + android:layout_width="wrap_content" | ||
396 | + android:layout_height="wrap_content" | ||
397 | + android:layout_gravity="start" | ||
398 | + android:layout_marginHorizontal="16dp" | ||
399 | + android:layout_marginBottom="10dp" | ||
400 | + android:text="@string/cos_market_title" | ||
401 | + android:textColor="@color/cos_light_black" | ||
402 | + android:textSize="20sp" /> | ||
403 | + | ||
404 | + <androidx.recyclerview.widget.RecyclerView | ||
405 | + android:id="@+id/rv_market_coupons" | ||
406 | + android:layout_width="match_parent" | ||
407 | + android:layout_height="wrap_content" | ||
408 | + android:layout_marginHorizontal="2dp" | ||
409 | + android:overScrollMode="never" | ||
410 | + android:scrollbars="none" /> | ||
411 | + </LinearLayout> | ||
293 | 412 | ||
294 | <LinearLayout | 413 | <LinearLayout |
295 | android:id="@+id/ll_mygifts" | 414 | android:id="@+id/ll_mygifts" |
... | @@ -393,7 +512,9 @@ | ... | @@ -393,7 +512,9 @@ |
393 | android:layout_width="match_parent" | 512 | android:layout_width="match_parent" |
394 | android:layout_height="wrap_content" | 513 | android:layout_height="wrap_content" |
395 | android:layout_marginTop="24dp" | 514 | android:layout_marginTop="24dp" |
396 | - android:orientation="vertical"> | 515 | + android:orientation="vertical" |
516 | + android:visibility="gone" | ||
517 | + tools:visibility="visible"> | ||
397 | 518 | ||
398 | <TextView | 519 | <TextView |
399 | android:id="@+id/tv_active_coupons_header" | 520 | android:id="@+id/tv_active_coupons_header" |
... | @@ -413,7 +534,8 @@ | ... | @@ -413,7 +534,8 @@ |
413 | android:layout_height="wrap_content" | 534 | android:layout_height="wrap_content" |
414 | android:layout_marginHorizontal="2dp" | 535 | android:layout_marginHorizontal="2dp" |
415 | android:overScrollMode="never" | 536 | android:overScrollMode="never" |
416 | - android:paddingBottom="40dp" /> | 537 | + android:paddingBottom="40dp" |
538 | + android:scrollbars="none" /> | ||
417 | 539 | ||
418 | <LinearLayout | 540 | <LinearLayout |
419 | android:id="@+id/ll_empty_wallet" | 541 | android:id="@+id/ll_empty_wallet" |
... | @@ -444,5 +566,5 @@ | ... | @@ -444,5 +566,5 @@ |
444 | </LinearLayout> | 566 | </LinearLayout> |
445 | </RelativeLayout> | 567 | </RelativeLayout> |
446 | </LinearLayout> | 568 | </LinearLayout> |
447 | - </ScrollView> | 569 | + </androidx.core.widget.NestedScrollView> |
448 | </RelativeLayout> | 570 | </RelativeLayout> | ... | ... |
1 | +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
3 | + xmlns:tools="http://schemas.android.com/tools" | ||
4 | + android:layout_width="match_parent" | ||
5 | + android:layout_height="match_parent" | ||
6 | + android:background="@android:color/white"> | ||
7 | + | ||
8 | + <androidx.constraintlayout.widget.ConstraintLayout | ||
9 | + android:id="@+id/cl_loyalty_wallet_header" | ||
10 | + android:layout_width="match_parent" | ||
11 | + android:layout_height="48dp" | ||
12 | + android:background="@android:color/white"> | ||
13 | + | ||
14 | + <ImageView | ||
15 | + android:id="@+id/iv_coupon_info_back" | ||
16 | + android:layout_width="48dp" | ||
17 | + android:layout_height="48dp" | ||
18 | + android:layout_marginStart="16dp" | ||
19 | + android:scaleType="centerInside" | ||
20 | + android:src="@drawable/ic_back" | ||
21 | + app:layout_constraintBottom_toBottomOf="parent" | ||
22 | + app:layout_constraintStart_toStartOf="parent" | ||
23 | + app:layout_constraintTop_toTopOf="parent" /> | ||
24 | + | ||
25 | + <TextView | ||
26 | + fontPath="fonts/pf_square_sans_pro_medium.ttf" | ||
27 | + android:layout_width="wrap_content" | ||
28 | + android:layout_height="wrap_content" | ||
29 | + android:text="@string/cos_coupon_info_title" | ||
30 | + android:textColor="@color/grey" | ||
31 | + android:textSize="17sp" | ||
32 | + app:layout_constraintBottom_toBottomOf="parent" | ||
33 | + app:layout_constraintEnd_toEndOf="parent" | ||
34 | + app:layout_constraintStart_toStartOf="parent" | ||
35 | + app:layout_constraintTop_toTopOf="parent" /> | ||
36 | + </androidx.constraintlayout.widget.ConstraintLayout> | ||
37 | + | ||
38 | + <RelativeLayout | ||
39 | + android:layout_width="match_parent" | ||
40 | + android:layout_height="match_parent" | ||
41 | + android:layout_below="@+id/cl_loyalty_wallet_header"> | ||
42 | + | ||
43 | + <ScrollView | ||
44 | + android:layout_width="match_parent" | ||
45 | + android:layout_height="match_parent" | ||
46 | + android:overScrollMode="never"> | ||
47 | + | ||
48 | + <LinearLayout | ||
49 | + android:id="@+id/cl_loyalty_info_view_inner" | ||
50 | + android:layout_width="match_parent" | ||
51 | + android:layout_height="wrap_content" | ||
52 | + android:background="@android:color/white" | ||
53 | + android:orientation="vertical" | ||
54 | + android:paddingBottom="48dp"> | ||
55 | + | ||
56 | +<!-- <ImageView--> | ||
57 | +<!-- android:id="@+id/imageView6"--> | ||
58 | +<!-- android:layout_width="match_parent"--> | ||
59 | +<!-- android:layout_height="253dp"--> | ||
60 | +<!-- android:layout_marginTop="0.5dp"--> | ||
61 | +<!-- android:scaleType="centerCrop"--> | ||
62 | +<!-- android:src="@drawable/unified_coupon_banner" />--> | ||
63 | + | ||
64 | + <TextView | ||
65 | + android:id="@+id/textView13" | ||
66 | + fontPath="fonts/pf_square_sans_pro_medium.ttf" | ||
67 | + android:layout_width="match_parent" | ||
68 | + android:layout_height="wrap_content" | ||
69 | + android:layout_marginTop="32dp" | ||
70 | + android:gravity="center" | ||
71 | + android:paddingHorizontal="32dp" | ||
72 | + android:text="@string/cos_unified_title" | ||
73 | + android:textColor="#415564" | ||
74 | + android:textSize="18sp" /> | ||
75 | + | ||
76 | + <TextView | ||
77 | + android:id="@+id/textView14" | ||
78 | + fontPath="fonts/pf_square_sans_pro_regular.ttf" | ||
79 | + android:layout_width="match_parent" | ||
80 | + android:layout_height="wrap_content" | ||
81 | + android:layout_marginTop="16dp" | ||
82 | + android:gravity="center" | ||
83 | + android:paddingHorizontal="32dp" | ||
84 | + android:text="@string/cos_unified_subtitle" | ||
85 | + android:textColor="#415564" | ||
86 | + android:textSize="16sp" /> | ||
87 | + | ||
88 | + <TextView | ||
89 | + android:id="@+id/textView15" | ||
90 | + fontPath="fonts/pf_square_sans_pro_medium.ttf" | ||
91 | + android:layout_width="wrap_content" | ||
92 | + android:layout_height="wrap_content" | ||
93 | + android:layout_gravity="center" | ||
94 | + android:layout_marginTop="36dp" | ||
95 | + android:text="Κωδικός Κουπονιού" | ||
96 | + android:textColor="#415564" | ||
97 | + android:textSize="18sp" /> | ||
98 | + | ||
99 | + <TextView | ||
100 | + android:id="@+id/textView16" | ||
101 | + fontPath="fonts/pf_square_sans_pro_bold.ttf" | ||
102 | + android:layout_width="match_parent" | ||
103 | + android:layout_height="50dp" | ||
104 | + android:layout_marginHorizontal="32dp" | ||
105 | + android:layout_marginTop="12dp" | ||
106 | + android:background="@drawable/banner_border_light_grey" | ||
107 | + android:gravity="center" | ||
108 | + android:textColor="@color/grey" | ||
109 | + android:textIsSelectable="true" | ||
110 | + android:textSize="25dp" | ||
111 | + tools:text="1A2C378" /> | ||
112 | + | ||
113 | + <LinearLayout | ||
114 | + android:id="@+id/ll_barcode_container" | ||
115 | + android:layout_width="match_parent" | ||
116 | + android:layout_height="wrap_content" | ||
117 | + android:layout_marginTop="20dp" | ||
118 | + android:gravity="center" | ||
119 | + android:orientation="vertical"> | ||
120 | + | ||
121 | + <LinearLayout | ||
122 | + android:id="@+id/ll_barcode_container_items" | ||
123 | + android:layout_width="match_parent" | ||
124 | + android:layout_height="wrap_content" | ||
125 | + android:gravity="center" | ||
126 | + android:orientation="vertical" | ||
127 | + tools:visibility="visible"> | ||
128 | + | ||
129 | + <View | ||
130 | + android:id="@+id/view5" | ||
131 | + android:layout_width="320dp" | ||
132 | + android:layout_height="0.8dp" | ||
133 | + android:background="#E6E6E6" /> | ||
134 | + | ||
135 | + <ImageView | ||
136 | + android:id="@+id/iv_barcode" | ||
137 | + android:layout_width="284dp" | ||
138 | + android:layout_height="86dp" | ||
139 | + android:layout_marginTop="16dp" | ||
140 | + android:scaleType="fitXY" | ||
141 | + tools:srcCompat="@tools:sample/avatars" /> | ||
142 | + | ||
143 | + <TextView | ||
144 | + android:id="@+id/tv_full_barcode" | ||
145 | + fontPath="fonts/pf_square_sans_pro_regular.ttf" | ||
146 | + android:layout_width="wrap_content" | ||
147 | + android:layout_height="wrap_content" | ||
148 | + android:layout_marginTop="12dp" | ||
149 | + android:textColor="@color/grey" | ||
150 | + android:textSize="20sp" | ||
151 | + android:visibility="gone" | ||
152 | + tools:text="@string/cos_show_barcode" /> | ||
153 | + | ||
154 | + <View | ||
155 | + android:id="@+id/view4" | ||
156 | + android:layout_width="320dp" | ||
157 | + android:layout_height="0.8dp" | ||
158 | + android:layout_marginTop="20dp" | ||
159 | + android:background="#E6E6E6" /> | ||
160 | + </LinearLayout> | ||
161 | + </LinearLayout> | ||
162 | + | ||
163 | + <TextView | ||
164 | + android:id="@+id/textView17" | ||
165 | + fontPath="fonts/pf_square_sans_pro_regular.ttf" | ||
166 | + android:layout_width="wrap_content" | ||
167 | + android:layout_height="wrap_content" | ||
168 | + android:layout_gravity="center" | ||
169 | + android:layout_marginTop="16dp" | ||
170 | + android:textColor="#415564" | ||
171 | + tools:text="@string/cos_coupon_date" /> | ||
172 | + | ||
173 | + <LinearLayout | ||
174 | + android:id="@+id/ll_market_expand" | ||
175 | + android:layout_width="wrap_content" | ||
176 | + android:layout_height="wrap_content" | ||
177 | + android:layout_gravity="center_horizontal" | ||
178 | + android:layout_marginTop="48dp" | ||
179 | + android:gravity="center" | ||
180 | + android:orientation="horizontal"> | ||
181 | + | ||
182 | + <TextView | ||
183 | + android:id="@+id/tv_market_expand" | ||
184 | + fontPath="fonts/pf_square_sans_pro_regular.ttf" | ||
185 | + android:layout_width="wrap_content" | ||
186 | + android:layout_height="wrap_content" | ||
187 | + android:text="@string/cos_hide_market_coupons" | ||
188 | + android:textColor="@color/grey" | ||
189 | + android:textSize="16sp" /> | ||
190 | + | ||
191 | + <ImageView | ||
192 | + android:id="@+id/iv_market_expand" | ||
193 | + android:layout_width="14dp" | ||
194 | + android:layout_height="14dp" | ||
195 | + android:layout_marginStart="6dp" | ||
196 | + android:src="@drawable/ic_up_dark_new" /> | ||
197 | + </LinearLayout> | ||
198 | + | ||
199 | + <LinearLayout | ||
200 | + android:id="@+id/ll_market_coupons" | ||
201 | + android:layout_width="match_parent" | ||
202 | + android:layout_height="wrap_content" | ||
203 | + android:layout_marginTop="16dp" | ||
204 | + android:orientation="vertical"> | ||
205 | + | ||
206 | + <androidx.recyclerview.widget.RecyclerView | ||
207 | + android:id="@+id/rv_active_market_coupons" | ||
208 | + android:layout_width="match_parent" | ||
209 | + android:layout_height="wrap_content" | ||
210 | + android:layout_marginHorizontal="2dp" | ||
211 | + android:overScrollMode="never" /> | ||
212 | + </LinearLayout> | ||
213 | + | ||
214 | + | ||
215 | + <LinearLayout | ||
216 | + android:id="@+id/ll_shops" | ||
217 | + android:layout_width="220dp" | ||
218 | + android:layout_height="wrap_content" | ||
219 | + android:layout_gravity="center" | ||
220 | + android:layout_marginHorizontal="32dp" | ||
221 | + android:layout_marginTop="24dp" | ||
222 | + android:background="@drawable/selector_button_green" | ||
223 | + android:gravity="center" | ||
224 | + android:orientation="horizontal" | ||
225 | + android:paddingVertical="8dp"> | ||
226 | + | ||
227 | + <TextView | ||
228 | + fontPath="fonts/pf_square_sans_pro_medium.ttf" | ||
229 | + android:layout_width="wrap_content" | ||
230 | + android:layout_height="wrap_content" | ||
231 | + android:gravity="center" | ||
232 | + android:text="@string/cos_markets" | ||
233 | + android:textColor="@color/white" | ||
234 | + android:textSize="17dp" /> | ||
235 | + </LinearLayout> | ||
236 | + | ||
237 | + <RelativeLayout | ||
238 | + android:id="@+id/rl_terms" | ||
239 | + android:layout_width="wrap_content" | ||
240 | + android:layout_height="wrap_content" | ||
241 | + android:layout_gravity="center" | ||
242 | + android:layout_marginTop="32dp" | ||
243 | + android:gravity="center"> | ||
244 | + | ||
245 | + <LinearLayout | ||
246 | + android:id="@+id/ll_terms_inner" | ||
247 | + android:layout_width="wrap_content" | ||
248 | + android:layout_height="wrap_content" | ||
249 | + android:layout_centerHorizontal="true" | ||
250 | + android:gravity="center" | ||
251 | + android:orientation="horizontal"> | ||
252 | + | ||
253 | + <TextView | ||
254 | + android:id="@+id/tv_terms" | ||
255 | + fontPath="fonts/pf_square_sans_pro_regular.ttf" | ||
256 | + android:layout_width="wrap_content" | ||
257 | + android:layout_height="wrap_content" | ||
258 | + android:text="@string/cos_coupon_terms_title" | ||
259 | + android:textColor="@color/grey" | ||
260 | + android:textSize="16sp" /> | ||
261 | + | ||
262 | + <ImageView | ||
263 | + android:id="@+id/iv_terms_arrow" | ||
264 | + android:layout_width="14dp" | ||
265 | + android:layout_height="14dp" | ||
266 | + android:layout_marginStart="6dp" | ||
267 | + android:src="@drawable/ic_down_dark_new" /> | ||
268 | + </LinearLayout> | ||
269 | + | ||
270 | + <TextView | ||
271 | + android:id="@+id/tv_terms_value" | ||
272 | + fontPath="fonts/pf_square_sans_pro_regular.ttf" | ||
273 | + android:layout_width="wrap_content" | ||
274 | + android:layout_height="wrap_content" | ||
275 | + android:layout_below="@+id/ll_terms_inner" | ||
276 | + android:layout_marginHorizontal="32dp" | ||
277 | + android:layout_marginTop="16dp" | ||
278 | + android:text="@string/cos_market_terms" | ||
279 | + android:textColor="#415564" | ||
280 | + android:visibility="gone" /> | ||
281 | + </RelativeLayout> | ||
282 | + </LinearLayout> | ||
283 | + </ScrollView> | ||
284 | + | ||
285 | + <LinearLayout | ||
286 | + android:layout_width="match_parent" | ||
287 | + android:layout_height="wrap_content" | ||
288 | + android:background="@drawable/ic_line"> | ||
289 | + | ||
290 | + </LinearLayout> | ||
291 | + </RelativeLayout> | ||
292 | +</RelativeLayout> |
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + xmlns:tools="http://schemas.android.com/tools" | ||
5 | + android:id="@+id/cl_custom_layout" | ||
6 | + android:layout_width="match_parent" | ||
7 | + android:layout_height="130dp" | ||
8 | + android:layout_marginHorizontal="4dp" | ||
9 | + android:layout_marginVertical="4dp" | ||
10 | + android:background="@drawable/ic_coupon_background"> | ||
11 | + | ||
12 | + <androidx.constraintlayout.widget.Guideline | ||
13 | + android:id="@+id/gl_vertical_72_percent" | ||
14 | + android:layout_width="wrap_content" | ||
15 | + android:layout_height="wrap_content" | ||
16 | + android:orientation="vertical" | ||
17 | + app:layout_constraintGuide_percent="0.72" /> | ||
18 | + | ||
19 | + <ImageView | ||
20 | + android:id="@+id/iv_active_coupon" | ||
21 | + android:layout_width="80dp" | ||
22 | + android:layout_height="80dp" | ||
23 | + android:layout_marginStart="24dp" | ||
24 | + app:layout_constraintBottom_toBottomOf="parent" | ||
25 | + app:layout_constraintStart_toStartOf="parent" | ||
26 | + app:layout_constraintTop_toTopOf="parent" | ||
27 | + tools:src="@drawable/ic_gifts_for_you" /> | ||
28 | + | ||
29 | + <View | ||
30 | + android:id="@+id/v_separator" | ||
31 | + android:layout_width="1dp" | ||
32 | + android:layout_height="match_parent" | ||
33 | + android:layout_marginVertical="16dp" | ||
34 | + android:layout_marginStart="8dp" | ||
35 | + android:background="@drawable/shape_dashed_vertical" | ||
36 | + app:layout_constraintBottom_toBottomOf="parent" | ||
37 | + app:layout_constraintStart_toEndOf="@+id/iv_active_coupon" | ||
38 | + app:layout_constraintTop_toTopOf="parent" /> | ||
39 | + | ||
40 | + <LinearLayout | ||
41 | + android:id="@+id/ll_coupon_info" | ||
42 | + android:layout_width="0dp" | ||
43 | + android:layout_height="wrap_content" | ||
44 | + android:layout_marginStart="16dp" | ||
45 | + android:orientation="vertical" | ||
46 | + app:layout_constraintBottom_toBottomOf="parent" | ||
47 | + app:layout_constraintEnd_toStartOf="@+id/gl_vertical_72_percent" | ||
48 | + app:layout_constraintStart_toEndOf="@+id/v_separator" | ||
49 | + app:layout_constraintTop_toTopOf="parent"> | ||
50 | + | ||
51 | + <TextView | ||
52 | + android:id="@+id/tv_active_coupons_title" | ||
53 | + fontPath="fonts/pf_square_sans_pro_medium.ttf" | ||
54 | + android:layout_width="wrap_content" | ||
55 | + android:layout_height="wrap_content" | ||
56 | + android:ellipsize="end" | ||
57 | + android:maxLines="1" | ||
58 | + android:textColor="#3A5266" | ||
59 | + android:textSize="16sp" | ||
60 | + tools:text="Εκπτωτικο κουπονι 10$ για αγορες στα ΙΚΕΑ" /> | ||
61 | + | ||
62 | + <TextView | ||
63 | + android:id="@+id/tv_active_coupons_value" | ||
64 | + fontPath="fonts/pf_square_sans_pro_bold.ttf" | ||
65 | + android:layout_width="wrap_content" | ||
66 | + android:layout_height="wrap_content" | ||
67 | + android:textColor="#3A5266" | ||
68 | + android:textSize="42sp" | ||
69 | + tools:text="10$" /> | ||
70 | + | ||
71 | + <TextView | ||
72 | + android:id="@+id/tv_active_coupons_date" | ||
73 | + fontPath="fonts/pf_square_sans_pro_medium.ttf" | ||
74 | + android:layout_width="wrap_content" | ||
75 | + android:layout_height="wrap_content" | ||
76 | + android:textColor="#617181" | ||
77 | + android:textSize="12sp" | ||
78 | + android:visibility="gone" | ||
79 | + tools:text="@string/cos_active_coupon_date" /> | ||
80 | + | ||
81 | + <TextView | ||
82 | + android:id="@+id/tv_active_coupons_date_expired" | ||
83 | + fontPath="fonts/pf_square_sans_pro_bold.ttf" | ||
84 | + android:layout_width="wrap_content" | ||
85 | + android:layout_height="wrap_content" | ||
86 | + android:textColor="#617181" | ||
87 | + android:textSize="12sp" | ||
88 | + android:visibility="gone" | ||
89 | + tools:text="@string/cos_market_coupon_expired" /> | ||
90 | + </LinearLayout> | ||
91 | + | ||
92 | + <LinearLayout | ||
93 | + android:id="@+id/ll_date_limit" | ||
94 | + android:layout_width="wrap_content" | ||
95 | + android:layout_height="wrap_content" | ||
96 | + android:background="@drawable/shape_market_limit" | ||
97 | + android:gravity="center_vertical" | ||
98 | + android:orientation="horizontal" | ||
99 | + android:visibility="gone" | ||
100 | + android:layout_marginBottom="36dp" | ||
101 | + android:layout_marginStart="8dp" | ||
102 | + app:layout_constraintBottom_toBottomOf="parent" | ||
103 | + app:layout_constraintTop_toBottomOf="@+id/ll_coupon_info" | ||
104 | + app:layout_constraintStart_toEndOf="@+id/v_separator" | ||
105 | + tools:visibility="visible"> | ||
106 | + | ||
107 | +<!-- <ImageView--> | ||
108 | +<!-- android:layout_width="14dp"--> | ||
109 | +<!-- android:layout_height="14dp"--> | ||
110 | +<!-- android:layout_marginEnd="4dp"--> | ||
111 | +<!-- android:src="@drawable/timer_red" />--> | ||
112 | + | ||
113 | + <TextView | ||
114 | + fontPath="fonts/pf_square_sans_pro_medium.ttf" | ||
115 | + android:layout_width="wrap_content" | ||
116 | + android:layout_height="wrap_content" | ||
117 | + android:text="@string/cos_coupon_date_limit" | ||
118 | + android:textColor="#617181" | ||
119 | + android:textSize="12sp" /> | ||
120 | + | ||
121 | + <TextView | ||
122 | + android:id="@+id/tv_active_coupons_date_limit" | ||
123 | + fontPath="fonts/pf_square_sans_pro_medium.ttf" | ||
124 | + android:layout_width="wrap_content" | ||
125 | + android:layout_height="wrap_content" | ||
126 | + android:text="@string/cos_coupon_date_limit" | ||
127 | + android:textColor="#FF6B6B" | ||
128 | + android:textSize="12sp" | ||
129 | + tools:text="@string/cos_coupon_date_limit2" /> | ||
130 | + </LinearLayout> | ||
131 | + | ||
132 | + <TextView | ||
133 | + android:id="@+id/tv_active_coupons_description" | ||
134 | + fontPath="fonts/pf_square_sans_pro_medium.ttf" | ||
135 | + android:layout_width="0dp" | ||
136 | + android:layout_height="wrap_content" | ||
137 | + android:layout_marginStart="8dp" | ||
138 | + android:layout_marginEnd="32dp" | ||
139 | + android:maxLines="4" | ||
140 | + android:textColor="#617181" | ||
141 | + android:textSize="12sp" | ||
142 | + app:layout_constraintBottom_toBottomOf="parent" | ||
143 | + app:layout_constraintEnd_toEndOf="parent" | ||
144 | + app:layout_constraintStart_toEndOf="@+id/gl_vertical_72_percent" | ||
145 | + app:layout_constraintTop_toTopOf="parent" | ||
146 | + tools:text="Εκπτωση με ελάχιστες αγορές 100€" /> | ||
147 | +</androidx.constraintlayout.widget.ConstraintLayout> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + xmlns:tools="http://schemas.android.com/tools" | ||
5 | + android:layout_width="match_parent" | ||
6 | + android:layout_height="130dp" | ||
7 | + android:layout_marginHorizontal="4dp" | ||
8 | + android:layout_marginVertical="4dp" | ||
9 | + android:background="@drawable/ic_coupon_background_new2"> | ||
10 | + | ||
11 | + <androidx.constraintlayout.widget.Guideline | ||
12 | + android:id="@+id/gl_vertical_72_percent" | ||
13 | + android:layout_width="wrap_content" | ||
14 | + android:layout_height="wrap_content" | ||
15 | + android:orientation="vertical" | ||
16 | + app:layout_constraintGuide_percent="0.72" /> | ||
17 | + | ||
18 | + <ImageView | ||
19 | + android:id="@+id/iv_market_coupon" | ||
20 | + android:layout_width="80dp" | ||
21 | + android:layout_height="80dp" | ||
22 | + android:layout_marginStart="24dp" | ||
23 | + android:padding="18dp" | ||
24 | + android:src="@drawable/ic_market_trolley" | ||
25 | + app:layout_constraintBottom_toBottomOf="parent" | ||
26 | + app:layout_constraintStart_toStartOf="parent" | ||
27 | + app:layout_constraintTop_toTopOf="parent" /> | ||
28 | + | ||
29 | + <View | ||
30 | + android:id="@+id/v_separator" | ||
31 | + android:layout_width="1dp" | ||
32 | + android:layout_height="match_parent" | ||
33 | + android:layout_marginVertical="16dp" | ||
34 | + android:layout_marginStart="8dp" | ||
35 | + android:background="@drawable/shape_dashed_vertical" | ||
36 | + app:layout_constraintBottom_toBottomOf="parent" | ||
37 | + app:layout_constraintStart_toEndOf="@+id/iv_market_coupon" | ||
38 | + app:layout_constraintTop_toTopOf="parent" /> | ||
39 | + | ||
40 | + <LinearLayout | ||
41 | + android:id="@+id/ll_coupon_info" | ||
42 | + android:layout_width="0dp" | ||
43 | + android:layout_height="wrap_content" | ||
44 | + android:layout_marginStart="16dp" | ||
45 | + android:orientation="vertical" | ||
46 | + app:layout_constraintBottom_toBottomOf="parent" | ||
47 | + app:layout_constraintEnd_toStartOf="@+id/gl_vertical_72_percent" | ||
48 | + app:layout_constraintStart_toEndOf="@+id/v_separator" | ||
49 | + app:layout_constraintTop_toTopOf="parent"> | ||
50 | + | ||
51 | + <TextView | ||
52 | + android:id="@+id/tv_market_coupons_title" | ||
53 | + fontPath="fonts/BTCosmo-Bold.ttf" | ||
54 | + android:layout_width="wrap_content" | ||
55 | + android:layout_height="wrap_content" | ||
56 | + android:ellipsize="end" | ||
57 | + android:maxLines="3" | ||
58 | + android:textColor="@color/cos_light_black" | ||
59 | + android:textSize="16sp" | ||
60 | + android:text="@string/cos_market_item_title" /> | ||
61 | + | ||
62 | + <TextView | ||
63 | + fontPath="fonts/pf_square_sans_pro_bold.ttf" | ||
64 | + android:layout_width="wrap_content" | ||
65 | + android:layout_height="wrap_content" | ||
66 | + android:textColor="#3A5266" | ||
67 | + android:textSize="22sp" | ||
68 | + android:text="" /> | ||
69 | + | ||
70 | + <TextView | ||
71 | + android:id="@+id/tv_market_coupons_date" | ||
72 | + fontPath="fonts/PeridotPE-Regular.ttf" | ||
73 | + android:layout_width="wrap_content" | ||
74 | + android:layout_height="wrap_content" | ||
75 | + android:textColor="@color/cos_light_black" | ||
76 | + android:textSize="12sp" | ||
77 | + tools:text="@string/cos_active_coupon_date" /> | ||
78 | + </LinearLayout> | ||
79 | + | ||
80 | + <TextView | ||
81 | + android:id="@+id/tv_market_coupons_count" | ||
82 | + fontPath="fonts/PeridotPE-Regular.ttf" | ||
83 | + android:layout_width="0dp" | ||
84 | + android:layout_height="wrap_content" | ||
85 | + android:layout_marginStart="8dp" | ||
86 | + android:layout_marginEnd="32dp" | ||
87 | + android:maxLines="4" | ||
88 | + android:textColor="@color/cos_light_black" | ||
89 | + android:textSize="12sp" | ||
90 | + app:layout_constraintBottom_toBottomOf="parent" | ||
91 | + app:layout_constraintEnd_toEndOf="parent" | ||
92 | + app:layout_constraintStart_toEndOf="@+id/gl_vertical_72_percent" | ||
93 | + app:layout_constraintTop_toTopOf="parent" | ||
94 | + tools:text="@string/cos_market_active_coupons" /> | ||
95 | +</androidx.constraintlayout.widget.ConstraintLayout> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -71,4 +71,5 @@ | ... | @@ -71,4 +71,5 @@ |
71 | <color name="cos_gray">#9D9D9C</color> | 71 | <color name="cos_gray">#9D9D9C</color> |
72 | <color name="cos_gray2">#848484</color> | 72 | <color name="cos_gray2">#848484</color> |
73 | <color name="cos_light_blue">#00A5E3</color> | 73 | <color name="cos_light_blue">#00A5E3</color> |
74 | + <color name="cos_grey_dark2">#32485A</color> | ||
74 | </resources> | 75 | </resources> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -73,8 +73,8 @@ | ... | @@ -73,8 +73,8 @@ |
73 | <string name="cos_gift_it">Δώρισέ το</string> | 73 | <string name="cos_gift_it">Δώρισέ το</string> |
74 | <string name="cos_popup_more_title">COSMOTE MORE FOR YOU</string> | 74 | <string name="cos_popup_more_title">COSMOTE MORE FOR YOU</string> |
75 | <string name="cos_popup_more_subtitle">Σε αυτή την ενότητα βρες έρευνες, παιχνίδια, διαγωνισμούς και επιβραβεύσεις για τις αθλητικές σου δραστηριότητες!</string> | 75 | <string name="cos_popup_more_subtitle">Σε αυτή την ενότητα βρες έρευνες, παιχνίδια, διαγωνισμούς και επιβραβεύσεις για τις αθλητικές σου δραστηριότητες!</string> |
76 | - <string name="cos_deals_win_title">Μέχρι τώρα έχεις κερδίσει %1$s€ σε προσφορές από %2$s κουπόνια!</string> | 76 | + <string name="cos_deals_win_title">Έχεις κερδίσει %1$s€ με το\nGIFTS for YOU!</string> |
77 | - <string name="cos_deals_win_title_cos">Μέχρι τώρα έχεις κερδίσει %1$s€ με το DEALS for YOU!</string> | 77 | + <string name="cos_deals_win_title_cos">Έχεις κερδίσει %1$s€ με το\nDEALS for YOU!</string> |
78 | <string name="cos_mygifts">Τα δώρα μου</string> | 78 | <string name="cos_mygifts">Τα δώρα μου</string> |
79 | <string name="cos_gifts_banner_title">Δώρα:</string> | 79 | <string name="cos_gifts_banner_title">Δώρα:</string> |
80 | <string name="cos_see_more">Δες περισσότερα</string> | 80 | <string name="cos_see_more">Δες περισσότερα</string> |
... | @@ -150,6 +150,25 @@ | ... | @@ -150,6 +150,25 @@ |
150 | <string name="cos_dlg_no_shops_title">Καταστήματα συνεργάτη</string> | 150 | <string name="cos_dlg_no_shops_title">Καταστήματα συνεργάτη</string> |
151 | <string name="cos_dlg_no_shops_positive">Δες το eshop</string> | 151 | <string name="cos_dlg_no_shops_positive">Δες το eshop</string> |
152 | <string name="cos_profile_preferences_placeholder">Οι προτιμήσεις μου</string> | 152 | <string name="cos_profile_preferences_placeholder">Οι προτιμήσεις μου</string> |
153 | + <string name="cos_market_title">SuperMarket Deals</string> | ||
154 | + <string name="cos_rewards_title2">COSMOTE Επιβράβευση</string> | ||
155 | + <string name="cos_market_item_title">COSMOTE\nSuperMarket\nDeals</string> | ||
156 | + <string name="cos_market_active_coupons">έχεις %1$s ενεργά κουπόνια</string> | ||
157 | + <string name="cos_market_active_coupons_single">έχεις %1$s ενεργό κουπόνι</string> | ||
158 | + <string name="cos_unified_title">Εκπτωτικό κουπόνι COSMOTE SuperMarket Deals!</string> | ||
159 | + <string name="cos_unified_subtitle">Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών.</string> | ||
160 | + <string name="cos_markets">Δες τα supermarket</string> | ||
161 | + <string name="cos_show_market_coupons">Εμφάνιση κουπονιών</string> | ||
162 | + <string name="cos_hide_market_coupons">Απόκρυψη κουπονιών</string> | ||
163 | + <string name="cos_market_terms">1. Το εκπτωτικό κουπόνι ισχύει έως την ημερομηνία που αναφέρεται παραπάνω\n | ||
164 | +2. To εκπτωτικό κουπόνι αφορά στα ενεργά κουπόνια προσφορών όπως αναφέρονται παραπάνω.\n | ||
165 | +3. Το εκπτωτικό κουπόνι μπορεί να χρησιμοποιηθεί σε μια μόνο συναλλαγή.\n | ||
166 | +4. Εάν δεν γίνει χρήση ενός επιμέρους κουπονιού προσφοράς από το εκπτωτικό κουπόνι, το κουπόνι προσφοράς επιστρέφει στο καλάθι στην ενότητα COSMOTE SuperMarket Deals</string> | ||
167 | + <string name="cos_market_coupon_expired">Το κουπόνι έληξε</string> | ||
168 | + <string name="cos_coupon_date_limit">Ισχύει έως </string> | ||
169 | + <string name="cos_coupon_date_limit2">%1$s</string> | ||
170 | + <string name="cos_for_you_all">Μέχρι τώρα έχεις κερδίσει %1$s€ στο For You!</string> | ||
171 | + <string name="cos_supermarket_win">Έχεις κερδίσει %1$s€ με τα\nSuperMarket Deals!</string> | ||
153 | 172 | ||
154 | <string-array name="coupons_array"> | 173 | <string-array name="coupons_array"> |
155 | <item>Κουπόνια</item> | 174 | <item>Κουπόνια</item> | ... | ... |
-
Please register or login to post a comment