Panagiotis Triantafyllou

vouchers part3

...@@ -82,7 +82,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -82,7 +82,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
82 private ConstraintLayout mClDealsBanner, mClDealsView, 82 private ConstraintLayout mClDealsBanner, mClDealsView,
83 mClGiftsBanner, mClToolbar, mClMarket; 83 mClGiftsBanner, mClToolbar, mClMarket;
84 private LinearLayout mLlQuestionnaire, mLlUserBadge, mLlEmptyWallet, mLlDeals, mLlGifts, 84 private LinearLayout mLlQuestionnaire, mLlUserBadge, mLlEmptyWallet, mLlDeals, mLlGifts,
85 - mLlMarketView, mLlHistory, mLlBannerInfo, mLlVouchers; 85 + mLlMarketView, mLlHistory, mLlBannerInfo, mLlVouchers, mLlVouchersSpinner;
86 private FlowLayout mLlActiveCodesView; 86 private FlowLayout mLlActiveCodesView;
87 private float couponDfyValue = 0.0f, mFavValue = 0.0f; 87 private float couponDfyValue = 0.0f, mFavValue = 0.0f;
88 private RecyclerView mRecyclerCoupons, mRvMarketCoupons; 88 private RecyclerView mRecyclerCoupons, mRvMarketCoupons;
...@@ -162,6 +162,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -162,6 +162,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
162 mRecyclerCoupons = findViewById(R.id.rv_active_coupons); 162 mRecyclerCoupons = findViewById(R.id.rv_active_coupons);
163 mCvVouchers = findViewById(R.id.cv_vouchers); 163 mCvVouchers = findViewById(R.id.cv_vouchers);
164 mLlVouchers = findViewById(R.id.ll_vouchers); 164 mLlVouchers = findViewById(R.id.ll_vouchers);
165 + mLlVouchersSpinner = findViewById(R.id.ll_vouchers_spinner);
165 166
166 /** Deals Badge */ 167 /** Deals Badge */
167 // if (WarplyManagerHelper.getActiveDFYCoupons() != null) { 168 // if (WarplyManagerHelper.getActiveDFYCoupons() != null) {
...@@ -254,7 +255,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -254,7 +255,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
254 } 255 }
255 return; 256 return;
256 } 257 }
257 - if (view.getId() == R.id.cl_deals_win_inner_cos || view.getId() == R.id.rv_deals_count) { 258 + /** Deals History */
259 + if (view.getId() == R.id.cl_deals_win_inner_cos) {
258 if (!mDealsBannerPressed) { 260 if (!mDealsBannerPressed) {
259 mDealsBannerPressed = true; 261 mDealsBannerPressed = true;
260 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") 262 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
...@@ -272,15 +274,21 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -272,15 +274,21 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
272 } 274 }
273 return; 275 return;
274 } 276 }
277 + /** Active Unified Banner */
275 if (view.getId() == R.id.rv_sm_count) { 278 if (view.getId() == R.id.rv_sm_count) {
276 if (!mUnifiedCountPressed) { 279 if (!mUnifiedCountPressed) {
277 mUnifiedCountPressed = true; 280 mUnifiedCountPressed = true;
278 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") 281 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
279 .concat(":") 282 .concat(":")
280 - .concat("SMDealsBanner")); 283 + .concat("ActiveMarketBanner"));
284 +
285 +// LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
286 +// analyticsEvent.setEventName("did_tap_sm_deals_badge");
287 +// analyticsEvent.setParameter("screen", "Loyalty Wallet");
288 +// EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
281 289
282 LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); 290 LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
283 - analyticsEvent.setEventName("did_tap_sm_deals_badge"); 291 + analyticsEvent.setEventName("did_tap_market_active_badge");
284 analyticsEvent.setParameter("screen", "Loyalty Wallet"); 292 analyticsEvent.setParameter("screen", "Loyalty Wallet");
285 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); 293 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
286 294
...@@ -289,15 +297,21 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -289,15 +297,21 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
289 } 297 }
290 return; 298 return;
291 } 299 }
300 + /** Active Coupons Banner */
292 if (view.getId() == R.id.rv_gifts_count) { 301 if (view.getId() == R.id.rv_gifts_count) {
293 if (!mGiftsCountPressed) { 302 if (!mGiftsCountPressed) {
294 mGiftsCountPressed = true; 303 mGiftsCountPressed = true;
295 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") 304 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
296 .concat(":") 305 .concat(":")
297 - .concat("GFYBanner")); 306 + .concat("ActiveLoyaltyBanner"));
307 +
308 +// LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
309 +// analyticsEvent.setEventName("did_tap_gifts_badge");
310 +// analyticsEvent.setParameter("screen", "Loyalty Wallet");
311 +// EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
298 312
299 LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); 313 LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
300 - analyticsEvent.setEventName("did_tap_gifts_badge"); 314 + analyticsEvent.setEventName("did_tap_gifts_for_you_active_badge");
301 analyticsEvent.setParameter("screen", "Loyalty Wallet"); 315 analyticsEvent.setParameter("screen", "Loyalty Wallet");
302 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); 316 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
303 317
...@@ -306,6 +320,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -306,6 +320,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
306 } 320 }
307 return; 321 return;
308 } 322 }
323 + /** Coupons History */
309 if (view.getId() == R.id.cl_deals_win_inner) { 324 if (view.getId() == R.id.cl_deals_win_inner) {
310 if (!mHistoryPressed) { 325 if (!mHistoryPressed) {
311 mHistoryPressed = true; 326 mHistoryPressed = true;
...@@ -334,23 +349,25 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -334,23 +349,25 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
334 } 349 }
335 return; 350 return;
336 } 351 }
352 + /** Unified History */
337 if (view.getId() == R.id.cl_market_inner) { 353 if (view.getId() == R.id.cl_market_inner) {
338 -// if (countValue > 0) {
339 if (!mHistoryMarketPressed) { 354 if (!mHistoryMarketPressed) {
340 mHistoryMarketPressed = true; 355 mHistoryMarketPressed = true;
341 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") 356 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
342 .concat(":") 357 .concat(":")
343 .concat("MarketBanner")); 358 .concat("MarketBanner"));
359 +
344 LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); 360 LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
345 analyticsEvent.setEventName("did_tap_market_badge"); 361 analyticsEvent.setEventName("did_tap_market_badge");
346 analyticsEvent.setParameter("screen", "Loyalty Wallet"); 362 analyticsEvent.setParameter("screen", "Loyalty Wallet");
347 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); 363 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
364 +
348 Intent intent = new Intent(LoyaltyWallet.this, LoyaltyMarketAnalysisActivity.class); 365 Intent intent = new Intent(LoyaltyWallet.this, LoyaltyMarketAnalysisActivity.class);
349 startActivity(intent); 366 startActivity(intent);
350 } 367 }
351 -// }
352 return; 368 return;
353 } 369 }
370 + /** New History */
354 if (view.getId() == R.id.ll_loyalty_history) { 371 if (view.getId() == R.id.ll_loyalty_history) {
355 if (!mHistoryBadgePressed) { 372 if (!mHistoryBadgePressed) {
356 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") 373 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
...@@ -361,9 +378,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -361,9 +378,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
361 analyticsEvent.setEventName("did_tap_history_badge"); 378 analyticsEvent.setEventName("did_tap_history_badge");
362 analyticsEvent.setParameter("screen", "Loyalty Wallet"); 379 analyticsEvent.setParameter("screen", "Loyalty Wallet");
363 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); 380 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
381 +
382 + //TODO: add new history intent
364 } 383 }
365 return; 384 return;
366 } 385 }
386 + /** Vouchers Client's Screen */
367 if (view.getId() == R.id.cv_vouchers) { 387 if (view.getId() == R.id.cv_vouchers) {
368 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") 388 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
369 .concat(":") 389 .concat(":")
...@@ -378,13 +398,19 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -378,13 +398,19 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
378 EventBus.getDefault().post(new WarplyEventBusManager(vouchersActivity)); 398 EventBus.getDefault().post(new WarplyEventBusManager(vouchersActivity));
379 return; 399 return;
380 } 400 }
381 - if (view.getId() == R.id.cl_mygifts) { 401 + /** Active Deals Banner */
402 + if (view.getId() == R.id.cl_mygifts || view.getId() == R.id.rv_deals_count) {
382 if (!mDfyPressed) { 403 if (!mDfyPressed) {
383 mDfyPressed = true; 404 mDfyPressed = true;
384 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") 405 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
385 .concat(":") 406 .concat(":")
386 .concat("ActiveDealsBanner")); 407 .concat("ActiveDealsBanner"));
387 408
409 + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
410 + analyticsEvent.setEventName("did_tap_deals_for_you_active_badge");
411 + analyticsEvent.setParameter("screen", "Loyalty Wallet");
412 + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
413 +
388 ActiveDFYCouponEventModel activeCouponEventModel = new ActiveDFYCouponEventModel(); 414 ActiveDFYCouponEventModel activeCouponEventModel = new ActiveDFYCouponEventModel();
389 activeCouponEventModel.setPressed(true); 415 activeCouponEventModel.setPressed(true);
390 EventBus.getDefault().post(new WarplyEventBusManager(activeCouponEventModel)); 416 EventBus.getDefault().post(new WarplyEventBusManager(activeCouponEventModel));
...@@ -425,13 +451,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -425,13 +451,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
425 public void onMessageEvent(WarplyEventBusManager event) { 451 public void onMessageEvent(WarplyEventBusManager event) {
426 if (event.getVouchersFetched() != null) { 452 if (event.getVouchersFetched() != null) {
427 if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) { 453 if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
428 - //TODO: hide spinner
429 runOnUiThread(() -> { 454 runOnUiThread(() -> {
455 + mLlVouchersSpinner.setVisibility(View.GONE);
430 mLlVouchers.setVisibility(View.VISIBLE); 456 mLlVouchers.setVisibility(View.VISIBLE);
431 }); 457 });
432 } else { 458 } else {
433 - //.equals("false) 459 + runOnUiThread(() -> {
434 - //TODO: hide spinner 460 + mLlVouchersSpinner.setVisibility(View.GONE);
461 + });
435 } 462 }
436 return; 463 return;
437 } 464 }
...@@ -968,10 +995,20 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -968,10 +995,20 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
968 private void checkForEmpty() { 995 private void checkForEmpty() {
969 if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() == 0) 996 if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() == 0)
970 && (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() == 0) 997 && (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() == 0)
971 - && (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() == 0) 998 + && (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() == 0)) {
972 - && (TextUtils.isEmpty(WarplyManagerHelper.getShowVouchersBanner()))) { 999 + if (TextUtils.isEmpty(WarplyManagerHelper.getShowVouchersBanner())) {
973 - mLlEmptyWallet.setVisibility(View.VISIBLE); 1000 + mLlBannerInfo.setVisibility(View.VISIBLE);
974 - //TODO: check for spinner and show it 1001 + mLlVouchersSpinner.setVisibility(View.VISIBLE);
1002 + } else if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
1003 + mLlBannerInfo.setVisibility(View.VISIBLE);
1004 + mLlVouchersSpinner.setVisibility(View.GONE);
1005 + mLlVouchers.setVisibility(View.VISIBLE);
1006 + } else if (WarplyManagerHelper.getShowVouchersBanner().equals("false")) {
1007 + mLlBannerInfo.setVisibility(View.GONE);
1008 + mLlVouchersSpinner.setVisibility(View.GONE);
1009 + mLlVouchers.setVisibility(View.GONE);
1010 + mLlEmptyWallet.setVisibility(View.VISIBLE);
1011 + }
975 } else { 1012 } else {
976 mLlEmptyWallet.setVisibility(View.GONE); 1013 mLlEmptyWallet.setVisibility(View.GONE);
977 if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() > 0) 1014 if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() > 0)
...@@ -979,8 +1016,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -979,8 +1016,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
979 || (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0)) { 1016 || (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0)) {
980 mLlBannerInfo.setVisibility(View.VISIBLE); 1017 mLlBannerInfo.setVisibility(View.VISIBLE);
981 } 1018 }
982 - if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) { 1019 + if (TextUtils.isEmpty(WarplyManagerHelper.getShowVouchersBanner())) {
1020 + mLlVouchersSpinner.setVisibility(View.VISIBLE);
1021 + } else if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
1022 + mLlVouchersSpinner.setVisibility(View.GONE);
983 mLlVouchers.setVisibility(View.VISIBLE); 1023 mLlVouchers.setVisibility(View.VISIBLE);
1024 + } else if (WarplyManagerHelper.getShowVouchersBanner().equals("false")) {
1025 + mLlVouchersSpinner.setVisibility(View.GONE);
1026 + mLlVouchers.setVisibility(View.GONE);
984 } 1027 }
985 } 1028 }
986 } 1029 }
......
...@@ -467,6 +467,22 @@ ...@@ -467,6 +467,22 @@
467 </androidx.constraintlayout.widget.ConstraintLayout> 467 </androidx.constraintlayout.widget.ConstraintLayout>
468 468
469 <LinearLayout 469 <LinearLayout
470 + android:id="@+id/ll_vouchers_spinner"
471 + android:layout_width="match_parent"
472 + android:layout_height="wrap_content"
473 + android:layout_marginTop="32dp"
474 + android:orientation="vertical"
475 + android:gravity="center_horizontal"
476 + android:visibility="gone"
477 + tools:visibility="visible">
478 + <ProgressBar
479 + android:id="@+id/pb_vouchers"
480 + android:layout_width="48dp"
481 + android:layout_height="48dp"
482 + android:theme="@style/progressBarGreen"/>
483 + </LinearLayout>
484 +
485 + <LinearLayout
470 android:id="@+id/ll_vouchers" 486 android:id="@+id/ll_vouchers"
471 android:layout_width="match_parent" 487 android:layout_width="match_parent"
472 android:layout_height="wrap_content" 488 android:layout_height="wrap_content"
......
...@@ -68,4 +68,8 @@ ...@@ -68,4 +68,8 @@
68 <item name="cornerSizeBottomRight">0dp</item> 68 <item name="cornerSizeBottomRight">0dp</item>
69 </style> 69 </style>
70 70
71 + <style name="progressBarGreen" parent="@style/Theme.AppCompat">
72 + <item name="colorAccent">@color/cos_green12</item>
73 + </style>
74 +
71 </resources> 75 </resources>
...\ No newline at end of file ...\ No newline at end of file
......