Panagiotis Triantafyllou

changes for cosmote pass part1

...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
14 tools:node="remove" /> 14 tools:node="remove" />
15 <uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA" /> 15 <uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA" />
16 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> 16 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
17 -<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE_HEALTH" />--> 17 + <!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE_HEALTH" />-->
18 -<!-- <uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />--> 18 + <!-- <uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />-->
19 <uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> 19 <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
20 -<!-- <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />--> 20 + <!-- <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />-->
21 -<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />--> 21 + <!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />-->
22 22
23 <application android:largeHeap="true"> 23 <application android:largeHeap="true">
24 <!-- <meta-data--> 24 <!-- <meta-data-->
...@@ -47,6 +47,12 @@ ...@@ -47,6 +47,12 @@
47 android:theme="@style/SDKAppTheme" /> 47 android:theme="@style/SDKAppTheme" />
48 48
49 <activity 49 <activity
50 + android:name=".activities.MarketPassActivity"
51 + android:exported="false"
52 + android:screenOrientation="portrait"
53 + android:theme="@style/SDKAppTheme" />
54 +
55 + <activity
50 android:name=".activities.LoyaltyHistoryActivity" 56 android:name=".activities.LoyaltyHistoryActivity"
51 android:exported="false" 57 android:exported="false"
52 android:screenOrientation="portrait" 58 android:screenOrientation="portrait"
...@@ -179,11 +185,11 @@ ...@@ -179,11 +185,11 @@
179 185
180 <!-- android:stopWithTask="false"--> 186 <!-- android:stopWithTask="false"-->
181 <!-- android:process=":warplyHealthService"--> 187 <!-- android:process=":warplyHealthService"-->
182 -<!-- <service--> 188 + <!-- <service-->
183 -<!-- android:name=".services.WarplyHealthService"--> 189 + <!-- android:name=".services.WarplyHealthService"-->
184 -<!-- android:exported="false"--> 190 + <!-- android:exported="false"-->
185 -<!-- android:foregroundServiceType="health"--> 191 + <!-- android:foregroundServiceType="health"-->
186 -<!-- android:permission="android.permission.FOREGROUND_SERVICE" />--> 192 + <!-- android:permission="android.permission.FOREGROUND_SERVICE" />-->
187 193
188 <service 194 <service
189 android:name=".services.WarplyBeaconsRangingService" 195 android:name=".services.WarplyBeaconsRangingService"
...@@ -237,14 +243,14 @@ ...@@ -237,14 +243,14 @@
237 android:name=".receivers.WarplyInAppNotificationReceiver" 243 android:name=".receivers.WarplyInAppNotificationReceiver"
238 android:exported="false" /> 244 android:exported="false" />
239 245
240 -<!-- <receiver--> 246 + <!-- <receiver-->
241 -<!-- android:name=".receivers.RestartHealthServiceReceiver"--> 247 + <!-- android:name=".receivers.RestartHealthServiceReceiver"-->
242 -<!-- android:exported="false">--> 248 + <!-- android:exported="false">-->
243 -<!-- <intent-filter>--> 249 + <!-- <intent-filter>-->
244 -<!--&lt;!&ndash; <action android:name="android.intent.action.BOOT_COMPLETED" />&ndash;&gt;--> 250 + <!--&lt;!&ndash; <action android:name="android.intent.action.BOOT_COMPLETED" />&ndash;&gt;-->
245 -<!-- <action android:name="android.intent.action.RESTART" />--> 251 + <!-- <action android:name="android.intent.action.RESTART" />-->
246 -<!-- </intent-filter>--> 252 + <!-- </intent-filter>-->
247 -<!-- </receiver>--> 253 + <!-- </receiver>-->
248 254
249 <!-- <provider--> 255 <!-- <provider-->
250 <!-- android:name=".utils.WarplyProvider"--> 256 <!-- android:name=".utils.WarplyProvider"-->
......
1 +package ly.warp.sdk.activities;
2 +
3 +import android.app.Activity;
4 +import android.content.Intent;
5 +import android.graphics.Bitmap;
6 +import android.graphics.Color;
7 +import android.graphics.Typeface;
8 +import android.os.Bundle;
9 +import android.os.Handler;
10 +import android.os.Looper;
11 +import android.text.SpannableStringBuilder;
12 +import android.text.Spanned;
13 +import android.view.View;
14 +import android.widget.ImageView;
15 +import android.widget.LinearLayout;
16 +import android.widget.RelativeLayout;
17 +import android.widget.TextView;
18 +
19 +import androidx.appcompat.app.AlertDialog;
20 +import androidx.constraintlayout.widget.ConstraintLayout;
21 +import androidx.core.content.res.ResourcesCompat;
22 +import androidx.recyclerview.widget.LinearLayoutManager;
23 +import androidx.recyclerview.widget.RecyclerView;
24 +
25 +import com.google.zxing.BarcodeFormat;
26 +import com.google.zxing.common.BitMatrix;
27 +import com.google.zxing.oned.EAN13Writer;
28 +
29 +import org.greenrobot.eventbus.EventBus;
30 +import org.greenrobot.eventbus.Subscribe;
31 +import org.json.JSONArray;
32 +import org.json.JSONObject;
33 +
34 +import java.io.Serializable;
35 +import java.text.ParseException;
36 +import java.text.SimpleDateFormat;
37 +import java.util.ArrayList;
38 +import java.util.Collections;
39 +import java.util.Date;
40 +import java.util.HashSet;
41 +import java.util.Locale;
42 +import java.util.Set;
43 +
44 +import ly.warp.sdk.R;
45 +import ly.warp.sdk.io.callbacks.CallbackReceiver;
46 +import ly.warp.sdk.io.models.Coupon;
47 +import ly.warp.sdk.io.models.CustomTypefaceSpan;
48 +import ly.warp.sdk.io.models.UnifiedCoupon;
49 +import ly.warp.sdk.utils.WarpUtils;
50 +import ly.warp.sdk.utils.WarplyManagerHelper;
51 +import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
52 +import ly.warp.sdk.utils.managers.WarplyEventBusManager;
53 +import ly.warp.sdk.utils.managers.WarplyManager;
54 +import ly.warp.sdk.views.adapters.ActiveCouponAdapter;
55 +import ly.warp.sdk.views.adapters.MarketCouponAdapter;
56 +
57 +
58 +public class MarketPassActivity extends Activity implements View.OnClickListener {
59 +
60 + // ===========================================================
61 + // Constants
62 + // ===========================================================
63 +
64 + // ===========================================================
65 + // Fields
66 + // ===========================================================
67 +
68 + private ImageView mIvBack, mIvInfo, mIvBarcode;
69 + private TextView mFontHeader, mPassHeader, mPassSubtitle, mTvBarcode, mTvPassCount;
70 +
71 + // ===========================================================
72 + // Methods for/from SuperClass/Interfaces
73 + // ===========================================================
74 +
75 + @Override
76 + public void onCreate(Bundle savedInstanceState) {
77 + super.onCreate(savedInstanceState);
78 + setContentView(R.layout.activity_market_pass);
79 +
80 + mIvBack = findViewById(R.id.iv_coupons_close);
81 + mFontHeader = findViewById(R.id.textView3);
82 + mIvInfo = findViewById(R.id.iv_coupons_info);
83 + mPassHeader = findViewById(R.id.tv_market_header);
84 + mPassSubtitle = findViewById(R.id.tv_market_subtitle);
85 + mTvBarcode = findViewById(R.id.tv_barcode_value);
86 + mIvBarcode = findViewById(R.id.iv_barcode);
87 + mTvPassCount = findViewById(R.id.tv_total_pass_title);
88 +
89 + //TODO: replace with actual value
90 + String passValue = String.format(Locale.GERMAN, "%.00f", 30f);
91 + SpannableStringBuilder sBuilder = new SpannableStringBuilder();
92 + sBuilder.append(String.format(getString(R.string.cos_market_pass_coupons_title), "30"));
93 + Typeface typefaceBold = ResourcesCompat.getFont(this, R.font.peridot_bold);
94 + CustomTypefaceSpan typefaceBoldSpan = new CustomTypefaceSpan(typefaceBold);
95 + sBuilder.setSpan(typefaceBoldSpan, 31, 31 + passValue.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
96 + mTvPassCount.setText(sBuilder, TextView.BufferType.SPANNABLE);
97 +
98 + //TODO: replace with dynmamic barcode
99 + createBarcodeBitmap("4006381333931");
100 +
101 + WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mFontHeader, mPassHeader);
102 + WarpUtils.renderCustomFont(this, R.font.peridot_regular, mPassSubtitle, mTvBarcode, mTvPassCount);
103 +
104 + initViews();
105 + }
106 +
107 + @Override
108 + public void onResume() {
109 + super.onResume();
110 + WarplyAnalyticsManager.logTrackersEvent(this, "screen", "MarketPassScreen");
111 + }
112 +
113 + @Override
114 + public void onClick(View view) {
115 + if (view.getId() == R.id.iv_coupons_close) {
116 + onBackPressed();
117 + return;
118 + }
119 + if (view.getId() == R.id.iv_coupons_info) {
120 + //TODO
121 + }
122 + }
123 +
124 + // ===========================================================
125 + // Methods
126 + // ===========================================================
127 +
128 + private void initViews() {
129 + mIvBack.setOnClickListener(this);
130 + mIvInfo.setOnClickListener(this);
131 + }
132 +
133 + private void createBarcodeBitmap(String barcodeString) {
134 + EAN13Writer writer = new EAN13Writer();
135 + try {
136 + BitMatrix bitMatrix = writer.encode(barcodeString, BarcodeFormat.EAN_13, 1024, 512);
137 + int width = bitMatrix.getWidth();
138 + int height = bitMatrix.getHeight();
139 + Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
140 + for (int x = 0; x < width; x++) {
141 + for (int y = 0; y < height; y++) {
142 + bmp.setPixel(x, y, bitMatrix.get(x, y) ? Color.BLACK : Color.WHITE);
143 + }
144 + }
145 + mIvBarcode.setImageBitmap(bmp);
146 + mTvBarcode.setText(barcodeString);
147 +
148 + } catch (Exception e) {
149 + e.printStackTrace();
150 + }
151 + }
152 +
153 + // ===========================================================
154 + // Inner and Anonymous Classes
155 + // ===========================================================
156 +}
...@@ -30,10 +30,10 @@ import java.util.Collections; ...@@ -30,10 +30,10 @@ import java.util.Collections;
30 30
31 import ly.warp.sdk.R; 31 import ly.warp.sdk.R;
32 import ly.warp.sdk.activities.ActiveCouponsActivity; 32 import ly.warp.sdk.activities.ActiveCouponsActivity;
33 -import ly.warp.sdk.activities.ActiveUnifiedCouponsActivity;
34 import ly.warp.sdk.activities.LoyaltyAnalysisActivity; 33 import ly.warp.sdk.activities.LoyaltyAnalysisActivity;
35 import ly.warp.sdk.activities.LoyaltyHistoryActivity; 34 import ly.warp.sdk.activities.LoyaltyHistoryActivity;
36 import ly.warp.sdk.activities.LoyaltyMarketAnalysisActivity; 35 import ly.warp.sdk.activities.LoyaltyMarketAnalysisActivity;
36 +import ly.warp.sdk.activities.MarketPassActivity;
37 import ly.warp.sdk.activities.WarpViewActivity; 37 import ly.warp.sdk.activities.WarpViewActivity;
38 import ly.warp.sdk.io.models.ActiveBoxCouponEventModel; 38 import ly.warp.sdk.io.models.ActiveBoxCouponEventModel;
39 import ly.warp.sdk.io.models.ActiveDFYCouponEventModel; 39 import ly.warp.sdk.io.models.ActiveDFYCouponEventModel;
...@@ -614,7 +614,7 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener ...@@ -614,7 +614,7 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener
614 analyticsEvent.setParameter("screen", "Loyalty Wallet"); 614 analyticsEvent.setParameter("screen", "Loyalty Wallet");
615 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); 615 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
616 616
617 - Intent intent = new Intent(getContext(), ActiveUnifiedCouponsActivity.class); 617 + Intent intent = new Intent(getContext(), MarketPassActivity.class);
618 startActivity(intent); 618 startActivity(intent);
619 } 619 }
620 }); 620 });
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android">
3 + <solid android:color="@color/white" />
4 + <stroke
5 + android:width="2dp"
6 + android:color="@color/cos_light_grey4" />
7 + <corners android:radius="16dp" />
8 +</shape>
...\ 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:id="@+id/cl_bill_payment"
6 + android:layout_width="match_parent"
7 + android:layout_height="match_parent"
8 + android:background="@color/cos_light_grey3">
9 +
10 + <androidx.constraintlayout.widget.ConstraintLayout
11 + android:id="@+id/cl_bill_header"
12 + android:layout_width="match_parent"
13 + android:layout_height="64dp"
14 + android:background="@color/white"
15 + app:layout_constraintEnd_toEndOf="parent"
16 + app:layout_constraintStart_toStartOf="parent"
17 + app:layout_constraintTop_toTopOf="parent">
18 +
19 + <ImageView
20 + android:id="@+id/iv_coupons_close"
21 + android:layout_width="48dp"
22 + android:layout_height="48dp"
23 + android:layout_marginStart="16dp"
24 + android:scaleType="centerInside"
25 + android:src="@drawable/ic_back"
26 + app:layout_constraintBottom_toBottomOf="parent"
27 + app:layout_constraintStart_toStartOf="parent"
28 + app:layout_constraintTop_toTopOf="parent" />
29 +
30 + <TextView
31 + android:id="@+id/textView3"
32 + android:layout_width="wrap_content"
33 + android:layout_height="wrap_content"
34 + android:gravity="center"
35 + android:text="@string/cos_market_title"
36 + android:textColor="@color/cos_light_black"
37 + android:textSize="19sp"
38 + app:layout_constraintBottom_toBottomOf="parent"
39 + app:layout_constraintEnd_toEndOf="parent"
40 + app:layout_constraintStart_toStartOf="parent"
41 + app:layout_constraintTop_toTopOf="parent" />
42 +
43 + <ImageView
44 + android:id="@+id/iv_coupons_info"
45 + android:layout_width="48dp"
46 + android:layout_height="48dp"
47 + android:layout_marginEnd="16dp"
48 + android:padding="12dp"
49 + android:scaleType="centerInside"
50 + android:src="@drawable/ic_info"
51 + app:layout_constraintBottom_toBottomOf="parent"
52 + app:layout_constraintEnd_toEndOf="parent"
53 + app:layout_constraintTop_toTopOf="parent" />
54 + </androidx.constraintlayout.widget.ConstraintLayout>
55 +
56 + <ScrollView
57 + android:layout_width="match_parent"
58 + android:layout_height="0dp"
59 + app:layout_constraintBottom_toBottomOf="parent"
60 + app:layout_constraintEnd_toEndOf="parent"
61 + app:layout_constraintStart_toStartOf="parent"
62 + app:layout_constraintTop_toBottomOf="@+id/cl_bill_header">
63 +
64 + <RelativeLayout
65 + android:layout_width="match_parent"
66 + android:layout_height="wrap_content">
67 +
68 + <androidx.cardview.widget.CardView
69 + android:layout_width="match_parent"
70 + android:layout_height="wrap_content"
71 + android:layout_marginHorizontal="16dp"
72 + android:layout_marginVertical="24dp"
73 + app:cardBackgroundColor="@android:color/white"
74 + app:cardCornerRadius="16dp"
75 + app:cardElevation="3dp">
76 +
77 + <RelativeLayout
78 + android:layout_width="match_parent"
79 + android:layout_height="wrap_content">
80 +
81 + <RelativeLayout
82 + android:id="@+id/rl_parent_pass"
83 + android:layout_width="match_parent"
84 + android:layout_height="wrap_content"
85 + android:background="@color/cos_green13"
86 + android:paddingHorizontal="24dp"
87 + android:paddingTop="24dp">
88 +
89 + <TextView
90 + android:id="@+id/tv_market_header"
91 + android:layout_width="wrap_content"
92 + android:layout_height="wrap_content"
93 + android:letterSpacing="0.032"
94 + android:text="@string/cos_market_pass_title"
95 + android:textColor="@color/white"
96 + android:textSize="20sp" />
97 +
98 + <TextView
99 + android:id="@+id/tv_market_subtitle"
100 + android:layout_width="wrap_content"
101 + android:layout_height="wrap_content"
102 + android:layout_below="@+id/tv_market_header"
103 + android:layout_marginTop="16dp"
104 + android:letterSpacing="0.04"
105 + android:text="@string/cos_market_pass_subtitle"
106 + android:textColor="@color/white"
107 + android:textSize="16sp"
108 + app:lineHeight="22dp" />
109 +
110 + <LinearLayout
111 + android:id="@+id/ll_barcode"
112 + android:layout_width="match_parent"
113 + android:layout_height="wrap_content"
114 + android:layout_below="@+id/tv_market_subtitle"
115 + android:layout_marginTop="42dp"
116 + android:layout_marginBottom="36dp"
117 + android:background="@drawable/background_white_grey_border"
118 + android:gravity="center"
119 + android:orientation="vertical"
120 + android:paddingVertical="12dp">
121 +
122 + <ImageView
123 + android:id="@+id/iv_barcode"
124 + android:layout_width="match_parent"
125 + android:layout_height="82dp"
126 + android:layout_marginHorizontal="8dp"
127 + android:layout_marginTop="4dp"
128 + android:scaleType="fitXY"
129 + tools:srcCompat="@tools:sample/avatars" />
130 +
131 + <TextView
132 + android:id="@+id/tv_barcode_value"
133 + android:layout_width="wrap_content"
134 + android:layout_height="wrap_content"
135 + android:layout_marginTop="10dp"
136 + android:layout_marginBottom="2dp"
137 + android:letterSpacing="0.00074"
138 + android:textColor="@color/cos_light_black"
139 + android:textSize="18sp" />
140 + </LinearLayout>
141 + </RelativeLayout>
142 +
143 + <LinearLayout
144 + android:layout_width="match_parent"
145 + android:layout_height="wrap_content"
146 + android:layout_below="@+id/rl_parent_pass"
147 + android:background="@color/cos_green14"
148 + android:gravity="center"
149 + android:paddingVertical="16dp">
150 +
151 + <TextView
152 + android:id="@+id/tv_total_pass_title"
153 + android:layout_width="wrap_content"
154 + android:layout_height="wrap_content"
155 + android:letterSpacing="0.04"
156 + android:includeFontPadding="false"
157 + android:textColor="@color/white"
158 + android:textSize="16sp"
159 + app:lineHeight="22dp" />
160 + </LinearLayout>
161 + </RelativeLayout>
162 + </androidx.cardview.widget.CardView>
163 + </RelativeLayout>
164 + </ScrollView>
165 +</androidx.constraintlayout.widget.ConstraintLayout>
...\ No newline at end of file ...\ No newline at end of file
...@@ -81,4 +81,7 @@ ...@@ -81,4 +81,7 @@
81 <color name="cos_creme">#FEFCF7</color> 81 <color name="cos_creme">#FEFCF7</color>
82 <color name="cos_skyblue5">#F4F8FB</color> 82 <color name="cos_skyblue5">#F4F8FB</color>
83 <color name="cos_skyblue6">#0099CC</color> 83 <color name="cos_skyblue6">#0099CC</color>
84 + <color name="cos_green13">#36B32B</color>
85 + <color name="cos_light_grey4">#DADDE4</color>
86 + <color name="cos_green14">#006D26</color>
84 </resources> 87 </resources>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -180,6 +180,9 @@ ...@@ -180,6 +180,9 @@
180 <string name="cos_dlg_no_shops_positive">Δες το eshop</string> 180 <string name="cos_dlg_no_shops_positive">Δες το eshop</string>
181 <string name="cos_profile_preferences_placeholder">Οι προτιμήσεις μου</string> 181 <string name="cos_profile_preferences_placeholder">Οι προτιμήσεις μου</string>
182 <string name="cos_market_title">SUPERMARKET DEALS</string> 182 <string name="cos_market_title">SUPERMARKET DEALS</string>
183 + <string name="cos_market_pass_title">SUPERMARKET DEALS CARD</string>
184 + <string name="cos_market_pass_subtitle">Χρησιμοποίησε τον κωδικό σου και κέρδισε έκπτωση στις αγορές σου!</string>
185 + <string name="cos_market_pass_coupons_title">Έχεις κουπόνια συνολικής αξίας %1$s€</string>
183 <string name="cos_market_subtitle">Δημιούργησε το δικό σου ενιαίο κουπόνι προσφορών, και εξαργύρωσέ το στα supermarket της επιλογής σου γρήγορα και εύκολα με ένα μόνο κωδικό κουπονιού!</string> 186 <string name="cos_market_subtitle">Δημιούργησε το δικό σου ενιαίο κουπόνι προσφορών, και εξαργύρωσέ το στα supermarket της επιλογής σου γρήγορα και εύκολα με ένα μόνο κωδικό κουπονιού!</string>
184 <string name="cos_market_close">Τέλος</string> 187 <string name="cos_market_close">Τέλος</string>
185 <string name="cos_rewards_title2">COSMOTE Επιβράβευση</string> 188 <string name="cos_rewards_title2">COSMOTE Επιβράβευση</string>
......