Panagiotis Triantafyllou

more screens and changes

Showing 37 changed files with 1586 additions and 190 deletions
...@@ -10,6 +10,7 @@ import java.util.TimerTask; ...@@ -10,6 +10,7 @@ import java.util.TimerTask;
10 10
11 import ly.warp.sdk.Warply; 11 import ly.warp.sdk.Warply;
12 import ly.warp.sdk.activities.BaseFragmentActivity; 12 import ly.warp.sdk.activities.BaseFragmentActivity;
13 +import ly.warp.sdk.db.WarplyDBHelper;
13 import ly.warp.sdk.io.callbacks.CallbackReceiver; 14 import ly.warp.sdk.io.callbacks.CallbackReceiver;
14 import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver; 15 import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver;
15 import ly.warp.sdk.io.callbacks.WarplyReadyCallback; 16 import ly.warp.sdk.io.callbacks.WarplyReadyCallback;
...@@ -31,11 +32,15 @@ public class SplashActivity extends BaseActivity { ...@@ -31,11 +32,15 @@ public class SplashActivity extends BaseActivity {
31 mWarplyInitializer = Warply.getInitializer(this, new WarplyReadyCallback() { 32 mWarplyInitializer = Warply.getInitializer(this, new WarplyReadyCallback() {
32 @Override 33 @Override
33 public void onWarplyReady() { 34 public void onWarplyReady() {
34 - WarplyManager.login(new WarplyLoginRequest() 35 + if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
35 - .setId("6981234567") 36 + WarplyManager.login(new WarplyLoginRequest()
36 - .setPassword("123456"), 37 + .setId("6981234567")
37 - mLoginReceiver 38 + .setPassword("123456"),
38 - ); 39 + mLoginReceiver
40 + );
41 + } else {
42 + startNextActivity();
43 + }
39 } 44 }
40 45
41 @Override 46 @Override
......
...@@ -46,7 +46,7 @@ dependencies { ...@@ -46,7 +46,7 @@ dependencies {
46 api 'com.google.android.material:material:1.5.0' 46 api 'com.google.android.material:material:1.5.0'
47 api group: 'com.google.zxing', name: 'core', version: '3.4.1' 47 api group: 'com.google.zxing', name: 'core', version: '3.4.1'
48 api group: 'com.google.zxing', name: 'javase', version: '3.4.1' 48 api group: 'com.google.zxing', name: 'javase', version: '3.4.1'
49 - 49 + api 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
50 50
51 51
52 //------------------------------ Firebase -----------------------------// 52 //------------------------------ Firebase -----------------------------//
......
...@@ -47,6 +47,21 @@ ...@@ -47,6 +47,21 @@
47 android:screenOrientation="portrait" /> 47 android:screenOrientation="portrait" />
48 48
49 <activity 49 <activity
50 + android:name="ly.warp.sdk.activities.ActiveCouponsActivity"
51 + android:exported="false"
52 + android:screenOrientation="portrait" />
53 +
54 + <activity
55 + android:name="ly.warp.sdk.activities.ListForYouActivity"
56 + android:exported="false"
57 + android:screenOrientation="portrait" />
58 +
59 + <activity
60 + android:name="ly.warp.sdk.activities.CouponsetInfoActivity"
61 + android:exported="false"
62 + android:screenOrientation="portrait" />
63 +
64 + <activity
50 android:name="ly.warp.sdk.dexter.PermissionsActivity" 65 android:name="ly.warp.sdk.dexter.PermissionsActivity"
51 android:exported="false" 66 android:exported="false"
52 android:launchMode="singleInstance" 67 android:launchMode="singleInstance"
......
1 +package ly.warp.sdk.activities;
2 +
3 +import android.app.Activity;
4 +import android.content.Intent;
5 +import android.os.Bundle;
6 +import android.view.View;
7 +import android.widget.ImageView;
8 +import android.widget.TextView;
9 +
10 +import androidx.recyclerview.widget.LinearLayoutManager;
11 +import androidx.recyclerview.widget.RecyclerView;
12 +
13 +import java.io.Serializable;
14 +
15 +import ly.warp.sdk.R;
16 +import ly.warp.sdk.io.models.CouponList;
17 +import ly.warp.sdk.views.adapters.mix.ActiveCouponAdapter;
18 +
19 +
20 +public class ActiveCouponsActivity extends Activity implements View.OnClickListener {
21 +
22 + // ===========================================================
23 + // Constants
24 + // ===========================================================
25 +
26 + // ===========================================================
27 + // Fields
28 + // ===========================================================
29 +
30 + private ImageView mIvBack;
31 + private RecyclerView mRecyclerCoupons;
32 + private ActiveCouponAdapter mAdapterCoupons;
33 + private CouponList mCouponList = new CouponList();
34 + private TextView mTvEmptyCoupons;
35 +
36 + // ===========================================================
37 + // Methods for/from SuperClass/Interfaces
38 + // ===========================================================
39 +
40 + @Override
41 + public void onCreate(Bundle savedInstanceState) {
42 + super.onCreate(savedInstanceState);
43 + setContentView(R.layout.activity_active_coupons);
44 +
45 + if (getIntent().getExtras() != null && getIntent().getSerializableExtra("couponlist") != null) {
46 + mCouponList = new CouponList(getIntent().getSerializableExtra("couponlist").toString(), true);
47 + }
48 +
49 + mIvBack = findViewById(R.id.iv_coupons_close);
50 + mTvEmptyCoupons = findViewById(R.id.tv_no_coupons);
51 +
52 + if (mCouponList != null) {
53 + mRecyclerCoupons = findViewById(R.id.rv_active_coupons);
54 + mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
55 + mAdapterCoupons = new ActiveCouponAdapter(this, mCouponList);
56 + mRecyclerCoupons.setAdapter(mAdapterCoupons);
57 + mAdapterCoupons.getPositionClicks()
58 + .doOnNext(coupon -> {
59 + Intent intent = new Intent(ActiveCouponsActivity.this, CouponInfoActivity.class);
60 + intent.putExtra("coupon", (Serializable) coupon);
61 + startActivity(intent);
62 + })
63 + .doOnError(error -> {
64 + })
65 + .subscribe();
66 + } else {
67 + mTvEmptyCoupons.setVisibility(View.VISIBLE);
68 + }
69 +
70 + initViews();
71 + }
72 +
73 + @Override
74 + public void onResume() {
75 + super.onResume();
76 + }
77 +
78 + @Override
79 + public void onClick(View view) {
80 + if (view.getId() == R.id.iv_coupons_close) {
81 + onBackPressed();
82 + }
83 + }
84 +
85 + // ===========================================================
86 + // Methods
87 + // ===========================================================
88 +
89 + private void initViews() {
90 + mIvBack.setOnClickListener(this);
91 + }
92 +
93 + // ===========================================================
94 + // Inner and Anonymous Classes
95 + // ===========================================================
96 +
97 +}
...@@ -37,6 +37,7 @@ import ly.warp.sdk.io.request.WarplyGetCouponsetsRequest; ...@@ -37,6 +37,7 @@ import ly.warp.sdk.io.request.WarplyGetCouponsetsRequest;
37 import ly.warp.sdk.io.request.WarplyInboxRequest; 37 import ly.warp.sdk.io.request.WarplyInboxRequest;
38 import ly.warp.sdk.io.request.WarplyUserCouponsRequest; 38 import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
39 import ly.warp.sdk.utils.WarpUtils; 39 import ly.warp.sdk.utils.WarpUtils;
40 +import ly.warp.sdk.utils.WarplyManagerHelper;
40 import ly.warp.sdk.utils.WarplyProperty; 41 import ly.warp.sdk.utils.WarplyProperty;
41 import ly.warp.sdk.utils.managers.WarplyManager; 42 import ly.warp.sdk.utils.managers.WarplyManager;
42 import ly.warp.sdk.utils.managers.WarplySessionManager; 43 import ly.warp.sdk.utils.managers.WarplySessionManager;
...@@ -55,7 +56,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -55,7 +56,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
55 private Fragment mFragmentToSet = null; 56 private Fragment mFragmentToSet = null;
56 private static Consumer mConsumer; 57 private static Consumer mConsumer;
57 private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>(); 58 private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>();
58 - private static CouponList mCouponList = new CouponList();
59 private CouponsetsList mCouponsetsList; 59 private CouponsetsList mCouponsetsList;
60 60
61 // =========================================================== 61 // ===========================================================
...@@ -147,17 +147,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -147,17 +147,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
147 mLlRedeem.setOnClickListener(view -> { 147 mLlRedeem.setOnClickListener(view -> {
148 if (mUniqueCampaignList != null && !mUniqueCampaignList.isEmpty()) { 148 if (mUniqueCampaignList != null && !mUniqueCampaignList.isEmpty()) {
149 if (mUniqueCampaignList.containsKey("lucky_draw") && mUniqueCampaignList.get("lucky_draw").size() > 0) { 149 if (mUniqueCampaignList.containsKey("lucky_draw") && mUniqueCampaignList.get("lucky_draw").size() > 0) {
150 - String tempUrl = mUniqueCampaignList.get("lucky_draw").get(0).getIndexUrl(); 150 + String tempUrl = WarplyManagerHelper.constructCampaignUrl(mUniqueCampaignList.get("lucky_draw").get(0));
151 -
152 - tempUrl = tempUrl
153 - + "?web_id=" + WarpUtils.getWebId(this)
154 - + "&app_uuid=" + WarplyProperty.getAppUuid(this)
155 - + "&api_key=" + WarpUtils.getApiKey(this)
156 - + "&session_uuid=" + mUniqueCampaignList.get("lucky_draw").get(0).getSessionUUID()
157 - + "&access_token=" + WarplyDBHelper.getInstance(this).getAuthValue("access_token")
158 - + "&refresh_token=" + WarplyDBHelper.getInstance(this).getAuthValue("refresh_token")
159 - + "&client_id=" + WarplyDBHelper.getInstance(this).getClientValue("client_id")
160 - + "&client_secret=" + WarplyDBHelper.getInstance(this).getClientValue("client_secret");
161 151
162 if (mConsumer != null) 152 if (mConsumer != null)
163 tempUrl = tempUrl + "&auth_token=" + (mConsumer.getUuid()); 153 tempUrl = tempUrl + "&auth_token=" + (mConsumer.getUuid());
...@@ -171,18 +161,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -171,18 +161,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
171 }); 161 });
172 } 162 }
173 163
174 - public static Consumer getConsumer() {
175 - return mConsumer;
176 - }
177 -
178 - public static HashMap<String, CampaignList> getUniqueCampaignList() {
179 - return mUniqueCampaignList;
180 - }
181 -
182 - public static CouponList getCouponList() {
183 - return mCouponList;
184 - }
185 -
186 private void initViews() { 164 private void initViews() {
187 handleIntent(getIntent()); 165 handleIntent(getIntent());
188 mBottomNavigationView.setOnItemSelectedListener(this); 166 mBottomNavigationView.setOnItemSelectedListener(this);
...@@ -199,6 +177,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -199,6 +177,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
199 @Override 177 @Override
200 public void onSuccess(Consumer result) { 178 public void onSuccess(Consumer result) {
201 mConsumer = result; 179 mConsumer = result;
180 + WarplyManagerHelper.setConsumer(result);
202 // Thread.currentThread().interrupt(); 181 // Thread.currentThread().interrupt();
203 Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver); 182 Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver);
204 } 183 }
...@@ -224,6 +203,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -224,6 +203,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
224 } 203 }
225 } 204 }
226 205
206 + WarplyManagerHelper.setUniqueCampaignList(mUniqueCampaignList);
207 +
227 // Thread.currentThread().interrupt(); 208 // Thread.currentThread().interrupt();
228 209
229 WarplyManager.getCouponsets(new WarplyGetCouponsetsRequest() 210 WarplyManager.getCouponsets(new WarplyGetCouponsetsRequest()
...@@ -241,6 +222,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -241,6 +222,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
241 @Override 222 @Override
242 public void onSuccess(CouponsetsList result) { 223 public void onSuccess(CouponsetsList result) {
243 mCouponsetsList = result; 224 mCouponsetsList = result;
225 + WarplyManagerHelper.setCouponsets(result);
244 WarplyManager.getUserCoupons(new WarplyUserCouponsRequest(), mUserCouponsReceiver); 226 WarplyManager.getUserCoupons(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
245 } 227 }
246 228
...@@ -254,6 +236,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -254,6 +236,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
254 private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() { 236 private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
255 @Override 237 @Override
256 public void onSuccess(CouponList result) { 238 public void onSuccess(CouponList result) {
239 + CouponList mCouponList = new CouponList();
257 for (Coupon coupon : result) { 240 for (Coupon coupon : result) {
258 for (Couponset couponset : mCouponsetsList) { 241 for (Couponset couponset : mCouponsetsList) {
259 if (coupon.getCouponsetUuid().equals(couponset.getUuid())) { 242 if (coupon.getCouponsetUuid().equals(couponset.getUuid())) {
...@@ -265,6 +248,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -265,6 +248,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
265 } 248 }
266 } 249 }
267 250
251 + WarplyManagerHelper.setCouponList(mCouponList);
252 +
268 Thread.currentThread().interrupt(); 253 Thread.currentThread().interrupt();
269 new Handler(Looper.getMainLooper()).post(() -> { 254 new Handler(Looper.getMainLooper()).post(() -> {
270 initViews(); 255 initViews();
......
...@@ -8,10 +8,8 @@ import android.app.NotificationManager; ...@@ -8,10 +8,8 @@ import android.app.NotificationManager;
8 import android.app.PendingIntent; 8 import android.app.PendingIntent;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.Intent; 10 import android.content.Intent;
11 -import android.content.pm.PackageManager;
12 import android.graphics.BitmapFactory; 11 import android.graphics.BitmapFactory;
13 import android.graphics.Typeface; 12 import android.graphics.Typeface;
14 -import android.net.Uri;
15 import android.os.Build; 13 import android.os.Build;
16 import android.os.Bundle; 14 import android.os.Bundle;
17 import android.os.Handler; 15 import android.os.Handler;
...@@ -29,9 +27,7 @@ import android.widget.TextView; ...@@ -29,9 +27,7 @@ import android.widget.TextView;
29 import androidx.core.app.NotificationCompat; 27 import androidx.core.app.NotificationCompat;
30 28
31 import ly.warp.sdk.R; 29 import ly.warp.sdk.R;
32 -import ly.warp.sdk.db.WarplyDBHelper; 30 +import ly.warp.sdk.utils.WarplyManagerHelper;
33 -import ly.warp.sdk.utils.WarpUtils;
34 -import ly.warp.sdk.utils.WarplyProperty;
35 31
36 32
37 public class BillPaymentActivity extends Activity implements View.OnClickListener { 33 public class BillPaymentActivity extends Activity implements View.OnClickListener {
...@@ -71,20 +67,10 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene ...@@ -71,20 +67,10 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene
71 protected void onNewIntent(Intent intent) { 67 protected void onNewIntent(Intent intent) {
72 super.onNewIntent(intent); 68 super.onNewIntent(intent);
73 if (intent.hasExtra("channel")) { 69 if (intent.hasExtra("channel")) {
74 - String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl(); 70 + String tempUrl = WarplyManagerHelper.constructCampaignUrl(WarplyManagerHelper.getUniqueCampaignList().get("lucky_draw").get(0));
75 - 71 +
76 - tempUrl = tempUrl 72 + if (WarplyManagerHelper.getConsumer() != null)
77 - + "?web_id=" + WarpUtils.getWebId(this) 73 + tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
78 - + "&app_uuid=" + WarplyProperty.getAppUuid(this)
79 - + "&api_key=" + WarpUtils.getApiKey(this)
80 - + "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
81 - + "&access_token=" + WarplyDBHelper.getInstance(this).getAuthValue("access_token")
82 - + "&refresh_token=" + WarplyDBHelper.getInstance(this).getAuthValue("refresh_token")
83 - + "&client_id=" + WarplyDBHelper.getInstance(this).getClientValue("client_id")
84 - + "&client_secret=" + WarplyDBHelper.getInstance(this).getClientValue("client_secret");
85 -
86 - if (BaseFragmentActivity.getConsumer() != null)
87 - tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
88 else 74 else
89 tempUrl = tempUrl + "&auth_token="; 75 tempUrl = tempUrl + "&auth_token=";
90 76
...@@ -180,22 +166,12 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene ...@@ -180,22 +166,12 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene
180 mTvLuckyDraw.setText(builder, TextView.BufferType.SPANNABLE); 166 mTvLuckyDraw.setText(builder, TextView.BufferType.SPANNABLE);
181 167
182 mClLuckyDraw.setOnClickListener(view -> { 168 mClLuckyDraw.setOnClickListener(view -> {
183 - if (BaseFragmentActivity.getUniqueCampaignList() != null && !BaseFragmentActivity.getUniqueCampaignList().isEmpty()) { 169 + if (WarplyManagerHelper.getUniqueCampaignList() != null && !WarplyManagerHelper.getUniqueCampaignList().isEmpty()) {
184 - if (BaseFragmentActivity.getUniqueCampaignList().containsKey("lucky_draw") && BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").size() > 0) { 170 + if (WarplyManagerHelper.getUniqueCampaignList().containsKey("lucky_draw") && WarplyManagerHelper.getUniqueCampaignList().get("lucky_draw").size() > 0) {
185 - String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl(); 171 + String tempUrl = WarplyManagerHelper.constructCampaignUrl(WarplyManagerHelper.getUniqueCampaignList().get("lucky_draw").get(0));
186 - 172 +
187 - tempUrl = tempUrl 173 + if (WarplyManagerHelper.getConsumer() != null)
188 - + "?web_id=" + WarpUtils.getWebId(this) 174 + tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
189 - + "&app_uuid=" + WarplyProperty.getAppUuid(this)
190 - + "&api_key=" + WarpUtils.getApiKey(this)
191 - + "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
192 - + "&access_token=" + WarplyDBHelper.getInstance(this).getAuthValue("access_token")
193 - + "&refresh_token=" + WarplyDBHelper.getInstance(this).getAuthValue("refresh_token")
194 - + "&client_id=" + WarplyDBHelper.getInstance(this).getClientValue("client_id")
195 - + "&client_secret=" + WarplyDBHelper.getInstance(this).getClientValue("client_secret");
196 -
197 - if (BaseFragmentActivity.getConsumer() != null)
198 - tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
199 else 175 else
200 tempUrl = tempUrl + "&auth_token="; 176 tempUrl = tempUrl + "&auth_token=";
201 177
......
1 +package ly.warp.sdk.activities;
2 +
3 +import android.app.Activity;
4 +import android.app.Dialog;
5 +import android.graphics.Paint;
6 +import android.os.Bundle;
7 +import android.text.Html;
8 +import android.text.TextUtils;
9 +import android.view.View;
10 +import android.widget.ImageView;
11 +import android.widget.LinearLayout;
12 +import android.widget.ProgressBar;
13 +import android.widget.TextView;
14 +
15 +import com.bumptech.glide.Glide;
16 +import com.bumptech.glide.load.engine.DiskCacheStrategy;
17 +
18 +import org.json.JSONObject;
19 +
20 +import ly.warp.sdk.R;
21 +import ly.warp.sdk.io.callbacks.CallbackReceiver;
22 +import ly.warp.sdk.io.models.Couponset;
23 +import ly.warp.sdk.io.request.WarplyRedeemCouponRequest;
24 +import ly.warp.sdk.utils.managers.WarplyManager;
25 +
26 +
27 +public class CouponsetInfoActivity extends Activity implements View.OnClickListener {
28 +
29 + // ===========================================================
30 + // Constants
31 + // ===========================================================
32 +
33 + // ===========================================================
34 + // Fields
35 + // ===========================================================
36 +
37 + private ImageView mIvBack, mIvCouponsetPhoto;
38 + private TextView mTvTerms, mTvCouponsetTitle, mTvCouponsetSubtitle;
39 + private Couponset mCouponset;
40 + private LinearLayout mLlRedeem;
41 + private ProgressBar mPbLoading;
42 +
43 + // ===========================================================
44 + // Methods for/from SuperClass/Interfaces
45 + // ===========================================================
46 +
47 + @Override
48 + public void onCreate(Bundle savedInstanceState) {
49 + super.onCreate(savedInstanceState);
50 + setContentView(R.layout.activity_couponset_info);
51 +
52 + mCouponset = (Couponset) getIntent().getSerializableExtra("couponset");
53 +
54 + mIvBack = findViewById(R.id.iv_couponset_info_back);
55 + mTvTerms = findViewById(R.id.tv_terms);
56 + mTvCouponsetTitle = findViewById(R.id.textView13);
57 + mTvCouponsetSubtitle = findViewById(R.id.textView14);
58 + mIvCouponsetPhoto = findViewById(R.id.imageView6);
59 + mLlRedeem = findViewById(R.id.ll_get_gift);
60 + mPbLoading = findViewById(R.id.pb_loading);
61 +
62 + initViews();
63 + }
64 +
65 + @Override
66 + public void onResume() {
67 + super.onResume();
68 + }
69 +
70 + @Override
71 + public void onClick(View view) {
72 + if (view.getId() == R.id.iv_couponset_info_back) {
73 + onBackPressed();
74 + return;
75 + }
76 + if (view.getId() == R.id.ll_get_gift) {
77 + mPbLoading.setVisibility(View.VISIBLE);
78 + WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest().setCouponsetUuid(mCouponset.getUuid()), mRedeemCouponCallback);
79 + }
80 + }
81 +
82 + // ===========================================================
83 + // Methods
84 + // ===========================================================
85 +
86 + private void initViews() {
87 + mTvCouponsetTitle.setText(mCouponset.getName());
88 + mTvCouponsetSubtitle.setText(Html.fromHtml(mCouponset.getDescription()));
89 +
90 + if (!TextUtils.isEmpty(mCouponset.getImgPreview())) {
91 + Glide.with(this)
92 +// .setDefaultRequestOptions(
93 +// RequestOptions
94 +// .placeholderOf(R.drawable.ic_default_contact_photo)
95 +// .error(R.drawable.ic_default_contact_photo))
96 + .load(mCouponset.getImgPreview())
97 + .diskCacheStrategy(DiskCacheStrategy.DATA)
98 + .into(mIvCouponsetPhoto);
99 + } else {
100 + Glide.with(this)
101 + .load(R.drawable.ic_cosmote_logo_horizontal_grey)
102 + .into(mIvCouponsetPhoto);
103 + }
104 +
105 + mIvBack.setOnClickListener(this);
106 + mLlRedeem.setOnClickListener(this);
107 + mTvTerms.setPaintFlags(mTvTerms.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
108 + }
109 +
110 + private final CallbackReceiver<JSONObject> mRedeemCouponCallback = new CallbackReceiver<JSONObject>() {
111 + @Override
112 + public void onSuccess(JSONObject result) {
113 + mPbLoading.setVisibility(View.GONE);
114 + showDialog(true, 1);
115 + }
116 +
117 + @Override
118 + public void onFailure(int errorCode) {
119 + mPbLoading.setVisibility(View.GONE);
120 + showDialog(false, errorCode);
121 + }
122 + };
123 +
124 + private void showDialog(boolean success, int status) {
125 + Dialog dialog = new Dialog(this, R.style.PopUpDialog);
126 + dialog.setContentView(R.layout.dlg_success);
127 + dialog.getWindow().setBackgroundDrawableResource(R.drawable.banner_border_white);
128 + dialog.show();
129 +
130 + LinearLayout mLlButton = dialog.findViewById(R.id.ll_dl_redeem);
131 + TextView tvTitle = dialog.findViewById(R.id.tv_dl_title);
132 + TextView tvSubtitle = dialog.findViewById(R.id.tv_dl_subtitle);
133 +
134 + if (success) {
135 + tvTitle.setText(getString(R.string.cos_dlg_success_title));
136 + tvSubtitle.setText(getString(R.string.cos_dlg_success_subtitle));
137 + } else {
138 + if (status == 3) {
139 + tvTitle.setText(getString(R.string.cos_dlg_error_title));
140 + tvSubtitle.setText(getString(R.string.cos_dlg_error_subtitle_non_buyable));
141 + } else if (status == 5) {
142 + tvTitle.setText(getString(R.string.cos_dlg_error_title));
143 + tvSubtitle.setText(getString(R.string.cos_dlg_error_subtitle_no_points));
144 + } else {
145 + tvTitle.setText(getString(R.string.cos_dlg_error_title));
146 + tvSubtitle.setText(getString(R.string.cos_dlg_error_subtitle));
147 + }
148 + }
149 +
150 + mLlButton.setOnClickListener(view -> {
151 + dialog.dismiss();
152 + if (success) {
153 + //TODO: go to coupon
154 + }
155 + });
156 + }
157 +
158 + // ===========================================================
159 + // Inner and Anonymous Classes
160 + // ===========================================================
161 +
162 +}
1 +package ly.warp.sdk.activities;
2 +
3 +import android.app.Activity;
4 +import android.content.Intent;
5 +import android.os.Bundle;
6 +import android.view.View;
7 +import android.widget.ImageView;
8 +import android.widget.TextView;
9 +
10 +import androidx.constraintlayout.widget.ConstraintLayout;
11 +import androidx.recyclerview.widget.LinearLayoutManager;
12 +import androidx.recyclerview.widget.RecyclerView;
13 +
14 +import org.json.JSONException;
15 +import org.json.JSONObject;
16 +
17 +import java.io.Serializable;
18 +import java.util.HashMap;
19 +
20 +import ly.warp.sdk.R;
21 +import ly.warp.sdk.io.models.Campaign;
22 +import ly.warp.sdk.io.models.CampaignList;
23 +import ly.warp.sdk.utils.WarplyManagerHelper;
24 +import ly.warp.sdk.views.adapters.CouponsetsAdapter;
25 +import ly.warp.sdk.views.adapters.ProfileCampaignAdapter;
26 +
27 +
28 +public class ListForYouActivity extends Activity implements View.OnClickListener {
29 +
30 + // ===========================================================
31 + // Constants
32 + // ===========================================================
33 +
34 + // ===========================================================
35 + // Fields
36 + // ===========================================================
37 +
38 + private ImageView mIvBack;
39 + private RecyclerView mRecyclerGifts, mRecyclerRewards, mRecyclerCoupons;
40 + private TextView mTvTitle;
41 + private ProfileCampaignAdapter mAdapterGifts, mAdapterRewards;
42 + private CouponsetsAdapter mAdapterCoupons;
43 + private ConstraintLayout mClGiftsOuter, mClRewardsOuter, mClCouponsOuter;
44 + private HashMap<String, CampaignList> mUniqueGiftsList = new HashMap<String, CampaignList>();
45 +
46 + // ===========================================================
47 + // Methods for/from SuperClass/Interfaces
48 + // ===========================================================
49 +
50 + @Override
51 + public void onCreate(Bundle savedInstanceState) {
52 + super.onCreate(savedInstanceState);
53 + setContentView(R.layout.activity_list_for_you);
54 +
55 + getCampaignsBySubcategory();
56 +
57 + mIvBack = findViewById(R.id.iv_list_close);
58 + mTvTitle = findViewById(R.id.textView3);
59 +
60 + mClGiftsOuter = findViewById(R.id.cl_recycler_inner);
61 + mRecyclerGifts = findViewById(R.id.rv_gifts);
62 +
63 + mClRewardsOuter = findViewById(R.id.cl_recycler_inner2);
64 + mRecyclerRewards = findViewById(R.id.rv_rewards);
65 +
66 + mClCouponsOuter = findViewById(R.id.cl_recycler_inner3);
67 + mRecyclerCoupons = findViewById(R.id.rv_coupons);
68 +
69 + initViews();
70 + }
71 +
72 + @Override
73 + public void onResume() {
74 + super.onResume();
75 + }
76 +
77 + @Override
78 + public void onClick(View view) {
79 + if (view.getId() == R.id.iv_list_close) {
80 + onBackPressed();
81 + }
82 + }
83 +
84 + // ===========================================================
85 + // Methods
86 + // ===========================================================
87 +
88 + private void initViews() {
89 + mIvBack.setOnClickListener(this);
90 + mTvTitle.setText(getIntent().getStringExtra("title"));
91 +
92 + if (mUniqueGiftsList.get("gifts") != null && mUniqueGiftsList.get("gifts").size() > 0) {
93 + mRecyclerGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
94 + mAdapterGifts = new ProfileCampaignAdapter(this, mUniqueGiftsList.get("gifts"));
95 + mRecyclerGifts.setAdapter(mAdapterGifts);
96 + mAdapterGifts.getPositionClicks()
97 + .doOnNext(gift -> {
98 + String tempUrl = WarplyManagerHelper.constructCampaignUrl(gift);
99 +
100 + if (WarplyManagerHelper.getConsumer() != null)
101 + tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
102 + else
103 + tempUrl = tempUrl + "&auth_token=";
104 +
105 + startActivity(WarpViewActivity.createIntentFromURL(this, tempUrl));
106 + })
107 + .doOnError(error -> {
108 + })
109 + .subscribe();
110 + } else {
111 + mClGiftsOuter.setVisibility(View.GONE);
112 + }
113 +
114 + if (mUniqueGiftsList.get("rewards") != null && mUniqueGiftsList.get("rewards").size() > 0) {
115 + mRecyclerRewards.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
116 + mAdapterRewards = new ProfileCampaignAdapter(this, mUniqueGiftsList.get("rewards"));
117 + mRecyclerRewards.setAdapter(mAdapterRewards);
118 + mAdapterRewards.getPositionClicks()
119 + .doOnNext(reward -> {
120 + String tempUrl = WarplyManagerHelper.constructCampaignUrl(reward);
121 +
122 + if (WarplyManagerHelper.getConsumer() != null)
123 + tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
124 + else
125 + tempUrl = tempUrl + "&auth_token=";
126 +
127 + startActivity(WarpViewActivity.createIntentFromURL(this, tempUrl));
128 + })
129 + .doOnError(error -> {
130 + })
131 + .subscribe();
132 + } else {
133 + mClRewardsOuter.setVisibility(View.GONE);
134 + }
135 +
136 + if (WarplyManagerHelper.getCouponsets() != null && WarplyManagerHelper.getCouponsets().size() > 0) {
137 + mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
138 + mAdapterCoupons = new CouponsetsAdapter(this, WarplyManagerHelper.getCouponsets());
139 + mRecyclerCoupons.setAdapter(mAdapterCoupons);
140 + mAdapterCoupons.getPositionClicks()
141 + .doOnNext(couponset -> {
142 +// Intent intent = new Intent(ListForYouActivity.this, CouponInfoActivity.class);
143 +// intent.putExtra("coupon", (Serializable) coupon);
144 +// startActivity(intent);
145 +
146 + Intent intent = new Intent(ListForYouActivity.this, CouponsetInfoActivity.class);
147 + intent.putExtra("couponset", (Serializable) couponset);
148 + startActivity(intent);
149 + })
150 + .doOnError(error -> {
151 + })
152 + .subscribe();
153 + } else {
154 + mClCouponsOuter.setVisibility(View.GONE);
155 + }
156 + }
157 +
158 + private void getCampaignsBySubcategory() {
159 + if (WarplyManagerHelper.getUniqueCampaignList().get("gifts_for_you") != null && WarplyManagerHelper.getUniqueCampaignList().get("gifts_for_you").size() > 0) {
160 + for (Campaign campaign : WarplyManagerHelper.getUniqueCampaignList().get("gifts_for_you")) {
161 + JSONObject campaignExtra = null;
162 + try {
163 + campaignExtra = new JSONObject(campaign.getExtraFields());
164 + } catch (JSONException e) {
165 + e.printStackTrace();
166 + }
167 +
168 + if (campaignExtra != null) {
169 + if (mUniqueGiftsList.containsKey(campaignExtra.optString("subcategory").trim())) {
170 + CampaignList tempCampaignList = mUniqueGiftsList.get(campaignExtra.optString("subcategory").trim());
171 + tempCampaignList.add(campaign);
172 + mUniqueGiftsList.put(campaignExtra.optString("subcategory").trim(), tempCampaignList);
173 + } else {
174 + CampaignList tempCampaignList = new CampaignList();
175 + tempCampaignList.add(campaign);
176 + mUniqueGiftsList.put(campaignExtra.optString("subcategory").trim(), tempCampaignList);
177 + }
178 + }
179 + }
180 + }
181 + }
182 +
183 + // ===========================================================
184 + // Inner and Anonymous Classes
185 + // ===========================================================
186 +
187 +}
...@@ -2,7 +2,6 @@ package ly.warp.sdk.activities; ...@@ -2,7 +2,6 @@ package ly.warp.sdk.activities;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.content.Intent; 4 import android.content.Intent;
5 -import android.media.Image;
6 import android.os.Bundle; 5 import android.os.Bundle;
7 import android.view.View; 6 import android.view.View;
8 import android.widget.AdapterView; 7 import android.widget.AdapterView;
...@@ -17,11 +16,9 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -17,11 +16,9 @@ import androidx.recyclerview.widget.RecyclerView;
17 import java.io.Serializable; 16 import java.io.Serializable;
18 17
19 import ly.warp.sdk.R; 18 import ly.warp.sdk.R;
20 -import ly.warp.sdk.db.WarplyDBHelper;
21 import ly.warp.sdk.io.models.Campaign; 19 import ly.warp.sdk.io.models.Campaign;
22 import ly.warp.sdk.io.models.CampaignList; 20 import ly.warp.sdk.io.models.CampaignList;
23 -import ly.warp.sdk.utils.WarpUtils; 21 +import ly.warp.sdk.utils.WarplyManagerHelper;
24 -import ly.warp.sdk.utils.WarplyProperty;
25 import ly.warp.sdk.views.adapters.HomeCouponAdapter; 22 import ly.warp.sdk.views.adapters.HomeCouponAdapter;
26 23
27 24
...@@ -81,7 +78,7 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener, ...@@ -81,7 +78,7 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
81 return; 78 return;
82 } 79 }
83 if (view.getId() == R.id.tv_questionnaire) { 80 if (view.getId() == R.id.tv_questionnaire) {
84 - CampaignList cl = BaseFragmentActivity.getUniqueCampaignList().get("more"); 81 + CampaignList cl = WarplyManagerHelper.getUniqueCampaignList().get("more");
85 Campaign camp = null; 82 Campaign camp = null;
86 if (cl != null) { 83 if (cl != null) {
87 for (Campaign cn : cl) { 84 for (Campaign cn : cl) {
...@@ -95,20 +92,10 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener, ...@@ -95,20 +92,10 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
95 if (camp == null) 92 if (camp == null)
96 return; 93 return;
97 94
98 - String tempUrl = camp.getIndexUrl(); 95 + String tempUrl = WarplyManagerHelper.constructCampaignUrl(camp);
99 96
100 - tempUrl = tempUrl 97 + if (WarplyManagerHelper.getConsumer() != null)
101 - + "?web_id=" + WarpUtils.getWebId(this) 98 + tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
102 - + "&app_uuid=" + WarplyProperty.getAppUuid(this)
103 - + "&api_key=" + WarpUtils.getApiKey(this)
104 - + "&session_uuid=" + camp.getSessionUUID()
105 - + "&access_token=" + WarplyDBHelper.getInstance(this).getAuthValue("access_token")
106 - + "&refresh_token=" + WarplyDBHelper.getInstance(this).getAuthValue("refresh_token")
107 - + "&client_id=" + WarplyDBHelper.getInstance(this).getClientValue("client_id")
108 - + "&client_secret=" + WarplyDBHelper.getInstance(this).getClientValue("client_secret");
109 -
110 - if (BaseFragmentActivity.getConsumer() != null)
111 - tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
112 else 99 else
113 tempUrl = tempUrl + "&auth_token="; 100 tempUrl = tempUrl + "&auth_token=";
114 101
...@@ -155,15 +142,15 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener, ...@@ -155,15 +142,15 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
155 // =========================================================== 142 // ===========================================================
156 143
157 private void initViews() { 144 private void initViews() {
158 - if (BaseFragmentActivity.getConsumer() != null) 145 + if (WarplyManagerHelper.getConsumer() != null)
159 mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_loyalty_name), 146 mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_loyalty_name),
160 - BaseFragmentActivity.getConsumer().getFirstName(), BaseFragmentActivity.getConsumer().getLastName())); 147 + WarplyManagerHelper.getConsumer().getFirstName(), WarplyManagerHelper.getConsumer().getLastName()));
161 148
162 mIvBack.setOnClickListener(this); 149 mIvBack.setOnClickListener(this);
163 mTvAnalysisButton.setOnClickListener(this); 150 mTvAnalysisButton.setOnClickListener(this);
164 151
165 mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)); 152 mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
166 - mAdapterCoupons = new HomeCouponAdapter(this, BaseFragmentActivity.getCouponList()); 153 + mAdapterCoupons = new HomeCouponAdapter(this, WarplyManagerHelper.getCouponList());
167 mRecyclerCoupons.setAdapter(mAdapterCoupons); 154 mRecyclerCoupons.setAdapter(mAdapterCoupons);
168 mAdapterCoupons.getPositionClicks() 155 mAdapterCoupons.getPositionClicks()
169 .doOnNext(coupon -> { 156 .doOnNext(coupon -> {
...@@ -176,7 +163,7 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener, ...@@ -176,7 +163,7 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
176 .subscribe(); 163 .subscribe();
177 164
178 mRecyclerBurntCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)); 165 mRecyclerBurntCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
179 - mAdapterBurntCoupons = new HomeCouponAdapter(this, BaseFragmentActivity.getCouponList(), true); 166 + mAdapterBurntCoupons = new HomeCouponAdapter(this, WarplyManagerHelper.getCouponList(), true);
180 mRecyclerBurntCoupons.setAdapter(mAdapterBurntCoupons); 167 mRecyclerBurntCoupons.setAdapter(mAdapterBurntCoupons);
181 168
182 ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, 169 ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
......
...@@ -11,35 +11,26 @@ import android.widget.RelativeLayout; ...@@ -11,35 +11,26 @@ import android.widget.RelativeLayout;
11 import android.widget.TextView; 11 import android.widget.TextView;
12 12
13 import androidx.annotation.NonNull; 13 import androidx.annotation.NonNull;
14 +import androidx.constraintlayout.widget.ConstraintLayout;
14 import androidx.fragment.app.Fragment; 15 import androidx.fragment.app.Fragment;
15 import androidx.recyclerview.widget.LinearLayoutManager; 16 import androidx.recyclerview.widget.LinearLayoutManager;
16 import androidx.recyclerview.widget.RecyclerView; 17 import androidx.recyclerview.widget.RecyclerView;
17 18
18 -import org.json.JSONException;
19 -
20 -import java.io.Serializable;
21 -
22 import ly.warp.sdk.R; 19 import ly.warp.sdk.R;
23 -import ly.warp.sdk.activities.BaseFragmentActivity; 20 +import ly.warp.sdk.activities.ActiveCouponsActivity;
24 import ly.warp.sdk.activities.BillPaymentActivity; 21 import ly.warp.sdk.activities.BillPaymentActivity;
25 -import ly.warp.sdk.activities.CouponInfoActivity;
26 import ly.warp.sdk.activities.WarpViewActivity; 22 import ly.warp.sdk.activities.WarpViewActivity;
27 -import ly.warp.sdk.db.WarplyDBHelper; 23 +import ly.warp.sdk.utils.WarplyManagerHelper;
28 -import ly.warp.sdk.io.models.Coupon;
29 -import ly.warp.sdk.io.models.CouponList;
30 -import ly.warp.sdk.utils.WarpUtils;
31 -import ly.warp.sdk.utils.WarplyProperty;
32 import ly.warp.sdk.views.adapters.HomeCampaignAdapter; 24 import ly.warp.sdk.views.adapters.HomeCampaignAdapter;
33 -import ly.warp.sdk.views.adapters.HomeCouponAdapter;
34 25
35 public class HomeFragment extends Fragment implements View.OnClickListener { 26 public class HomeFragment extends Fragment implements View.OnClickListener {
36 27
37 private RelativeLayout mOptionOne, mOptionTwo, mOptionThree; 28 private RelativeLayout mOptionOne, mOptionTwo, mOptionThree;
38 - private RecyclerView mRecyclerCampaigns, mRecyclerCoupons; 29 + private RecyclerView mRecyclerCampaigns;
39 - private HomeCouponAdapter mAdapterCoupons;
40 private HomeCampaignAdapter mAdapterCampaigns; 30 private HomeCampaignAdapter mAdapterCampaigns;
41 private LinearLayout mLlBillPayment; 31 private LinearLayout mLlBillPayment;
42 - private TextView mTvUsername; 32 + private TextView mTvUsername, mTvActiveCoupons;
33 + private ConstraintLayout mClActiveCoupons;
43 34
44 @Override 35 @Override
45 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 36 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
...@@ -49,52 +40,47 @@ public class HomeFragment extends Fragment implements View.OnClickListener { ...@@ -49,52 +40,47 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
49 public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { 40 public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
50 super.onViewCreated(view, savedInstanceState); 41 super.onViewCreated(view, savedInstanceState);
51 42
52 - mOptionOne = (RelativeLayout) view.findViewById(R.id.info_button); 43 + mOptionOne = view.findViewById(R.id.info_button);
53 - TextView mOptionOneText = (TextView) mOptionOne.findViewById(R.id.option_text); 44 + TextView mOptionOneText = mOptionOne.findViewById(R.id.option_text);
54 - ImageView mOptionOneImage = (ImageView) mOptionOne.findViewById(R.id.option_icon); 45 + ImageView mOptionOneImage = mOptionOne.findViewById(R.id.option_icon);
55 mOptionOneText.setText("2"); 46 mOptionOneText.setText("2");
56 mOptionOneImage.setImageResource(R.drawable.mobile_option); 47 mOptionOneImage.setImageResource(R.drawable.mobile_option);
57 48
58 - mOptionTwo = (RelativeLayout) view.findViewById(R.id.info_button2); 49 + mOptionTwo = view.findViewById(R.id.info_button2);
59 - TextView mOptionTwoText = (TextView) mOptionTwo.findViewById(R.id.option_text); 50 + TextView mOptionTwoText = mOptionTwo.findViewById(R.id.option_text);
60 - ImageView mOptionTwoImage = (ImageView) mOptionTwo.findViewById(R.id.option_icon); 51 + ImageView mOptionTwoImage = mOptionTwo.findViewById(R.id.option_icon);
61 mOptionTwoText.setText("1"); 52 mOptionTwoText.setText("1");
62 mOptionTwoImage.setImageResource(R.drawable.phone_option); 53 mOptionTwoImage.setImageResource(R.drawable.phone_option);
63 54
64 - mOptionThree = (RelativeLayout) view.findViewById(R.id.info_button3); 55 + mOptionThree = view.findViewById(R.id.info_button3);
65 - TextView mOptionThreeText = (TextView) mOptionThree.findViewById(R.id.option_text); 56 + TextView mOptionThreeText = mOptionThree.findViewById(R.id.option_text);
66 - ImageView mOptionThreeImage = (ImageView) mOptionThree.findViewById(R.id.option_icon); 57 + ImageView mOptionThreeImage = mOptionThree.findViewById(R.id.option_icon);
67 mOptionThreeText.setText("1"); 58 mOptionThreeText.setText("1");
68 mOptionThreeImage.setImageResource(R.drawable.tv_option); 59 mOptionThreeImage.setImageResource(R.drawable.tv_option);
69 60
61 + mClActiveCoupons = view.findViewById(R.id.cl_coupon);
62 + mTvActiveCoupons = mClActiveCoupons.findViewById(R.id.tv_active_coupons);
63 + mTvActiveCoupons.setText(String.format(getResources().getString(R.string.cos_active_coupons), String.valueOf(WarplyManagerHelper.getCouponList().size())));
64 + mClActiveCoupons.setOnClickListener(this);
65 +
70 mLlBillPayment = view.findViewById(R.id.ll_bill_payment); 66 mLlBillPayment = view.findViewById(R.id.ll_bill_payment);
71 mLlBillPayment.setOnClickListener(this); 67 mLlBillPayment.setOnClickListener(this);
72 68
73 mTvUsername = view.findViewById(R.id.welcome_user_txt); 69 mTvUsername = view.findViewById(R.id.welcome_user_txt);
74 - if (BaseFragmentActivity.getConsumer() != null) 70 + if (WarplyManagerHelper.getConsumer() != null)
75 mTvUsername.setText(String.format(getResources().getString(R.string.welcome_user), 71 mTvUsername.setText(String.format(getResources().getString(R.string.welcome_user),
76 - BaseFragmentActivity.getConsumer().getFirstName() + " " + BaseFragmentActivity.getConsumer().getLastName())); 72 + WarplyManagerHelper.getConsumer().getFirstName() + " " + WarplyManagerHelper.getConsumer().getLastName()));
77 73
78 mRecyclerCampaigns = view.findViewById(R.id.rv_home_campaigns); 74 mRecyclerCampaigns = view.findViewById(R.id.rv_home_campaigns);
79 mRecyclerCampaigns.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false)); 75 mRecyclerCampaigns.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
80 - mAdapterCampaigns = new HomeCampaignAdapter(getContext(), BaseFragmentActivity.getUniqueCampaignList().get("homescreen")); 76 + mAdapterCampaigns = new HomeCampaignAdapter(getContext(), WarplyManagerHelper.getUniqueCampaignList().get("homescreen"));
81 mRecyclerCampaigns.setAdapter(mAdapterCampaigns); 77 mRecyclerCampaigns.setAdapter(mAdapterCampaigns);
82 mAdapterCampaigns.getPositionClicks() 78 mAdapterCampaigns.getPositionClicks()
83 .doOnNext(campaign -> { 79 .doOnNext(campaign -> {
84 - String tempUrl = campaign.getIndexUrl(); 80 + String tempUrl = WarplyManagerHelper.constructCampaignUrl(campaign);
85 - 81 +
86 - tempUrl = tempUrl 82 + if (WarplyManagerHelper.getConsumer() != null)
87 - + "?web_id=" + WarpUtils.getWebId(getContext()) 83 + tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
88 - + "&app_uuid=" + WarplyProperty.getAppUuid(getContext())
89 - + "&api_key=" + WarpUtils.getApiKey(getContext())
90 - + "&session_uuid=" + campaign.getSessionUUID()
91 - + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token")
92 - + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token")
93 - + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id")
94 - + "&client_secret=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_secret");
95 -
96 - if (BaseFragmentActivity.getConsumer() != null)
97 - tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
98 else 84 else
99 tempUrl = tempUrl + "&auth_token="; 85 tempUrl = tempUrl + "&auth_token=";
100 86
...@@ -103,20 +89,6 @@ public class HomeFragment extends Fragment implements View.OnClickListener { ...@@ -103,20 +89,6 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
103 .doOnError(error -> { 89 .doOnError(error -> {
104 }) 90 })
105 .subscribe(); 91 .subscribe();
106 -
107 - mRecyclerCoupons = view.findViewById(R.id.rv_home_coupons);
108 - mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
109 - mAdapterCoupons = new HomeCouponAdapter(getContext(), BaseFragmentActivity.getCouponList());
110 - mRecyclerCoupons.setAdapter(mAdapterCoupons);
111 - mAdapterCoupons.getPositionClicks()
112 - .doOnNext(coupon -> {
113 - Intent intent = new Intent(getContext(), CouponInfoActivity.class);
114 - intent.putExtra("coupon", (Serializable) coupon);
115 - startActivity(intent);
116 - })
117 - .doOnError(error -> {
118 - })
119 - .subscribe();
120 } 92 }
121 93
122 @Override 94 @Override
...@@ -129,6 +101,12 @@ public class HomeFragment extends Fragment implements View.OnClickListener { ...@@ -129,6 +101,12 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
129 if (view.getId() == R.id.ll_bill_payment) { 101 if (view.getId() == R.id.ll_bill_payment) {
130 Intent intent = new Intent(getContext(), BillPaymentActivity.class); 102 Intent intent = new Intent(getContext(), BillPaymentActivity.class);
131 startActivity(intent); 103 startActivity(intent);
104 + return;
105 + }
106 + if (view.getId() == R.id.cl_coupon) {
107 + Intent intent = new Intent(getContext(), ActiveCouponsActivity.class);
108 + intent.putExtra("couponlist", WarplyManagerHelper.getCouponList());
109 + startActivity(intent);
132 } 110 }
133 } 111 }
134 112
......
...@@ -25,9 +25,12 @@ ...@@ -25,9 +25,12 @@
25 25
26 package ly.warp.sdk.io.models; 26 package ly.warp.sdk.io.models;
27 27
28 +import android.text.TextUtils;
29 +
28 import androidx.annotation.NonNull; 30 import androidx.annotation.NonNull;
29 31
30 import org.json.JSONArray; 32 import org.json.JSONArray;
33 +import org.json.JSONException;
31 import org.json.JSONObject; 34 import org.json.JSONObject;
32 35
33 import java.util.ArrayList; 36 import java.util.ArrayList;
...@@ -74,6 +77,25 @@ public class CouponList extends ArrayList<Coupon> { ...@@ -74,6 +77,25 @@ public class CouponList extends ArrayList<Coupon> {
74 } 77 }
75 } 78 }
76 79
80 + public CouponList(String couponListJSONObject, boolean customCast) {
81 + this();
82 +
83 + if (couponListJSONObject == null || TextUtils.isEmpty(couponListJSONObject))
84 + return;
85 +
86 + JSONArray jArray = null;
87 + try {
88 + jArray = new JSONArray(couponListJSONObject);
89 + } catch (JSONException e) {
90 + e.printStackTrace();
91 + }
92 + if (jArray != null) {
93 + for (int i = 0, lim = jArray.length(); i < lim; ++i) {
94 + add(new Coupon(jArray.optJSONObject(i)));
95 + }
96 + }
97 + }
98 +
77 @NonNull 99 @NonNull
78 public String getRequestSignature() { 100 public String getRequestSignature() {
79 return mRequestSignature; 101 return mRequestSignature;
......
...@@ -63,6 +63,7 @@ public class Couponset implements Parcelable, Serializable { ...@@ -63,6 +63,7 @@ public class Couponset implements Parcelable, Serializable {
63 private static final String POINTS = "points"; 63 private static final String POINTS = "points";
64 private static final String POINTS_CAUSE = "points_cause"; 64 private static final String POINTS_CAUSE = "points_cause";
65 private static final String EXPIRATION = "expiration"; 65 private static final String EXPIRATION = "expiration";
66 + private static final String VALUE = "value";
66 private static final String THIRD_PARTY_SERVICE = "third_party_service"; 67 private static final String THIRD_PARTY_SERVICE = "third_party_service";
67 private static final String NAME = "name"; 68 private static final String NAME = "name";
68 private static final String DESCRIPTION = "description"; 69 private static final String DESCRIPTION = "description";
...@@ -133,7 +134,14 @@ public class Couponset implements Parcelable, Serializable { ...@@ -133,7 +134,14 @@ public class Couponset implements Parcelable, Serializable {
133 this.limits = json.optJSONObject(LIMITS); 134 this.limits = json.optJSONObject(LIMITS);
134 this.points = json.optInt(POINTS); 135 this.points = json.optInt(POINTS);
135 this.points_cause = json.optString(POINTS_CAUSE); 136 this.points_cause = json.optString(POINTS_CAUSE);
136 - this.expiration = json.optString(EXPIRATION); 137 + JSONObject exp = null;
138 + try {
139 + exp = new JSONObject(json.optString(EXPIRATION));
140 + this.expiration = exp.optString(VALUE);
141 + } catch (JSONException e) {
142 + e.printStackTrace();
143 + this.expiration = "";
144 + }
137 this.third_party_service = json.optBoolean(THIRD_PARTY_SERVICE); 145 this.third_party_service = json.optBoolean(THIRD_PARTY_SERVICE);
138 this.name = json.optString(NAME); 146 this.name = json.optString(NAME);
139 this.description = json.optString(DESCRIPTION); 147 this.description = json.optString(DESCRIPTION);
......
1 +/*
2 + * Copyright 2010-2022 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.utils;
27 +
28 +import java.util.HashMap;
29 +
30 +import ly.warp.sdk.Warply;
31 +import ly.warp.sdk.db.WarplyDBHelper;
32 +import ly.warp.sdk.io.models.Campaign;
33 +import ly.warp.sdk.io.models.CampaignList;
34 +import ly.warp.sdk.io.models.Consumer;
35 +import ly.warp.sdk.io.models.CouponList;
36 +import ly.warp.sdk.io.models.CouponsetsList;
37 +
38 +/**
39 + * Created by Panagiotis Triantafyllou on 18-Apr-22.
40 + */
41 +
42 +public class WarplyManagerHelper {
43 + private static Consumer mConsumer;
44 + private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>();
45 + private static CouponList mCouponList = new CouponList();
46 + private static CouponsetsList mCouponsetsList = new CouponsetsList();
47 +
48 + public static String constructCampaignUrl(Campaign item) {
49 + String url = item.getIndexUrl()
50 + + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext())
51 + + "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext())
52 + + "&api_key=" + WarpUtils.getApiKey(Warply.getWarplyContext())
53 + + "&session_uuid=" + item.getSessionUUID()
54 + + "&access_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
55 + + "&refresh_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token")
56 + + "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id")
57 + + "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret");
58 + return url;
59 + }
60 +
61 + public static Consumer getConsumer() {
62 + return mConsumer;
63 + }
64 +
65 + public static HashMap<String, CampaignList> getUniqueCampaignList() {
66 + return mUniqueCampaignList;
67 + }
68 +
69 + public static CouponList getCouponList() {
70 + return mCouponList;
71 + }
72 +
73 + public static void setConsumer(Consumer consumer) {
74 + mConsumer = consumer;
75 + }
76 +
77 + public static void setUniqueCampaignList(HashMap<String, CampaignList> uniqueCouponList) {
78 + mUniqueCampaignList = uniqueCouponList;
79 + }
80 +
81 + public static void setCouponList(CouponList couponList) {
82 + mCouponList = couponList;
83 + }
84 +
85 + public static CouponsetsList getCouponsets() {
86 + return mCouponsetsList;
87 + }
88 +
89 + public static void setCouponsets(CouponsetsList couponsets) {
90 + mCouponsetsList = couponsets;
91 + }
92 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package ly.warp.sdk.views.adapters;
2 +
3 +import android.content.Context;
4 +import android.text.Html;
5 +import android.text.TextUtils;
6 +import android.view.LayoutInflater;
7 +import android.view.View;
8 +import android.view.ViewGroup;
9 +import android.widget.ImageView;
10 +import android.widget.TextView;
11 +
12 +import androidx.recyclerview.widget.RecyclerView;
13 +
14 +import com.bumptech.glide.Glide;
15 +import com.bumptech.glide.load.engine.DiskCacheStrategy;
16 +
17 +import java.text.ParseException;
18 +import java.text.SimpleDateFormat;
19 +import java.util.Date;
20 +import java.util.concurrent.TimeUnit;
21 +
22 +import io.reactivex.Observable;
23 +import io.reactivex.subjects.PublishSubject;
24 +import ly.warp.sdk.R;
25 +import ly.warp.sdk.io.models.Coupon;
26 +import ly.warp.sdk.io.models.CouponList;
27 +import ly.warp.sdk.io.models.Couponset;
28 +import ly.warp.sdk.io.models.CouponsetsList;
29 +
30 +public class CouponsetsAdapter extends RecyclerView.Adapter<CouponsetsAdapter.CouponsetViewHolder> {
31 +
32 + private Context mContext;
33 + private CouponsetsList mCouponsets;
34 + private final PublishSubject<Couponset> onClickSubject = PublishSubject.create();
35 +
36 + public CouponsetsAdapter(Context mContext, CouponsetsList couponsets) {
37 + this.mContext = mContext;
38 + this.mCouponsets = couponsets;
39 + }
40 +
41 + public class CouponsetViewHolder extends RecyclerView.ViewHolder {
42 + private ImageView ivCouponLogo;
43 + private TextView tvCouponTitle, tvCouponValue, tvCouponDate, tvCouponDescription;
44 +
45 + public CouponsetViewHolder(View view) {
46 + super(view);
47 + ivCouponLogo = view.findViewById(R.id.iv_active_coupon);
48 + tvCouponTitle = view.findViewById(R.id.tv_active_coupons_title);
49 + tvCouponValue = view.findViewById(R.id.tv_active_coupons_value);
50 + tvCouponDate = view.findViewById(R.id.tv_active_coupons_date);
51 + tvCouponDescription = view.findViewById(R.id.tv_active_coupons_description);
52 + }
53 + }
54 +
55 + @Override
56 + public int getItemCount() {
57 + if (mCouponsets == null)
58 + return 0;
59 + else
60 + return mCouponsets.size();
61 + }
62 +
63 +
64 + public Couponset getItem(int id) {
65 + return mCouponsets.get(id);
66 + }
67 +
68 + public void updateData(CouponsetsList couponsets) {
69 + mCouponsets.clear();
70 + mCouponsets.addAll(couponsets);
71 + notifyDataSetChanged();
72 + }
73 +
74 +
75 + @Override
76 + public CouponsetViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
77 + View itemView;
78 + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.active_coupon_layout, parent, false);
79 + return new CouponsetViewHolder(itemView);
80 + }
81 +
82 + @Override
83 + public void onBindViewHolder(final CouponsetViewHolder holder, int position) {
84 + Couponset couponsetItem = mCouponsets.get(position);
85 +
86 + if (couponsetItem != null) {
87 + if (!TextUtils.isEmpty(couponsetItem.getImgPreview())) {
88 + Glide.with(mContext)
89 +// .setDefaultRequestOptions(
90 +// RequestOptions
91 +// .placeholderOf(R.drawable.ic_default_contact_photo)
92 +// .error(R.drawable.ic_default_contact_photo))
93 + .load(couponsetItem.getImgPreview())
94 + .diskCacheStrategy(DiskCacheStrategy.DATA)
95 + .into(holder.ivCouponLogo);
96 + } else {
97 + Glide.with(mContext)
98 + .load(R.drawable.ic_cosmote_logo_horizontal_grey)
99 + .into(holder.ivCouponLogo);
100 + }
101 +
102 + holder.tvCouponTitle.setText(couponsetItem.getName());
103 + holder.tvCouponDescription.setText(Html.fromHtml(couponsetItem.getDescription()));
104 + Date date = null;
105 + try {
106 + date = new SimpleDateFormat().parse(couponsetItem.getExpiration());
107 + holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_active_coupon_date), String.valueOf(getDifferenceDays(date, new Date()))));
108 + } catch (ParseException e) {
109 + e.printStackTrace();
110 + }
111 +
112 + holder.tvCouponValue.setText(couponsetItem.getDiscount());
113 + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponsetItem));
114 + }
115 + }
116 +
117 + public Observable<Couponset> getPositionClicks() {
118 + return onClickSubject.cache();
119 + }
120 +
121 + private long getDifferenceDays(Date d1, Date d2) {
122 + long diff = d2.getTime() - d1.getTime();
123 + return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
124 + }
125 +}
1 +package ly.warp.sdk.views.adapters.mix;
2 +
3 +import android.content.Context;
4 +import android.text.TextUtils;
5 +import android.view.LayoutInflater;
6 +import android.view.View;
7 +import android.view.ViewGroup;
8 +import android.widget.ImageView;
9 +import android.widget.TextView;
10 +
11 +import androidx.core.content.ContextCompat;
12 +import androidx.recyclerview.widget.RecyclerView;
13 +
14 +import com.bumptech.glide.Glide;
15 +import com.bumptech.glide.load.engine.DiskCacheStrategy;
16 +
17 +import java.text.ParseException;
18 +import java.text.SimpleDateFormat;
19 +import java.util.Date;
20 +import java.util.concurrent.TimeUnit;
21 +
22 +import io.reactivex.Observable;
23 +import io.reactivex.subjects.PublishSubject;
24 +import ly.warp.sdk.R;
25 +import ly.warp.sdk.activities.BaseFragmentActivity;
26 +import ly.warp.sdk.io.models.Coupon;
27 +import ly.warp.sdk.io.models.CouponList;
28 +
29 +public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapter.ActiveCouponViewHolder> {
30 +
31 + private Context mContext;
32 + private CouponList mCoupons;
33 + private final PublishSubject<Coupon> onClickSubject = PublishSubject.create();
34 +
35 + public ActiveCouponAdapter(Context mContext, CouponList campaignList) {
36 + this.mContext = mContext;
37 + this.mCoupons = campaignList;
38 + }
39 +
40 + public class ActiveCouponViewHolder extends RecyclerView.ViewHolder {
41 + private ImageView ivCouponLogo;
42 + private TextView tvCouponTitle, tvCouponValue, tvCouponDate, tvCouponDescription;
43 +
44 + public ActiveCouponViewHolder(View view) {
45 + super(view);
46 + ivCouponLogo = view.findViewById(R.id.iv_active_coupon);
47 + tvCouponTitle = view.findViewById(R.id.tv_active_coupons_title);
48 + tvCouponValue = view.findViewById(R.id.tv_active_coupons_value);
49 + tvCouponDate = view.findViewById(R.id.tv_active_coupons_date);
50 + tvCouponDescription = view.findViewById(R.id.tv_active_coupons_description);
51 + }
52 + }
53 +
54 + @Override
55 + public int getItemCount() {
56 + if (mCoupons == null)
57 + return 0;
58 + else
59 + return mCoupons.size();
60 + }
61 +
62 +
63 + public Coupon getItem(int id) {
64 + return mCoupons.get(id);
65 + }
66 +
67 + public void updateData(CouponList couponList) {
68 + mCoupons.clear();
69 + mCoupons.addAll(couponList);
70 + notifyDataSetChanged();
71 + }
72 +
73 +
74 + @Override
75 + public ActiveCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
76 + View itemView;
77 + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.active_coupon_layout, parent, false);
78 + return new ActiveCouponViewHolder(itemView);
79 + }
80 +
81 + @Override
82 + public void onBindViewHolder(final ActiveCouponViewHolder holder, int position) {
83 + Coupon couponItem = mCoupons.get(position);
84 +
85 + if (couponItem != null) {
86 + if (!TextUtils.isEmpty(couponItem.getImage())) {
87 + Glide.with(mContext)
88 +// .setDefaultRequestOptions(
89 +// RequestOptions
90 +// .placeholderOf(R.drawable.ic_default_contact_photo)
91 +// .error(R.drawable.ic_default_contact_photo))
92 + .load(couponItem.getImage())
93 + .diskCacheStrategy(DiskCacheStrategy.DATA)
94 + .into(holder.ivCouponLogo);
95 + } else {
96 + Glide.with(mContext)
97 + .load(R.drawable.ic_cosmote_logo_horizontal_grey)
98 + .into(holder.ivCouponLogo);
99 + }
100 +
101 + holder.tvCouponTitle.setText(couponItem.getName());
102 + holder.tvCouponDescription.setText(couponItem.getDescription());
103 + Date date = null;
104 + try {
105 + date = new SimpleDateFormat().parse(couponItem.getExpiration());
106 + holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_active_coupon_date), String.valueOf(getDifferenceDays(date, new Date()))));
107 + } catch (ParseException e) {
108 + e.printStackTrace();
109 + }
110 +
111 + holder.tvCouponValue.setText(couponItem.getDiscount());
112 + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
113 + }
114 + }
115 +
116 + public Observable<Coupon> getPositionClicks() {
117 + return onClickSubject.cache();
118 + }
119 +
120 + private long getDifferenceDays(Date d1, Date d2) {
121 + long diff = d2.getTime() - d1.getTime();
122 + return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
123 + }
124 +}
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item android:drawable="@drawable/shape_cos_green_tr" android:state_pressed="true" />
4 + <item android:drawable="@drawable/shape_cos_green" android:state_pressed="false" />
5 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="rectangle">
4 + <corners android:radius="7dp" />
5 +
6 + <solid
7 + android:width="2dp"
8 + android:color="@color/cos_green5" />
9 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="rectangle">
4 + <corners android:radius="7dp" />
5 +
6 + <solid
7 + android:width="2dp"
8 + android:color="@color/cos_green5_tr" />
9 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="rectangle">
4 + <corners android:topLeftRadius="30dp" />
5 +
6 + <gradient
7 + android:startColor="@color/skyblue"
8 + android:endColor="@color/cos_green4"
9 + android:type="linear"
10 + android:angle="270"/>
11 +
12 +<!-- <stroke-->
13 +<!-- android:width="1dp"-->
14 +<!-- android:color="@color/cos_green" />-->
15 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
2 + android:shape="rectangle">
3 + <corners android:topLeftRadius="27dp" />
4 + <solid android:color="@color/white" />
5 +</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:layout_width="match_parent"
6 + android:layout_height="140dp"
7 + android:layout_marginBottom="16dp"
8 + android:background="@drawable/ic_coupon_background">
9 +
10 + <androidx.constraintlayout.widget.Guideline
11 + android:id="@+id/gl_vertical_72_percent"
12 + android:layout_width="wrap_content"
13 + android:layout_height="wrap_content"
14 + android:orientation="vertical"
15 + app:layout_constraintGuide_percent="0.72" />
16 +
17 + <ImageView
18 + android:id="@+id/iv_active_coupon"
19 + android:layout_width="80dp"
20 + android:layout_height="80dp"
21 + android:layout_marginStart="24dp"
22 + app:layout_constraintBottom_toBottomOf="parent"
23 + app:layout_constraintStart_toStartOf="parent"
24 + app:layout_constraintTop_toTopOf="parent"
25 + tools:src="@drawable/ic_gifts_for_you" />
26 +
27 + <View
28 + android:id="@+id/v_separator"
29 + android:layout_width="1dp"
30 + android:layout_height="match_parent"
31 + android:layout_marginVertical="16dp"
32 + android:layout_marginStart="8dp"
33 + android:background="@color/grey2"
34 + app:layout_constraintBottom_toBottomOf="parent"
35 + app:layout_constraintStart_toEndOf="@+id/iv_active_coupon"
36 + app:layout_constraintTop_toTopOf="parent" />
37 +
38 + <LinearLayout
39 + android:id="@+id/ll_coupon_info"
40 + android:layout_width="0dp"
41 + android:layout_height="wrap_content"
42 + android:layout_marginStart="16dp"
43 + android:orientation="vertical"
44 + app:layout_constraintBottom_toBottomOf="parent"
45 + app:layout_constraintEnd_toStartOf="@+id/gl_vertical_72_percent"
46 + app:layout_constraintStart_toEndOf="@+id/v_separator"
47 + app:layout_constraintTop_toTopOf="parent">
48 +
49 + <TextView
50 + android:id="@+id/tv_active_coupons_title"
51 + android:layout_width="wrap_content"
52 + android:layout_height="wrap_content"
53 + android:maxLines="2"
54 + android:textColor="#3A5266"
55 + android:textFontWeight="600"
56 + android:textSize="16sp"
57 + tools:text="Εκπτωτικο κουπονι 10$ για αγορες στα ΙΚΕΑ" />
58 +
59 + <TextView
60 + android:id="@+id/tv_active_coupons_value"
61 + android:layout_width="wrap_content"
62 + android:layout_height="wrap_content"
63 + android:textColor="#3A5266"
64 + android:textSize="28sp"
65 + android:textStyle="bold"
66 + tools:text="10$" />
67 +
68 + <TextView
69 + android:id="@+id/tv_active_coupons_date"
70 + android:layout_width="wrap_content"
71 + android:layout_height="wrap_content"
72 + android:textColor="#617181"
73 + android:textFontWeight="600"
74 + android:textSize="12sp"
75 + tools:text="@string/cos_active_coupon_date" />
76 + </LinearLayout>
77 +
78 + <TextView
79 + android:id="@+id/tv_active_coupons_description"
80 + android:layout_width="0dp"
81 + android:layout_height="wrap_content"
82 + android:layout_marginStart="24dp"
83 + android:layout_marginEnd="32dp"
84 + android:maxLines="4"
85 + android:textColor="#617181"
86 + android:textFontWeight="600"
87 + android:textSize="12sp"
88 + app:layout_constraintBottom_toBottomOf="parent"
89 + app:layout_constraintEnd_toEndOf="parent"
90 + app:layout_constraintStart_toEndOf="@+id/gl_vertical_72_percent"
91 + app:layout_constraintTop_toTopOf="parent"
92 + tools:text="Εκπτωση με ελάχιστες αγορές 100€" />
93 +</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 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto"
4 + android:id="@+id/cl_bill_payment"
5 + android:layout_width="match_parent"
6 + android:layout_height="match_parent">
7 +
8 + <androidx.constraintlayout.widget.ConstraintLayout
9 + android:id="@+id/cl_bill_header"
10 + android:layout_width="match_parent"
11 + android:layout_height="80dp"
12 + app:layout_constraintTop_toTopOf="parent">
13 +
14 + <ImageView
15 + android:id="@+id/iv_coupons_close"
16 + android:layout_width="21dp"
17 + android:layout_height="20dp"
18 + android:layout_marginStart="24dp"
19 + android:layout_marginTop="4dp"
20 + android:src="@drawable/ic_back"
21 + app:layout_constraintStart_toStartOf="parent"
22 + app:layout_constraintTop_toTopOf="@+id/textView3" />
23 +
24 + <TextView
25 + android:id="@+id/textView3"
26 + android:layout_width="206dp"
27 + android:layout_height="32dp"
28 + android:gravity="center"
29 + android:text="Όλα τα κουπόνια μου"
30 + android:textColor="@color/grey"
31 + android:textSize="17sp"
32 + android:textStyle="bold"
33 + app:layout_constraintBottom_toBottomOf="parent"
34 + app:layout_constraintEnd_toEndOf="parent"
35 + app:layout_constraintHorizontal_bias="0.356"
36 + app:layout_constraintStart_toEndOf="@+id/iv_coupons_close"
37 + app:layout_constraintTop_toTopOf="parent" />
38 + </androidx.constraintlayout.widget.ConstraintLayout>
39 +
40 + <androidx.constraintlayout.widget.ConstraintLayout
41 + android:layout_width="match_parent"
42 + android:layout_height="match_parent"
43 + android:layout_below="@+id/cl_bill_header"
44 + android:layout_marginTop="1dp"
45 + android:background="@drawable/shape_cos_loyalty"
46 + android:orientation="vertical">
47 +
48 + <androidx.recyclerview.widget.RecyclerView
49 + android:id="@+id/rv_active_coupons"
50 + android:layout_width="match_parent"
51 + android:layout_height="0dp"
52 + android:paddingTop="48dp"
53 + app:layout_constraintBottom_toBottomOf="parent"
54 + app:layout_constraintEnd_toEndOf="parent"
55 + app:layout_constraintStart_toStartOf="parent"
56 + app:layout_constraintTop_toTopOf="parent" />
57 + </androidx.constraintlayout.widget.ConstraintLayout>
58 +
59 + <TextView
60 + android:id="@+id/tv_no_coupons"
61 + android:layout_width="wrap_content"
62 + android:layout_height="wrap_content"
63 + android:layout_centerInParent="true"
64 + android:text="Δεν υπάρχουν κουπόνια"
65 + android:textColor="@color/grey"
66 + android:textSize="18sp"
67 + android:visibility="gone"
68 + android:textStyle="bold" />
69 +</RelativeLayout>
...\ No newline at end of file ...\ No newline at end of file
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:app="http://schemas.android.com/apk/res-auto" 2 xmlns:app="http://schemas.android.com/apk/res-auto"
3 + xmlns:tools="http://schemas.android.com/tools"
3 android:layout_width="match_parent" 4 android:layout_width="match_parent"
4 android:layout_height="match_parent" 5 android:layout_height="match_parent"
5 - xmlns:tools="http://schemas.android.com/tools"
6 android:background="@android:color/white"> 6 android:background="@android:color/white">
7 7
8 <androidx.constraintlayout.widget.ConstraintLayout 8 <androidx.constraintlayout.widget.ConstraintLayout
...@@ -54,15 +54,15 @@ ...@@ -54,15 +54,15 @@
54 app:layout_constraintStart_toStartOf="parent" 54 app:layout_constraintStart_toStartOf="parent"
55 app:layout_constraintTop_toTopOf="parent"> 55 app:layout_constraintTop_toTopOf="parent">
56 56
57 - <ImageView 57 + <com.github.siyamed.shapeimageview.mask.PorterShapeImageView
58 android:id="@+id/imageView6" 58 android:id="@+id/imageView6"
59 android:layout_width="match_parent" 59 android:layout_width="match_parent"
60 android:layout_height="224dp" 60 android:layout_height="224dp"
61 - android:clipToOutline="true"
62 android:scaleType="centerCrop" 61 android:scaleType="centerCrop"
63 - android:src="@drawable/carousel_banner"
64 app:layout_constraintStart_toStartOf="parent" 62 app:layout_constraintStart_toStartOf="parent"
65 - app:layout_constraintTop_toTopOf="parent" /> 63 + app:layout_constraintTop_toTopOf="parent"
64 + app:siShape="@drawable/shape_top_left_rounded"
65 + tools:src="@drawable/carousel_banner" />
66 66
67 <TextView 67 <TextView
68 android:id="@+id/textView13" 68 android:id="@+id/textView13"
...@@ -184,29 +184,29 @@ ...@@ -184,29 +184,29 @@
184 android:textStyle="bold" /> 184 android:textStyle="bold" />
185 </LinearLayout> 185 </LinearLayout>
186 186
187 - <LinearLayout 187 + <!-- <LinearLayout-->
188 - android:id="@+id/ll_get_gift" 188 + <!-- android:id="@+id/ll_get_gift"-->
189 - android:layout_width="match_parent" 189 + <!-- android:layout_width="match_parent"-->
190 - android:layout_height="50dp" 190 + <!-- android:layout_height="50dp"-->
191 - android:layout_marginHorizontal="32dp" 191 + <!-- android:layout_marginHorizontal="32dp"-->
192 - android:layout_marginTop="24dp" 192 + <!-- android:layout_marginTop="24dp"-->
193 - android:background="@drawable/shape_cos_gradient2" 193 + <!-- android:background="@drawable/shape_cos_gradient2"-->
194 - android:gravity="center" 194 + <!-- android:gravity="center"-->
195 - android:orientation="horizontal" 195 + <!-- android:orientation="horizontal"-->
196 - app:layout_constraintEnd_toEndOf="parent" 196 + <!-- app:layout_constraintEnd_toEndOf="parent"-->
197 - app:layout_constraintHorizontal_bias="0.516" 197 + <!-- app:layout_constraintHorizontal_bias="0.516"-->
198 - app:layout_constraintStart_toStartOf="parent" 198 + <!-- app:layout_constraintStart_toStartOf="parent"-->
199 - app:layout_constraintTop_toBottomOf="@+id/ll_gift_it"> 199 + <!-- app:layout_constraintTop_toBottomOf="@+id/ll_gift_it">-->
200 - 200 +
201 - <TextView 201 + <!-- <TextView-->
202 - android:layout_width="wrap_content" 202 + <!-- android:layout_width="wrap_content"-->
203 - android:layout_height="wrap_content" 203 + <!-- android:layout_height="wrap_content"-->
204 - android:gravity="center" 204 + <!-- android:gravity="center"-->
205 - android:text="Πάρε το δώρο σου" 205 + <!-- android:text="Πάρε το δώρο σου"-->
206 - android:textColor="@color/white" 206 + <!-- android:textColor="@color/white"-->
207 - android:textSize="17dp" 207 + <!-- android:textSize="17dp"-->
208 - android:textStyle="bold" /> 208 + <!-- android:textStyle="bold" />-->
209 - </LinearLayout> 209 + <!-- </LinearLayout>-->
210 210
211 <TextView 211 <TextView
212 android:id="@+id/tv_terms" 212 android:id="@+id/tv_terms"
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
219 android:textSize="15sp" 219 android:textSize="15sp"
220 app:layout_constraintEnd_toEndOf="parent" 220 app:layout_constraintEnd_toEndOf="parent"
221 app:layout_constraintStart_toStartOf="parent" 221 app:layout_constraintStart_toStartOf="parent"
222 - app:layout_constraintTop_toBottomOf="@+id/ll_get_gift" /> 222 + app:layout_constraintTop_toBottomOf="@+id/ll_gift_it" />
223 223
224 <ImageView 224 <ImageView
225 android:id="@+id/iv_barcode" 225 android:id="@+id/iv_barcode"
......
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="50dp"
12 + android:background="@android:color/white">
13 +
14 + <ImageView
15 + android:id="@+id/iv_couponset_info_back"
16 + android:layout_width="20dp"
17 + android:layout_height="20dp"
18 + android:layout_marginStart="16dp"
19 + android:src="@drawable/ic_back"
20 + app:layout_constraintBottom_toBottomOf="parent"
21 + app:layout_constraintStart_toStartOf="parent"
22 + app:layout_constraintTop_toTopOf="parent" />
23 +
24 + <TextView
25 + android:layout_width="wrap_content"
26 + android:layout_height="wrap_content"
27 + android:text="@string/cos_coupon_info_title"
28 + android:textColor="@color/grey"
29 + android:textSize="17sp"
30 + android:textStyle="bold"
31 + app:layout_constraintBottom_toBottomOf="parent"
32 + app:layout_constraintEnd_toEndOf="parent"
33 + app:layout_constraintStart_toStartOf="parent"
34 + app:layout_constraintTop_toTopOf="parent" />
35 + </androidx.constraintlayout.widget.ConstraintLayout>
36 +
37 + <ScrollView
38 + android:layout_width="match_parent"
39 + android:layout_height="match_parent"
40 + android:layout_below="@+id/cl_loyalty_wallet_header"
41 + android:fillViewport="true">
42 +
43 + <RelativeLayout
44 + android:layout_width="match_parent"
45 + android:layout_height="match_parent"
46 + android:background="@android:color/white">
47 +
48 + <androidx.constraintlayout.widget.ConstraintLayout
49 + android:id="@+id/cl_loyalty_info_view_inner"
50 + android:layout_width="match_parent"
51 + android:layout_height="match_parent"
52 + android:background="@drawable/shape_cos_coupon_info"
53 + app:layout_constraintEnd_toEndOf="parent"
54 + app:layout_constraintStart_toStartOf="parent"
55 + app:layout_constraintTop_toTopOf="parent">
56 +
57 + <com.github.siyamed.shapeimageview.mask.PorterShapeImageView
58 + android:id="@+id/imageView6"
59 + android:layout_width="match_parent"
60 + android:layout_height="224dp"
61 + android:scaleType="centerCrop"
62 + android:src="@drawable/carousel_banner"
63 + app:layout_constraintStart_toStartOf="parent"
64 + app:layout_constraintTop_toTopOf="parent"
65 + app:siShape="@drawable/shape_top_left_rounded" />
66 +
67 + <TextView
68 + android:id="@+id/textView13"
69 + android:layout_width="match_parent"
70 + android:layout_height="wrap_content"
71 + android:layout_marginTop="32dp"
72 + android:paddingHorizontal="32dp"
73 + android:textColor="#415564"
74 + android:textSize="18sp"
75 + android:textStyle="bold"
76 + app:layout_constraintEnd_toEndOf="parent"
77 + app:layout_constraintHorizontal_bias="0.509"
78 + app:layout_constraintStart_toStartOf="parent"
79 + app:layout_constraintTop_toBottomOf="@+id/imageView6"
80 + tools:text="Πάρε δωρεάν μηνιαία πακέτα με πάνες στα supermarket Σκλαβενίτης!" />
81 +
82 + <TextView
83 + android:id="@+id/textView14"
84 + android:layout_width="match_parent"
85 + android:layout_height="wrap_content"
86 + android:layout_marginTop="16dp"
87 + android:paddingHorizontal="32dp"
88 + android:textColor="#415564"
89 + android:textSize="16sp"
90 + app:layout_constraintEnd_toEndOf="parent"
91 + app:layout_constraintStart_toStartOf="parent"
92 + app:layout_constraintTop_toBottomOf="@+id/textView13"
93 + tools:text="Χρησιμοποίησε τον παρακάτω κωδικό και πάρε δωρεάν πακέτο πάνες Pampers αποκλειστικά στα Supermarket Σκλαβενίτης" />
94 +
95 + <LinearLayout
96 + android:id="@+id/ll_get_gift"
97 + android:layout_width="match_parent"
98 + android:layout_height="50dp"
99 + android:layout_marginHorizontal="32dp"
100 + android:layout_marginBottom="32dp"
101 + android:background="@drawable/selector_button_green"
102 + android:gravity="center"
103 + android:orientation="horizontal"
104 + app:layout_constraintBottom_toTopOf="@+id/tv_terms"
105 + app:layout_constraintEnd_toEndOf="parent"
106 + app:layout_constraintStart_toStartOf="parent">
107 +
108 + <TextView
109 + android:layout_width="wrap_content"
110 + android:layout_height="wrap_content"
111 + android:gravity="center"
112 + android:text="@string/cos_redeem_coupon"
113 + android:textColor="@color/white"
114 + android:textSize="17dp"
115 + android:textStyle="bold" />
116 + </LinearLayout>
117 +
118 + <TextView
119 + android:id="@+id/tv_terms"
120 + android:layout_width="wrap_content"
121 + android:layout_height="wrap_content"
122 + android:layout_marginBottom="32dp"
123 + android:text="@string/cos_coupon_terms_title"
124 + android:textColor="#415564"
125 + android:textFontWeight="600"
126 + android:textSize="15sp"
127 + app:layout_constraintBottom_toBottomOf="parent"
128 + app:layout_constraintEnd_toEndOf="parent"
129 + app:layout_constraintStart_toStartOf="parent" />
130 +
131 + <ProgressBar
132 + android:id="@+id/pb_loading"
133 + android:layout_width="48dp"
134 + android:layout_height="48dp"
135 + android:indeterminate="true"
136 + android:indeterminateTint="@color/cos_green5"
137 + android:indeterminateTintMode="src_atop"
138 + android:visibility="gone"
139 + app:layout_constraintBottom_toBottomOf="parent"
140 + app:layout_constraintEnd_toEndOf="parent"
141 + app:layout_constraintStart_toStartOf="parent"
142 + app:layout_constraintTop_toTopOf="parent"
143 + tools:visibility="visible" />
144 + </androidx.constraintlayout.widget.ConstraintLayout>
145 + </RelativeLayout>
146 + </ScrollView>
147 +</RelativeLayout>
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<ScrollView 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="match_parent"
7 + android:background="@android:color/white"
8 + android:fillViewport="true">
9 +
10 + <LinearLayout
11 + android:id="@+id/cl_bill_payment"
12 + android:layout_width="match_parent"
13 + android:layout_height="match_parent"
14 + android:orientation="vertical">
15 +
16 + <androidx.constraintlayout.widget.ConstraintLayout
17 + android:id="@+id/cl_bill_header"
18 + android:layout_width="match_parent"
19 + android:layout_height="80dp"
20 + app:layout_constraintTop_toTopOf="parent">
21 +
22 + <ImageView
23 + android:id="@+id/iv_list_close"
24 + android:layout_width="21dp"
25 + android:layout_height="20dp"
26 + android:layout_marginStart="24dp"
27 + android:layout_marginTop="4dp"
28 + android:src="@drawable/ic_back"
29 + app:layout_constraintStart_toStartOf="parent"
30 + app:layout_constraintTop_toTopOf="@+id/textView3" />
31 +
32 + <TextView
33 + android:id="@+id/textView3"
34 + android:layout_width="206dp"
35 + android:layout_height="32dp"
36 + android:gravity="center"
37 + android:textColor="@color/grey"
38 + android:textSize="17sp"
39 + android:textStyle="bold"
40 + app:layout_constraintBottom_toBottomOf="parent"
41 + app:layout_constraintEnd_toEndOf="parent"
42 + app:layout_constraintHorizontal_bias="0.356"
43 + app:layout_constraintStart_toEndOf="@+id/iv_list_close"
44 + app:layout_constraintTop_toTopOf="parent" />
45 + </androidx.constraintlayout.widget.ConstraintLayout>
46 +
47 + <RelativeLayout
48 + android:layout_width="match_parent"
49 + android:layout_height="match_parent"
50 + android:background="@drawable/shape_cos_profile_gradient"
51 + android:orientation="vertical"
52 + android:paddingBottom="24dp">
53 +
54 + <androidx.constraintlayout.widget.ConstraintLayout
55 + android:id="@+id/cl_recycler_inner"
56 + android:layout_width="match_parent"
57 + android:layout_height="wrap_content"
58 + android:layout_marginTop="36dp"
59 + android:paddingBottom="4dp"
60 + app:layout_constraintLeft_toLeftOf="parent"
61 + app:layout_constraintRight_toRightOf="parent"
62 + app:layout_constraintTop_toTopOf="parent">
63 +
64 + <TextView
65 + android:id="@+id/tv_gifts_title"
66 + android:layout_width="wrap_content"
67 + android:layout_height="wrap_content"
68 + android:layout_marginStart="10dp"
69 + android:text="@string/cos_gifts_title2"
70 + android:textColor="@android:color/white"
71 + android:textSize="18sp"
72 + android:textStyle="bold"
73 + app:layout_constraintStart_toStartOf="parent"
74 + app:layout_constraintTop_toTopOf="parent" />
75 +
76 + <androidx.recyclerview.widget.RecyclerView
77 + android:id="@+id/rv_gifts"
78 + android:layout_width="match_parent"
79 + android:layout_height="wrap_content"
80 + android:layout_marginTop="24dp"
81 + android:clipToPadding="false"
82 + android:orientation="horizontal"
83 + android:paddingEnd="10dp"
84 + app:layout_constraintBottom_toBottomOf="parent"
85 + app:layout_constraintLeft_toLeftOf="parent"
86 + app:layout_constraintRight_toRightOf="parent"
87 + app:layout_constraintTop_toBottomOf="@+id/tv_gifts_title" />
88 + </androidx.constraintlayout.widget.ConstraintLayout>
89 +
90 + <androidx.constraintlayout.widget.ConstraintLayout
91 + android:id="@+id/cl_recycler_inner2"
92 + android:layout_width="match_parent"
93 + android:layout_height="wrap_content"
94 + android:layout_below="@+id/cl_recycler_inner"
95 + android:layout_marginTop="36dp"
96 + android:paddingBottom="4dp"
97 + app:layout_constraintLeft_toLeftOf="parent"
98 + app:layout_constraintRight_toRightOf="parent"
99 + app:layout_constraintTop_toTopOf="parent">
100 +
101 + <TextView
102 + android:id="@+id/tv_rewards_title"
103 + android:layout_width="wrap_content"
104 + android:layout_height="wrap_content"
105 + android:layout_marginStart="10dp"
106 + android:text="@string/cos_rewards_title"
107 + android:textColor="@android:color/white"
108 + android:textSize="18sp"
109 + android:textStyle="bold"
110 + app:layout_constraintStart_toStartOf="parent"
111 + app:layout_constraintTop_toTopOf="parent" />
112 +
113 + <androidx.recyclerview.widget.RecyclerView
114 + android:id="@+id/rv_rewards"
115 + android:layout_width="match_parent"
116 + android:layout_height="wrap_content"
117 + android:layout_marginTop="24dp"
118 + android:clipToPadding="false"
119 + android:orientation="horizontal"
120 + android:paddingEnd="10dp"
121 + app:layout_constraintBottom_toBottomOf="parent"
122 + app:layout_constraintLeft_toLeftOf="parent"
123 + app:layout_constraintRight_toRightOf="parent"
124 + app:layout_constraintTop_toBottomOf="@+id/tv_rewards_title" />
125 + </androidx.constraintlayout.widget.ConstraintLayout>
126 +
127 + <androidx.constraintlayout.widget.ConstraintLayout
128 + android:id="@+id/cl_recycler_inner3"
129 + android:layout_width="match_parent"
130 + android:layout_height="wrap_content"
131 + android:layout_below="@+id/cl_recycler_inner2"
132 + android:layout_marginTop="36dp"
133 + android:paddingBottom="4dp"
134 + app:layout_constraintLeft_toLeftOf="parent"
135 + app:layout_constraintRight_toRightOf="parent"
136 + app:layout_constraintTop_toTopOf="parent">
137 +
138 + <TextView
139 + android:id="@+id/tv_coupons_title"
140 + android:layout_width="wrap_content"
141 + android:layout_height="wrap_content"
142 + android:layout_marginStart="10dp"
143 + android:text="@string/cos_coupons_title"
144 + android:textColor="@android:color/white"
145 + android:textSize="18sp"
146 + android:textStyle="bold"
147 + app:layout_constraintStart_toStartOf="parent"
148 + app:layout_constraintTop_toTopOf="parent" />
149 +
150 + <androidx.recyclerview.widget.RecyclerView
151 + android:id="@+id/rv_coupons"
152 + android:layout_width="match_parent"
153 + android:layout_height="wrap_content"
154 + android:layout_marginTop="24dp"
155 + android:clipToPadding="false"
156 + android:orientation="horizontal"
157 + android:paddingEnd="24dp"
158 + app:layout_constraintBottom_toBottomOf="parent"
159 + app:layout_constraintLeft_toLeftOf="parent"
160 + app:layout_constraintRight_toRightOf="parent"
161 + app:layout_constraintTop_toBottomOf="@+id/tv_coupons_title" />
162 + </androidx.constraintlayout.widget.ConstraintLayout>
163 + </RelativeLayout>
164 + </LinearLayout>
165 +</ScrollView>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<RelativeLayout 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="wrap_content"
7 + android:layout_gravity="center_horizontal"
8 + android:paddingHorizontal="16dp"
9 + android:paddingVertical="56dp">
10 +
11 + <TextView
12 + android:id="@+id/tv_dl_title"
13 + android:layout_width="match_parent"
14 + android:layout_height="55dp"
15 + android:layout_alignParentStart="true"
16 + android:layout_alignParentTop="true"
17 + android:layout_alignParentEnd="true"
18 + android:layout_marginHorizontal="48dp"
19 + android:gravity="center"
20 + tools:text="@string/cos_dlg_success_title"
21 + android:textColor="#0072C9"
22 + android:textSize="25sp"
23 + android:textStyle="bold"
24 + app:layout_constraintTop_toTopOf="parent" />
25 +
26 + <TextView
27 + android:id="@+id/tv_dl_subtitle"
28 + android:layout_width="match_parent"
29 + android:layout_height="wrap_content"
30 + android:layout_below="@+id/tv_dl_title"
31 + android:layout_alignParentStart="true"
32 + android:layout_alignParentEnd="true"
33 + android:layout_marginHorizontal="48dp"
34 + android:layout_marginTop="16dp"
35 + android:layout_marginBottom="24dp"
36 + android:gravity="center"
37 + tools:text="@string/cos_dlg_success_subtitle"
38 + android:textColor="#5B5B5B"
39 + android:textFontWeight="500"
40 + android:textSize="18sp" />
41 +
42 + <LinearLayout
43 + android:id="@+id/ll_dl_redeem"
44 + android:layout_width="match_parent"
45 + android:layout_height="50dp"
46 + android:layout_below="@+id/tv_dl_subtitle"
47 + android:layout_marginHorizontal="32dp"
48 + android:layout_marginTop="24dp"
49 + android:background="@drawable/selector_button_green"
50 + android:gravity="center"
51 + android:orientation="horizontal">
52 +
53 + <TextView
54 + android:layout_width="wrap_content"
55 + android:layout_height="wrap_content"
56 + android:gravity="center"
57 + android:text="ΟΚ"
58 + android:textColor="@color/white"
59 + android:textSize="17dp"
60 + android:textStyle="bold" />
61 + </LinearLayout>
62 +
63 +</RelativeLayout>
...\ No newline at end of file ...\ No newline at end of file
...@@ -35,8 +35,7 @@ ...@@ -35,8 +35,7 @@
35 android:paddingLeft="10dp" 35 android:paddingLeft="10dp"
36 app:layout_constraintEnd_toStartOf="@+id/iv_settings" 36 app:layout_constraintEnd_toStartOf="@+id/iv_settings"
37 app:layout_constraintStart_toEndOf="@+id/user_img" 37 app:layout_constraintStart_toEndOf="@+id/user_img"
38 - app:layout_constraintTop_toTopOf="@+id/user_img" 38 + app:layout_constraintTop_toTopOf="@+id/user_img">
39 - tools:layout_editor_absoluteY="-10dp">
40 39
41 <TextView 40 <TextView
42 android:id="@+id/welcome_user_txt" 41 android:id="@+id/welcome_user_txt"
...@@ -45,8 +44,8 @@ ...@@ -45,8 +44,8 @@
45 android:layout_marginBottom="8dp" 44 android:layout_marginBottom="8dp"
46 android:maxLines="1" 45 android:maxLines="1"
47 android:scrollHorizontally="true" 46 android:scrollHorizontally="true"
48 - tools:text="@string/welcome_user" 47 + android:textColor="#415564"
49 - android:textColor="#415564" /> 48 + tools:text="@string/welcome_user" />
50 49
51 <ImageView 50 <ImageView
52 android:id="@+id/cosmote_one" 51 android:id="@+id/cosmote_one"
...@@ -121,7 +120,8 @@ ...@@ -121,7 +120,8 @@
121 android:id="@+id/rl_home_coupons" 120 android:id="@+id/rl_home_coupons"
122 android:layout_width="match_parent" 121 android:layout_width="match_parent"
123 android:layout_height="wrap_content" 122 android:layout_height="wrap_content"
124 - android:layout_below="@id/rl_home_campaigns"> 123 + android:layout_below="@id/rl_home_campaigns"
124 + android:visibility="gone">
125 125
126 <androidx.recyclerview.widget.RecyclerView 126 <androidx.recyclerview.widget.RecyclerView
127 android:id="@+id/rv_home_coupons" 127 android:id="@+id/rv_home_coupons"
...@@ -141,12 +141,57 @@ ...@@ -141,12 +141,57 @@
141 android:layout_below="@id/rl_home_coupons" 141 android:layout_below="@id/rl_home_coupons"
142 android:layout_marginHorizontal="8dp" /> 142 android:layout_marginHorizontal="8dp" />
143 143
144 + <androidx.constraintlayout.widget.ConstraintLayout
145 + android:id="@+id/cl_coupon"
146 + android:layout_width="match_parent"
147 + android:layout_height="140dp"
148 + android:layout_below="@+id/rl_home_info_widget"
149 + android:layout_marginTop="24dp"
150 + android:background="@drawable/ic_coupon_background">
151 +
152 + <LinearLayout
153 + android:layout_width="wrap_content"
154 + android:layout_height="wrap_content"
155 + android:layout_marginStart="40dp"
156 + android:orientation="vertical"
157 + app:layout_constraintBottom_toBottomOf="parent"
158 + app:layout_constraintStart_toStartOf="parent"
159 + app:layout_constraintTop_toTopOf="parent">
160 +
161 + <TextView
162 + android:id="@+id/tv_active_coupons"
163 + android:layout_width="wrap_content"
164 + android:layout_height="wrap_content"
165 + android:layout_marginBottom="8dp"
166 + android:textColor="#3A5266"
167 + android:textFontWeight="600"
168 + android:textSize="16sp"
169 + tools:text="@string/cos_active_coupons" />
170 +
171 + <TextView
172 + android:layout_width="wrap_content"
173 + android:layout_height="wrap_content"
174 + android:layout_marginTop="8dp"
175 + android:text="Δες τα όλα ->"
176 + android:textColor="#3A5266" />
177 + </LinearLayout>
178 +
179 + <ImageView
180 + android:layout_width="90dp"
181 + android:layout_height="90dp"
182 + android:layout_marginEnd="32dp"
183 + android:src="@drawable/ic_gifts_for_you"
184 + app:layout_constraintBottom_toBottomOf="parent"
185 + app:layout_constraintEnd_toEndOf="parent"
186 + app:layout_constraintTop_toTopOf="parent" />
187 + </androidx.constraintlayout.widget.ConstraintLayout>
188 +
144 <TextView 189 <TextView
145 android:id="@+id/hsv_title" 190 android:id="@+id/hsv_title"
146 android:layout_width="match_parent" 191 android:layout_width="match_parent"
147 android:layout_height="40dp" 192 android:layout_height="40dp"
148 - android:layout_below="@+id/rl_home_info_widget" 193 + android:layout_below="@+id/cl_coupon"
149 - android:layout_marginTop="25dp" 194 + android:layout_marginTop="24dp"
150 android:background="@android:color/white" 195 android:background="@android:color/white"
151 android:paddingHorizontal="25dp" 196 android:paddingHorizontal="25dp"
152 android:paddingTop="10dp" 197 android:paddingTop="10dp"
......
...@@ -21,4 +21,9 @@ ...@@ -21,4 +21,9 @@
21 <color name="grey_tr">#A3415564</color> 21 <color name="grey_tr">#A3415564</color>
22 <color name="grey_light2">#F9F9F9</color> 22 <color name="grey_light2">#F9F9F9</color>
23 <color name="grey_tr2">#D4415564</color> 23 <color name="grey_tr2">#D4415564</color>
24 + <color name="grey2">#707070</color>
25 + <color name="skyblue">#1AADCC</color>
26 + <color name="cos_green4">#6DBC7A</color>
27 + <color name="cos_green5">#79BF14</color>
28 + <color name="cos_green5_tr">#6679BF14</color>
24 </resources> 29 </resources>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
10 <string name="cos_profile_name">%1$s</string> 10 <string name="cos_profile_name">%1$s</string>
11 <string name="cos_profile_type">Traveller</string> 11 <string name="cos_profile_type">Traveller</string>
12 <string name="header_add">Προσθήκη</string> 12 <string name="header_add">Προσθήκη</string>
13 - <string name="cos_profile_reward">My reward wallet</string> 13 + <string name="cos_profile_reward">My Loyalty\nWallet</string>
14 <string name="cos_deals_title">Deals for You</string> 14 <string name="cos_deals_title">Deals for You</string>
15 <string name="cos_profile_more">Δες περισσότερα</string> 15 <string name="cos_profile_more">Δες περισσότερα</string>
16 <string name="cos_gifts_title">Gifts for You</string> 16 <string name="cos_gifts_title">Gifts for You</string>
...@@ -27,6 +27,19 @@ ...@@ -27,6 +27,19 @@
27 <string name="cos_coupon_info_title">Εκπτωτικό κουπόνι</string> 27 <string name="cos_coupon_info_title">Εκπτωτικό κουπόνι</string>
28 <string name="cos_coupon_date">Το κουπόνι ισχύει έως %1$s</string> 28 <string name="cos_coupon_date">Το κουπόνι ισχύει έως %1$s</string>
29 <string name="cos_dl_title">Μόλις έλαβες δώρο %1$s συμμετοχές στο My Lucky Day Draw!</string> 29 <string name="cos_dl_title">Μόλις έλαβες δώρο %1$s συμμετοχές στο My Lucky Day Draw!</string>
30 + <string name="cos_active_coupons">Έχεις %1$s ενεργά\nκουπόνια</string>
31 + <string name="cos_active_coupon_date">Λήγει σε %1$s ημέρες</string>
32 + <string name="cos_gifts_title2">ΔΩΡΑ</string>
33 + <string name="cos_rewards_title">ΕΠΙΒΡΑΒΕΥΣΕΙΣ</string>
34 + <string name="cos_coupons_title">ΚΟΥΠΟΝΙΑ</string>
35 + <string name="cos_coupon_terms_title">Όροι χρήσης</string>
36 + <string name="cos_redeem_coupon">Απόκτησέ το</string>
37 + <string name="cos_dlg_success_title">Συγχαρητήρια</string>
38 + <string name="cos_dlg_success_subtitle">Το κουπόνι εξαργυρώθηκε με επιτυχία</string>
39 + <string name="cos_dlg_error_title">Αποτυχία</string>
40 + <string name="cos_dlg_error_subtitle">Κάτι πήγε στραβά</string>
41 + <string name="cos_dlg_error_subtitle_non_buyable">Το κουπόνι δεν είναι διαθέσιμο για αγορά</string>
42 + <string name="cos_dlg_error_subtitle_no_points">Δεν έχεις αρκετούς πόντους</string>
30 43
31 <string-array name="coupons_array"> 44 <string-array name="coupons_array">
32 <item>Κουπόνια</item> 45 <item>Κουπόνια</item>
......
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <resources> 2 <resources>
3 3
4 - <!-- Transparent theme - Does not work in jar export -->
5 - <!--<style name="Theme.Transparent" parent="android:Theme">-->
6 - <!--<item name="android:windowIsTranslucent">true</item>-->
7 - <!--<item name="android:windowBackground">@android:color/transparent</item>-->
8 - <!--<item name="android:windowContentOverlay">@null</item>-->
9 - <!--<item name="android:windowNoTitle">true</item>-->
10 - <!--<item name="android:windowIsFloating">true</item>-->
11 - <!--<item name="android:backgroundDimEnabled">false</item>-->
12 - <!--</style>-->
13 -
14 <style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert"> 4 <style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
15 <item name="android:layout_gravity">right</item> 5 <item name="android:layout_gravity">right</item>
16 <!--<item name="colorAccent">#23a890</item>--> 6 <!--<item name="colorAccent">#23a890</item>-->
......