Panagiotis Triantafyllou

vouchers part4

...@@ -42,6 +42,12 @@ ...@@ -42,6 +42,12 @@
42 android:theme="@style/SDKAppTheme" /> 42 android:theme="@style/SDKAppTheme" />
43 43
44 <activity 44 <activity
45 + android:name="ly.warp.sdk.activities.LoyaltyHistoryActivity"
46 + android:exported="false"
47 + android:screenOrientation="portrait"
48 + android:theme="@style/SDKAppTheme" />
49 +
50 + <activity
45 android:name="ly.warp.sdk.activities.CouponInfoActivity" 51 android:name="ly.warp.sdk.activities.CouponInfoActivity"
46 android:exported="false" 52 android:exported="false"
47 android:screenOrientation="portrait" 53 android:screenOrientation="portrait"
......
1 +package ly.warp.sdk.activities;
2 +
3 +import android.app.Activity;
4 +import android.content.Context;
5 +import android.os.Bundle;
6 +import android.os.Handler;
7 +import android.view.View;
8 +import android.widget.ImageView;
9 +import android.widget.TextView;
10 +
11 +import androidx.cardview.widget.CardView;
12 +import androidx.core.content.ContextCompat;
13 +
14 +import org.greenrobot.eventbus.EventBus;
15 +
16 +import io.github.inflationx.viewpump.ViewPumpContextWrapper;
17 +import ly.warp.sdk.R;
18 +import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
19 +import ly.warp.sdk.utils.WarplyManagerHelper;
20 +import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
21 +import ly.warp.sdk.utils.managers.WarplyEventBusManager;
22 +
23 +
24 +public class LoyaltyHistoryActivity extends Activity implements View.OnClickListener {
25 +
26 + // ===========================================================
27 + // Constants
28 + // ===========================================================
29 +
30 + // ===========================================================
31 + // Fields
32 + // ===========================================================
33 +
34 + private ImageView mIvBack;
35 + private int mTimer = 0;
36 + private Handler mSecondsHandler;
37 + private TextView mTvFavValue, mTvDealsValue;
38 + private float mFavValue = 0.0f;
39 +
40 + // ===========================================================
41 + // Methods for/from SuperClass/Interfaces
42 + // ===========================================================
43 +
44 + @Override
45 + public void onCreate(Bundle savedInstanceState) {
46 + super.onCreate(savedInstanceState);
47 + setContentView(R.layout.activity_loyalty_history);
48 + mSecondsHandler = new Handler();
49 +
50 + mIvBack = findViewById(R.id.iv_loyalty_history_close);
51 + mTvFavValue = findViewById(R.id.tv_exp_value);
52 + mTvDealsValue = findViewById(R.id.tv_deals_value);
53 +
54 + initViews();
55 + }
56 +
57 + @Override
58 + public void onResume() {
59 + super.onResume();
60 + WarplyAnalyticsManager.logTrackersEvent(this, "screen", "HistoryScreen");
61 + mTimer = 0;
62 + mSecondsHandler.post(new Runnable() {
63 + @Override
64 + public void run() {
65 + mTimer++;
66 + mSecondsHandler.postDelayed(this, 1000);
67 + }
68 + });
69 + }
70 +
71 + @Override
72 + public void onPause() {
73 + super.onPause();
74 + if (mSecondsHandler != null) {
75 + mSecondsHandler.removeCallbacksAndMessages(null);
76 +
77 + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
78 + analyticsEvent.setEventName("time_spent_on_loyalty_sdk");
79 + analyticsEvent.setParameter("name", "History");
80 + analyticsEvent.setParameter("seconds", String.valueOf(mTimer));
81 + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
82 + }
83 + }
84 +
85 + @Override
86 + public void onClick(View view) {
87 + if (view.getId() == R.id.iv_loyalty_analysis_close) {
88 + onBackPressed();
89 + return;
90 + }
91 + }
92 +
93 + @Override
94 + protected void attachBaseContext(Context newBase) {
95 + super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
96 + }
97 +
98 + // ===========================================================
99 + // Methods
100 + // ===========================================================
101 +
102 + private void initViews() {
103 + mIvBack.setOnClickListener(this);
104 +
105 + /** First Banner */
106 + String badgeValueFirst = String.format("%.02f", WarplyManagerHelper.getDealsCouponsSum());
107 + mTvDealsValue.setText(String.format(getString(R.string.cos_value), badgeValueFirst));
108 + if (String.valueOf(WarplyManagerHelper.getDealsCouponsSum()).length() >= 3) {
109 + mTvDealsValue.setTextSize(12);
110 + } else {
111 + mTvDealsValue.setTextSize(14);
112 + }
113 +// SpannableStringBuilder sBuilder = new SpannableStringBuilder();
114 +// sBuilder.append(String.format(getString(R.string.cos_deals_win_title_cos), badgeValueFirst));
115 +// CalligraphyTypefaceSpan typefaceBoldSpanFirst = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
116 +// sBuilder.setSpan(typefaceBoldSpanFirst, 15, 16 + badgeValueFirst.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
117 +// mTvDealsValueAll.setText(sBuilder, TextView.BufferType.SPANNABLE);
118 + mFavValue += WarplyManagerHelper.getDealsCouponsSum();
119 + /** First Banner */
120 +
121 + /** Sum Banner */
122 + String allValue = String.format("%.02f", mFavValue);
123 + mTvFavValue.setText(String.format(getString(R.string.cos_value), allValue));
124 + /** Sum Banner */
125 + }
126 +
127 + // ===========================================================
128 + // Inner and Anonymous Classes
129 + // ===========================================================
130 +}
...@@ -157,7 +157,7 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl ...@@ -157,7 +157,7 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl
157 mSecondsHandler.removeCallbacksAndMessages(null); 157 mSecondsHandler.removeCallbacksAndMessages(null);
158 LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); 158 LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
159 analyticsEvent.setEventName("time_spent_on_loyalty_sdk"); 159 analyticsEvent.setEventName("time_spent_on_loyalty_sdk");
160 - analyticsEvent.setParameter("name", "GiftsCalculator"); 160 + analyticsEvent.setParameter("name", "MarketCalculator");
161 analyticsEvent.setParameter("seconds", String.valueOf(mTimer)); 161 analyticsEvent.setParameter("seconds", String.valueOf(mTimer));
162 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); 162 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
163 } 163 }
......
...@@ -379,7 +379,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -379,7 +379,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
379 analyticsEvent.setParameter("screen", "Loyalty Wallet"); 379 analyticsEvent.setParameter("screen", "Loyalty Wallet");
380 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); 380 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
381 381
382 - //TODO: add new history intent 382 + Intent intent = new Intent(LoyaltyWallet.this, LoyaltyHistoryActivity.class);
383 + startActivity(intent);
383 } 384 }
384 return; 385 return;
385 } 386 }
...@@ -450,16 +451,19 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -450,16 +451,19 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
450 @Subscribe() 451 @Subscribe()
451 public void onMessageEvent(WarplyEventBusManager event) { 452 public void onMessageEvent(WarplyEventBusManager event) {
452 if (event.getVouchersFetched() != null) { 453 if (event.getVouchersFetched() != null) {
453 - if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) { 454 +// if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
454 - runOnUiThread(() -> { 455 +// runOnUiThread(() -> {
455 - mLlVouchersSpinner.setVisibility(View.GONE); 456 +// mLlVouchersSpinner.setVisibility(View.GONE);
456 - mLlVouchers.setVisibility(View.VISIBLE); 457 +// mLlVouchers.setVisibility(View.VISIBLE);
457 - }); 458 +// });
458 - } else { 459 +// } else {
459 - runOnUiThread(() -> { 460 +// runOnUiThread(() -> {
460 - mLlVouchersSpinner.setVisibility(View.GONE); 461 +// mLlVouchersSpinner.setVisibility(View.GONE);
461 - }); 462 +// });
462 - } 463 +// }
464 + /** Empty View */
465 + runOnUiThread(this::checkForEmpty);
466 + /** Empty View */
463 return; 467 return;
464 } 468 }
465 if (event.getUnifiedCouponsAdded() != null) { 469 if (event.getUnifiedCouponsAdded() != null) {
...@@ -624,10 +628,6 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -624,10 +628,6 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
624 mTvGiftsCountBadge.setText("0"); 628 mTvGiftsCountBadge.setText("0");
625 }); 629 });
626 } 630 }
627 -
628 - /** Empty View */
629 - runOnUiThread(this::checkForEmpty);
630 - /** Empty View */
631 } 631 }
632 632
633 @Override 633 @Override
...@@ -640,15 +640,15 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -640,15 +640,15 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
640 // =========================================================== 640 // ===========================================================
641 641
642 private void initViews() { 642 private void initViews() {
643 - if (TextUtils.isEmpty(WarplyManagerHelper.getShowVouchersBanner())) { 643 +// if (TextUtils.isEmpty(WarplyManagerHelper.getShowVouchersBanner())) {
644 - //TODO: show spinner 644 +// //TODO: show spinner
645 - } else if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) { 645 +// } else if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
646 - //TODO: hide spinner 646 +// //TODO: hide spinner
647 - mLlVouchers.setVisibility(View.VISIBLE); 647 +// mLlVouchers.setVisibility(View.VISIBLE);
648 - } else { 648 +// } else {
649 - //.equals("false) 649 +// //.equals("false)
650 - //TODO: hide spinner 650 +// //TODO: hide spinner
651 - } 651 +// }
652 652
653 if (WarpUtils.getUserNonTelco(this)) { 653 if (WarpUtils.getUserNonTelco(this)) {
654 nonTelcoDialog(); 654 nonTelcoDialog();
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="rectangle">
4 +
5 + <item>
6 + <shape>
7 + <!-- set the shadow color here -->
8 + <stroke
9 + android:width="1.5dp"
10 + android:color="#24000000" />
11 +
12 + <!-- setting the thickness of shadow (positive value will give shadow on that side) -->
13 + <padding
14 + android:bottom="2dp"
15 + android:left="0dp"
16 + android:right="-1dp"
17 + android:top="-1dp" />
18 +
19 + <corners
20 + android:bottomRightRadius="16dp"
21 + android:topLeftRadius="24dp"
22 + android:topRightRadius="16dp" />
23 + </shape>
24 + </item>
25 +
26 + <!-- Background -->
27 + <item>
28 + <shape>
29 + <solid android:color="@color/cos_green_tr" />
30 + <corners
31 + android:bottomRightRadius="16dp"
32 + android:topLeftRadius="24dp"
33 + android:topRightRadius="16dp" />
34 + </shape>
35 + </item>
36 +</layer-list>
...\ No newline at end of file ...\ No newline at end of file
1 +<vector android:height="64dp" android:viewportHeight="32"
2 + android:viewportWidth="32" android:width="64dp" xmlns:android="http://schemas.android.com/apk/res/android">
3 + <path android:fillColor="#00A5E3" android:fillType="evenOdd" android:pathData="M12.667,10.333C10.754,10.333 9.267,11.821 9.267,13.729C9.267,14.911 9.79,16.062 10.915,17.437C12.053,18.826 13.698,20.319 15.778,22.204L15.78,22.205C16.058,22.458 16.482,22.458 16.756,22.212C18.835,20.323 20.48,18.828 21.618,17.438C22.744,16.062 23.267,14.911 23.267,13.729C23.267,11.821 21.779,10.333 19.867,10.333C18.777,10.333 17.716,10.845 17.028,11.653L16.267,12.545L15.506,11.653C14.817,10.845 13.756,10.333 12.667,10.333ZM18.097,23.695C17.054,24.636 15.468,24.625 14.434,23.685L14.375,23.632C12.361,21.806 10.608,20.219 9.368,18.704C8.104,17.16 7.267,15.569 7.267,13.729C7.267,10.714 9.651,8.333 12.667,8.333C13.993,8.333 15.269,8.813 16.267,9.616C17.264,8.813 18.54,8.333 19.867,8.333C22.882,8.333 25.267,10.714 25.267,13.729C25.267,15.569 24.43,17.16 23.166,18.705C21.929,20.216 20.185,21.8 18.179,23.621L18.099,23.693L18.097,23.695Z"/>
4 + <path android:fillColor="#00A5E3" android:pathData="M30,16C30,23.732 23.732,30 16,30V32C24.837,32 32,24.837 32,16H30Z"/>
5 + <path android:fillColor="#00A5E3" android:pathData="M0,16H2C2,8.268 8.268,2 16,2V0C7.163,0 0,7.163 0,16Z"/>
6 +</vector>
...@@ -198,7 +198,7 @@ ...@@ -198,7 +198,7 @@
198 <androidx.constraintlayout.widget.ConstraintLayout 198 <androidx.constraintlayout.widget.ConstraintLayout
199 android:layout_width="match_parent" 199 android:layout_width="match_parent"
200 android:layout_height="wrap_content" 200 android:layout_height="wrap_content"
201 - android:layout_marginTop="20dp"> 201 + android:layout_marginTop="18dp">
202 202
203 <RelativeLayout 203 <RelativeLayout
204 android:id="@+id/rv_deals_count" 204 android:id="@+id/rv_deals_count"
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
214 android:layout_width="match_parent" 214 android:layout_width="match_parent"
215 android:layout_height="match_parent" 215 android:layout_height="match_parent"
216 android:layout_marginHorizontal="2dp" 216 android:layout_marginHorizontal="2dp"
217 - android:layout_marginVertical="2dp" 217 + android:layout_marginVertical="4dp"
218 app:cardCornerRadius="16dp" 218 app:cardCornerRadius="16dp"
219 app:cardElevation="2dp"> 219 app:cardElevation="2dp">
220 220
...@@ -303,7 +303,7 @@ ...@@ -303,7 +303,7 @@
303 android:layout_width="match_parent" 303 android:layout_width="match_parent"
304 android:layout_height="match_parent" 304 android:layout_height="match_parent"
305 android:layout_marginHorizontal="2dp" 305 android:layout_marginHorizontal="2dp"
306 - android:layout_marginVertical="2dp" 306 + android:layout_marginVertical="4dp"
307 app:cardCornerRadius="16dp" 307 app:cardCornerRadius="16dp"
308 app:cardElevation="2dp"> 308 app:cardElevation="2dp">
309 309
...@@ -391,7 +391,7 @@ ...@@ -391,7 +391,7 @@
391 android:layout_width="match_parent" 391 android:layout_width="match_parent"
392 android:layout_height="match_parent" 392 android:layout_height="match_parent"
393 android:layout_marginHorizontal="2dp" 393 android:layout_marginHorizontal="2dp"
394 - android:layout_marginVertical="2dp" 394 + android:layout_marginVertical="4dp"
395 app:cardCornerRadius="16dp" 395 app:cardCornerRadius="16dp"
396 app:cardElevation="2dp"> 396 app:cardElevation="2dp">
397 397
......
...@@ -202,6 +202,9 @@ ...@@ -202,6 +202,9 @@
202 <string name="cos_dlg_positive_button3">Ναι</string> 202 <string name="cos_dlg_positive_button3">Ναι</string>
203 <string name="cos_vouchers_title">Υπόλοιπο επιδότησης</string> 203 <string name="cos_vouchers_title">Υπόλοιπο επιδότησης</string>
204 <string name="cos_vouchers_info_title">Ενημερώσου για το υπόλοιπο επιδότησης</string> 204 <string name="cos_vouchers_info_title">Ενημερώσου για το υπόλοιπο επιδότησης</string>
205 + <string name="cos_loyalty_history">Ιστορικό</string>
206 + <string name="cos_redeemed_coupons_loyalty_title">Εξαργυρωμένα κουπόνια</string>
207 + <string name="cos_history_info_text">Δες αναλυτικά το συνολικό όφελός σου έως τώρα από κουπόνια</string>
205 208
206 <string-array name="coupons_array"> 209 <string-array name="coupons_array">
207 <item>Κουπόνια</item> 210 <item>Κουπόνια</item>
......