Panagiotis Triantafyllou

new unified coupons screen with basket part2, minor fixes

...@@ -140,7 +140,7 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe ...@@ -140,7 +140,7 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe
140 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName())); 140 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName()));
141 Intent intent = new Intent(ActiveCouponsActivity.this, CouponInfoActivity.class); 141 Intent intent = new Intent(ActiveCouponsActivity.this, CouponInfoActivity.class);
142 intent.putExtra("coupon", coupon.getCoupon()); 142 intent.putExtra("coupon", coupon.getCoupon());
143 - intent.putExtra("isFromWallet", true); 143 + intent.putExtra("isFromWallet", false);
144 startActivity(intent); 144 startActivity(intent);
145 } 145 }
146 }) 146 })
......
...@@ -7,6 +7,7 @@ import android.os.Handler; ...@@ -7,6 +7,7 @@ import android.os.Handler;
7 import android.os.Looper; 7 import android.os.Looper;
8 import android.view.View; 8 import android.view.View;
9 import android.widget.ImageView; 9 import android.widget.ImageView;
10 +import android.widget.LinearLayout;
10 import android.widget.RelativeLayout; 11 import android.widget.RelativeLayout;
11 import android.widget.TextView; 12 import android.widget.TextView;
12 13
...@@ -16,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -16,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView;
16 17
17 import org.greenrobot.eventbus.EventBus; 18 import org.greenrobot.eventbus.EventBus;
18 import org.greenrobot.eventbus.Subscribe; 19 import org.greenrobot.eventbus.Subscribe;
20 +import org.json.JSONArray;
19 21
20 import java.io.Serializable; 22 import java.io.Serializable;
21 import java.text.ParseException; 23 import java.text.ParseException;
...@@ -23,9 +25,12 @@ import java.text.SimpleDateFormat; ...@@ -23,9 +25,12 @@ import java.text.SimpleDateFormat;
23 import java.util.ArrayList; 25 import java.util.ArrayList;
24 import java.util.Collections; 26 import java.util.Collections;
25 import java.util.Date; 27 import java.util.Date;
28 +import java.util.HashSet;
29 +import java.util.Set;
26 30
27 import ly.warp.sdk.R; 31 import ly.warp.sdk.R;
28 import ly.warp.sdk.io.callbacks.CallbackReceiver; 32 import ly.warp.sdk.io.callbacks.CallbackReceiver;
33 +import ly.warp.sdk.io.models.Coupon;
29 import ly.warp.sdk.io.models.UnifiedCoupon; 34 import ly.warp.sdk.io.models.UnifiedCoupon;
30 import ly.warp.sdk.utils.WarpUtils; 35 import ly.warp.sdk.utils.WarpUtils;
31 import ly.warp.sdk.utils.WarplyManagerHelper; 36 import ly.warp.sdk.utils.WarplyManagerHelper;
...@@ -51,11 +56,13 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli ...@@ -51,11 +56,13 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
51 private MarketCouponAdapter mAdapterUnifiedCoupons; 56 private MarketCouponAdapter mAdapterUnifiedCoupons;
52 private TextView mTvEmptyUnifiedCoupons, mFontHeader, mTvInnerTitle, 57 private TextView mTvEmptyUnifiedCoupons, mFontHeader, mTvInnerTitle,
53 mTvInnerSubtitle, mTvInnerClose, mTvUnifieCouponsTitle, mTvActiveUnifiedCouponsTitle, 58 mTvInnerSubtitle, mTvInnerClose, mTvUnifieCouponsTitle, mTvActiveUnifiedCouponsTitle,
54 - mTvChooseAll; 59 + mTvChooseAll, mTvActivate;
55 private boolean mUnifiedPressed = false, mActiveUnifiedPressed = false; 60 private boolean mUnifiedPressed = false, mActiveUnifiedPressed = false;
56 private ConstraintLayout mClInfoView, mClActiveCouponsHeader; 61 private ConstraintLayout mClInfoView, mClActiveCouponsHeader;
57 private RelativeLayout mRlUnifiedCoupons, mRlActiveUnifiedCoupons; 62 private RelativeLayout mRlUnifiedCoupons, mRlActiveUnifiedCoupons;
58 private ActiveCouponAdapter mAdapterCoupons; 63 private ActiveCouponAdapter mAdapterCoupons;
64 + private Set<Coupon> mSelectedItems = new HashSet<>();
65 + private LinearLayout mLlActivateunified;
59 66
60 // =========================================================== 67 // ===========================================================
61 // Methods for/from SuperClass/Interfaces 68 // Methods for/from SuperClass/Interfaces
...@@ -85,11 +92,13 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli ...@@ -85,11 +92,13 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
85 mTvActiveUnifiedCouponsTitle = mClActiveCouponsHeader.findViewById(R.id.tv_active_sm_coupons_title); 92 mTvActiveUnifiedCouponsTitle = mClActiveCouponsHeader.findViewById(R.id.tv_active_sm_coupons_title);
86 mTvChooseAll = mClActiveCouponsHeader.findViewById(R.id.tv_choose_all); 93 mTvChooseAll = mClActiveCouponsHeader.findViewById(R.id.tv_choose_all);
87 mIvChooseAll = mClActiveCouponsHeader.findViewById(R.id.iv_choose_all); 94 mIvChooseAll = mClActiveCouponsHeader.findViewById(R.id.iv_choose_all);
95 + mLlActivateunified = findViewById(R.id.ll_activate_unified);
96 + mTvActivate = mLlActivateunified.findViewById(R.id.button_activate);
88 WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mFontHeader, mTvInnerTitle, 97 WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mFontHeader, mTvInnerTitle,
89 mTvUnifieCouponsTitle, mTvActiveUnifiedCouponsTitle); 98 mTvUnifieCouponsTitle, mTvActiveUnifiedCouponsTitle);
90 WarpUtils.renderCustomFont(this, R.font.peridot_regular, mTvEmptyUnifiedCoupons, mTvInnerSubtitle); 99 WarpUtils.renderCustomFont(this, R.font.peridot_regular, mTvEmptyUnifiedCoupons, mTvInnerSubtitle);
91 WarpUtils.renderCustomFont(this, R.font.peridot_bold, mTvInnerClose); 100 WarpUtils.renderCustomFont(this, R.font.peridot_bold, mTvInnerClose);
92 - WarpUtils.renderCustomFont(this, R.font.peridot_semi_bold, mTvChooseAll); 101 + WarpUtils.renderCustomFont(this, R.font.peridot_semi_bold, mTvChooseAll, mTvActivate);
93 102
94 initViews(); 103 initViews();
95 } 104 }
...@@ -144,7 +153,29 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli ...@@ -144,7 +153,29 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
144 return; 153 return;
145 } 154 }
146 if (view.getId() == R.id.iv_choose_all) { 155 if (view.getId() == R.id.iv_choose_all) {
156 + if (mSelectedItems.isEmpty() || (!mSelectedItems.isEmpty() && mSelectedItems.size() != mAdapterCoupons.getItemCount())) {
157 + mSelectedItems.clear();
158 + mSelectedItems.addAll(mAdapterCoupons.getItems());
159 + mIvChooseAll.setBackgroundResource(R.drawable.ic_circle_checked_skyblue);
160 + mLlActivateunified.setBackgroundResource(R.drawable.selector_button_green);
161 + mAdapterCoupons.updateChecked(mSelectedItems);
162 + } else if (mSelectedItems.size() == mAdapterCoupons.getItemCount()) {
163 + mSelectedItems.clear();
164 + mIvChooseAll.setBackgroundResource(R.drawable.ic_circle_gray);
165 + mLlActivateunified.setBackgroundResource(R.drawable.selector_button_grey_dark);
166 + mAdapterCoupons.updateChecked(mSelectedItems);
167 + }
168 + return;
169 + }
170 + if (view.getId() == R.id.ll_activate_unified) {
171 + if (!mSelectedItems.isEmpty()) {
172 + JSONArray tempArray = new JSONArray();
173 + for (Coupon selectedCoupon : mSelectedItems) {
174 + tempArray.put(selectedCoupon.getCoupon());
175 + }
147 176
177 + WarplyManager.createUnifiedCoupon(tempArray, mCreateUnifiedCallback);
178 + }
148 } 179 }
149 } 180 }
150 181
...@@ -158,9 +189,15 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli ...@@ -158,9 +189,15 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
158 mIvInfoClose.setOnClickListener(this); 189 mIvInfoClose.setOnClickListener(this);
159 mTvInnerClose.setOnClickListener(this); 190 mTvInnerClose.setOnClickListener(this);
160 mIvChooseAll.setOnClickListener(this); 191 mIvChooseAll.setOnClickListener(this);
192 + mLlActivateunified.setOnClickListener(this);
161 } 193 }
162 194
163 private void filterItems() { 195 private void filterItems() {
196 + mClInfoView.setVisibility(View.GONE);
197 + mIvChooseAll.setBackgroundResource(R.drawable.ic_circle_gray);
198 + mLlActivateunified.setBackgroundResource(R.drawable.selector_button_grey_dark);
199 + mSelectedItems.clear();
200 +
164 if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().isEmpty() 201 if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().isEmpty()
165 && WarplyManagerHelper.getSmCouponsList() != null && WarplyManagerHelper.getSmCouponsList().isEmpty()) { 202 && WarplyManagerHelper.getSmCouponsList() != null && WarplyManagerHelper.getSmCouponsList().isEmpty()) {
166 mTvEmptyUnifiedCoupons.setVisibility(View.VISIBLE); 203 mTvEmptyUnifiedCoupons.setVisibility(View.VISIBLE);
...@@ -212,7 +249,8 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli ...@@ -212,7 +249,8 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
212 mRvActiveUnifiedCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 249 mRvActiveUnifiedCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
213 mAdapterCoupons = new ActiveCouponAdapter(this, WarplyManagerHelper.getSmCouponsList(), false, false, true); 250 mAdapterCoupons = new ActiveCouponAdapter(this, WarplyManagerHelper.getSmCouponsList(), false, false, true);
214 mRvActiveUnifiedCoupons.setAdapter(mAdapterCoupons); 251 mRvActiveUnifiedCoupons.setAdapter(mAdapterCoupons);
215 - mAdapterCoupons.getPositionClicks() 252 + mAdapterCoupons
253 + .getPositionClicks()
216 .doOnNext(coupon -> { 254 .doOnNext(coupon -> {
217 if (!mActiveUnifiedPressed) { 255 if (!mActiveUnifiedPressed) {
218 mActiveUnifiedPressed = true; 256 mActiveUnifiedPressed = true;
...@@ -229,6 +267,31 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli ...@@ -229,6 +267,31 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
229 }) 267 })
230 .subscribe(); 268 .subscribe();
231 269
270 + mAdapterCoupons
271 + .getPositionCheck()
272 + .doOnNext(coupon -> {
273 + if (mSelectedItems.contains(coupon)) {
274 + mSelectedItems.remove(coupon);
275 + } else {
276 + mSelectedItems.add(coupon);
277 + }
278 +
279 + if (mSelectedItems.size() != mAdapterCoupons.getItemCount()) {
280 + mIvChooseAll.setBackgroundResource(R.drawable.ic_circle_gray);
281 + } else {
282 + mIvChooseAll.setBackgroundResource(R.drawable.ic_circle_checked_skyblue);
283 + }
284 +
285 + if (mSelectedItems.isEmpty()) {
286 + mLlActivateunified.setBackgroundResource(R.drawable.selector_button_grey_dark);
287 + } else {
288 + mLlActivateunified.setBackgroundResource(R.drawable.selector_button_green);
289 + }
290 + })
291 + .doOnError(error -> {
292 + })
293 + .subscribe();
294 +
232 mRlActiveUnifiedCoupons.setVisibility(View.VISIBLE); 295 mRlActiveUnifiedCoupons.setVisibility(View.VISIBLE);
233 } else { 296 } else {
234 mRlActiveUnifiedCoupons.setVisibility(View.GONE); 297 mRlActiveUnifiedCoupons.setVisibility(View.GONE);
...@@ -251,4 +314,18 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli ...@@ -251,4 +314,18 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
251 314
252 } 315 }
253 }; 316 };
317 +
318 + private final CallbackReceiver<ArrayList<UnifiedCoupon>> mCreateUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() {
319 + @Override
320 + public void onSuccess(ArrayList<UnifiedCoupon> result) {
321 + mIvChooseAll.setBackgroundResource(R.drawable.ic_circle_gray);
322 + mLlActivateunified.setBackgroundResource(R.drawable.selector_button_grey_dark);
323 + mSelectedItems.clear();
324 + }
325 +
326 + @Override
327 + public void onFailure(int errorCode) {
328 +
329 + }
330 + };
254 } 331 }
......
...@@ -101,6 +101,7 @@ import ly.warp.sdk.io.models.NewCampaign; ...@@ -101,6 +101,7 @@ import ly.warp.sdk.io.models.NewCampaign;
101 import ly.warp.sdk.io.models.PacingDetails; 101 import ly.warp.sdk.io.models.PacingDetails;
102 import ly.warp.sdk.io.models.PointsList; 102 import ly.warp.sdk.io.models.PointsList;
103 import ly.warp.sdk.io.models.ProductList; 103 import ly.warp.sdk.io.models.ProductList;
104 +import ly.warp.sdk.io.models.RefreshUnifiedCouponsEventModel;
104 import ly.warp.sdk.io.models.SharingList; 105 import ly.warp.sdk.io.models.SharingList;
105 import ly.warp.sdk.io.models.TagsCategoriesList; 106 import ly.warp.sdk.io.models.TagsCategoriesList;
106 import ly.warp.sdk.io.models.TagsList; 107 import ly.warp.sdk.io.models.TagsList;
...@@ -3044,6 +3045,109 @@ public class WarplyManager { ...@@ -3044,6 +3045,109 @@ public class WarplyManager {
3044 }); 3045 });
3045 } 3046 }
3046 3047
3048 + private static void createUnifiedCouponsRetro(ApiService service, JSONArray couponCodes, Callback<ResponseBody> callback) {
3049 + String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
3050 + String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
3051 + String webId = WarpUtils.getWebId(Warply.getWarplyContext());
3052 +
3053 + Map<String, Object> jsonParamsCouponsets = new ArrayMap<>();
3054 + Map<String, Object> jsonParams = new ArrayMap<>();
3055 + jsonParams.put("action", "unify_coupons");
3056 + jsonParams.put("coupon_codes", couponCodes);
3057 +
3058 + jsonParamsCouponsets.put("coupon", jsonParams);
3059 + RequestBody couponsetsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsCouponsets)).toString());
3060 +
3061 + Call<ResponseBody> unifiedCouponsCall = service.getCouponsets(
3062 + WarplyProperty.getAppUuid(Warply.getWarplyContext()),
3063 + couponsetsRequest,
3064 + timeStamp,
3065 + "android:" + Warply.getWarplyContext().getPackageName(),
3066 + new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
3067 + "mobile",
3068 + webId,
3069 + WarpUtils.produceSignature(apiKey + timeStamp),
3070 + "Bearer " + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
3071 + );
3072 +
3073 + unifiedCouponsCall.enqueue(new Callback<ResponseBody>() {
3074 + @Override
3075 + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
3076 + if (response.code() == 401) {
3077 + refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
3078 + @Override
3079 + public void onSuccess(JSONObject result) {
3080 + int status = result.optInt("status", 2);
3081 + if (status == 1)
3082 + createUnifiedCouponsRetro(service, couponCodes, callback);
3083 + else
3084 + callback.onFailure(call, new Throwable());
3085 + }
3086 +
3087 + @Override
3088 + public void onFailure(int errorCode) {
3089 + callback.onFailure(call, new Throwable());
3090 + }
3091 + });
3092 + } else {
3093 + callback.onResponse(call, response);
3094 + }
3095 + }
3096 +
3097 + @Override
3098 + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
3099 + callback.onFailure(call, t);
3100 + }
3101 + });
3102 + }
3103 +
3104 + public static void createUnifiedCoupon(JSONArray couponCodes, final CallbackReceiver<ArrayList<UnifiedCoupon>> receiver) {
3105 + WarpUtils.log("************* WARPLY Create Unified Coupons Request ********************");
3106 + WarpUtils.log("[WARP Trace] WARPLY Create Unified Coupons Request is active");
3107 + WarpUtils.log("**************************************************");
3108 + ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
3109 + createUnifiedCouponsRetro(service, couponCodes, new Callback<ResponseBody>() {
3110 + @Override
3111 + public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
3112 + if (response.code() == 200 && response.body() != null) {
3113 + JSONObject jobjUnifiedResponse = null;
3114 + try {
3115 + jobjUnifiedResponse = new JSONObject(response.body().string());
3116 + } catch (Exception e) {
3117 + e.printStackTrace();
3118 + }
3119 +
3120 + if (jobjUnifiedResponse != null && jobjUnifiedResponse.has("status") && jobjUnifiedResponse.optString("status", "2").equals("1")) {
3121 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
3122 + dynatraceEvent.setEventName("custom_success_create_unified_coupons");
3123 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
3124 +
3125 + RefreshUnifiedCouponsEventModel couponsRefreshed = new RefreshUnifiedCouponsEventModel();
3126 + EventBus.getDefault().post(new WarplyEventBusManager(couponsRefreshed));
3127 + } else {
3128 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
3129 + dynatraceEvent.setEventName("custom_error_create_unified_coupons");
3130 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
3131 + receiver.onFailure(2);
3132 + }
3133 + } else {
3134 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
3135 + dynatraceEvent.setEventName("custom_error_create_unified_coupons");
3136 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
3137 + receiver.onFailure(response.code());
3138 + }
3139 + }
3140 +
3141 + @Override
3142 + public void onFailure(Call<ResponseBody> call, Throwable t) {
3143 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
3144 + dynatraceEvent.setEventName("custom_error_create_unified_coupons");
3145 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
3146 + receiver.onFailure(2);
3147 + }
3148 + });
3149 + }
3150 +
3047 public static void getUnifiedCouponsDeals(final CallbackReceiver<ArrayList<UnifiedCoupon>> receiver) { 3151 public static void getUnifiedCouponsDeals(final CallbackReceiver<ArrayList<UnifiedCoupon>> receiver) {
3048 WarpUtils.log("************* WARPLY User Coupons Request ********************"); 3152 WarpUtils.log("************* WARPLY User Coupons Request ********************");
3049 WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active"); 3153 WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active");
......
...@@ -38,6 +38,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte ...@@ -38,6 +38,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
38 private Context mContext; 38 private Context mContext;
39 private CouponList mCoupons; 39 private CouponList mCoupons;
40 private final PublishSubject<Coupon> onClickSubject = PublishSubject.create(); 40 private final PublishSubject<Coupon> onClickSubject = PublishSubject.create();
41 + private final PublishSubject<Coupon> onCheckSubject = PublishSubject.create();
41 private boolean mIsPast = false, mIsCustom = false, mIsActiveSM = false; 42 private boolean mIsPast = false, mIsCustom = false, mIsActiveSM = false;
42 private Set<Coupon> mSelectedItems = new HashSet<>(); 43 private Set<Coupon> mSelectedItems = new HashSet<>();
43 44
...@@ -107,6 +108,10 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte ...@@ -107,6 +108,10 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
107 return mCoupons.size(); 108 return mCoupons.size();
108 } 109 }
109 110
111 + public CouponList getItems() {
112 + return mCoupons;
113 + }
114 +
110 public Coupon getItem(int id) { 115 public Coupon getItem(int id) {
111 return mCoupons.get(id); 116 return mCoupons.get(id);
112 } 117 }
...@@ -117,6 +122,12 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte ...@@ -117,6 +122,12 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
117 notifyDataSetChanged(); 122 notifyDataSetChanged();
118 } 123 }
119 124
125 + public void updateChecked(Set<Coupon> checkedList) {
126 + mSelectedItems.clear();
127 + mSelectedItems.addAll(checkedList);
128 + notifyDataSetChanged();
129 + }
130 +
120 @Override 131 @Override
121 public ActiveCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 132 public ActiveCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
122 View itemView; 133 View itemView;
...@@ -253,6 +264,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte ...@@ -253,6 +264,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
253 holder.ivChooseCoupon.setBackgroundResource(R.drawable.ic_circle_checked_skyblue); 264 holder.ivChooseCoupon.setBackgroundResource(R.drawable.ic_circle_checked_skyblue);
254 holder.clActiveCustomLayout.setBackgroundResource(R.drawable.ic_coupon_background_new3_border_skyblue); 265 holder.clActiveCustomLayout.setBackgroundResource(R.drawable.ic_coupon_background_new3_border_skyblue);
255 } 266 }
267 + onCheckSubject.onNext(couponItem);
256 }); 268 });
257 } 269 }
258 270
...@@ -350,6 +362,10 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte ...@@ -350,6 +362,10 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
350 return onClickSubject.cache(); 362 return onClickSubject.cache();
351 } 363 }
352 364
365 + public Observable<Coupon> getPositionCheck() {
366 + return onCheckSubject.cache();
367 + }
368 +
353 private long getDifferenceDays(Date d1, Date d2) { 369 private long getDifferenceDays(Date d1, Date d2) {
354 long diff = d2.getTime() - d1.getTime(); 370 long diff = d2.getTime() - d1.getTime();
355 return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS); 371 return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
......
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_grey2_dark" android:state_pressed="true" />
4 + <item android:drawable="@drawable/shape_cos_grey2_dark" 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="16dp" />
5 +
6 + <solid
7 + android:width="2dp"
8 + android:color="@color/cos_gray" />
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="16dp" />
5 +
6 + <solid
7 + android:width="2dp"
8 + android:color="@color/cos_gray_tr" />
9 +</shape>
...\ No newline at end of file ...\ No newline at end of file
...@@ -139,116 +139,125 @@ ...@@ -139,116 +139,125 @@
139 139
140 </androidx.constraintlayout.widget.ConstraintLayout> 140 </androidx.constraintlayout.widget.ConstraintLayout>
141 141
142 - <!-- android:background="@drawable/shape_cos_loyalty"--> 142 + <androidx.core.widget.NestedScrollView
143 - <RelativeLayout
144 - android:id="@+id/rl_unified_coupons"
145 android:layout_width="match_parent" 143 android:layout_width="match_parent"
146 - android:layout_height="wrap_content" 144 + android:layout_height="0dp"
147 - android:background="@color/cos_light_grey3"
148 - android:orientation="vertical"
149 - android:visibility="gone"
150 app:layout_constraintEnd_toEndOf="parent" 145 app:layout_constraintEnd_toEndOf="parent"
151 app:layout_constraintStart_toStartOf="parent" 146 app:layout_constraintStart_toStartOf="parent"
152 app:layout_constraintTop_toBottomOf="@+id/cl_bill_header" 147 app:layout_constraintTop_toBottomOf="@+id/cl_bill_header"
153 - tools:visibility="visible"> 148 + app:layout_constraintBottom_toBottomOf="parent">
154 -
155 - <TextView
156 - android:id="@+id/tv_sm_coupons_title"
157 - android:layout_width="wrap_content"
158 - android:layout_height="wrap_content"
159 - android:layout_marginHorizontal="16dp"
160 - android:layout_marginTop="32dp"
161 - android:layout_marginBottom="8dp"
162 - android:gravity="center"
163 - android:lineHeight="24dp"
164 - android:text="@string/cos_coupon_unified_title"
165 - android:textColor="@color/cos_light_black"
166 - android:textSize="17sp" />
167 -
168 - <androidx.recyclerview.widget.RecyclerView
169 - android:id="@+id/rv_active_unified_coupons"
170 - android:layout_width="match_parent"
171 - android:layout_height="wrap_content"
172 - android:layout_below="@+id/tv_sm_coupons_title"
173 - android:clipToPadding="false"
174 - android:orientation="vertical"
175 - android:overScrollMode="never"
176 - android:paddingVertical="16dp"
177 - android:scrollbars="none" />
178 - </RelativeLayout>
179 -
180 - <RelativeLayout
181 - android:id="@+id/rl_active_unified_coupons"
182 - android:layout_width="match_parent"
183 - android:layout_height="wrap_content"
184 - android:background="@color/cos_light_grey3"
185 - android:orientation="vertical"
186 - android:visibility="gone"
187 - app:layout_constraintEnd_toEndOf="parent"
188 - app:layout_constraintStart_toStartOf="parent"
189 - app:layout_constraintTop_toBottomOf="@+id/rl_unified_coupons"
190 - tools:visibility="visible">
191 149
192 - <androidx.constraintlayout.widget.ConstraintLayout 150 + <RelativeLayout
193 - android:id="@+id/cl_active_sm_coupons_title"
194 android:layout_width="match_parent" 151 android:layout_width="match_parent"
195 - android:layout_height="wrap_content" 152 + android:layout_height="match_parent"
196 - android:layout_marginHorizontal="16dp" 153 + android:paddingBottom="80dp">
197 - android:layout_marginTop="8dp"
198 - android:layout_marginBottom="8dp">
199 154
200 - <TextView 155 + <RelativeLayout
201 - android:id="@+id/tv_active_sm_coupons_title" 156 + android:id="@+id/rl_unified_coupons"
202 - android:layout_width="wrap_content" 157 + android:layout_width="match_parent"
203 android:layout_height="wrap_content" 158 android:layout_height="wrap_content"
204 - android:gravity="center" 159 + android:background="@color/cos_light_grey3"
205 - android:lineHeight="24dp" 160 + android:orientation="vertical"
206 - android:text="@string/cos_coupon_active_unified_title" 161 + android:visibility="gone"
207 - android:textColor="@color/cos_light_black" 162 + tools:visibility="visible">
208 - android:textSize="17sp"
209 - app:layout_constraintBottom_toBottomOf="parent"
210 - app:layout_constraintStart_toStartOf="parent"
211 - app:layout_constraintTop_toTopOf="parent" />
212 -
213 - <LinearLayout
214 - android:layout_width="wrap_content"
215 - android:layout_height="wrap_content"
216 - android:gravity="center"
217 - android:orientation="horizontal"
218 - app:layout_constraintBottom_toBottomOf="@+id/tv_active_sm_coupons_title"
219 - app:layout_constraintEnd_toEndOf="parent"
220 - app:layout_constraintTop_toTopOf="@+id/tv_active_sm_coupons_title">
221 163
222 <TextView 164 <TextView
223 - android:id="@+id/tv_choose_all" 165 + android:id="@+id/tv_sm_coupons_title"
224 android:layout_width="wrap_content" 166 android:layout_width="wrap_content"
225 android:layout_height="wrap_content" 167 android:layout_height="wrap_content"
168 + android:layout_marginHorizontal="16dp"
169 + android:layout_marginTop="32dp"
170 + android:layout_marginBottom="8dp"
226 android:gravity="center" 171 android:gravity="center"
227 - android:text="@string/cos_coupon_active_unified_choose_all_title" 172 + android:lineHeight="24dp"
173 + android:text="@string/cos_coupon_unified_title"
228 android:textColor="@color/cos_light_black" 174 android:textColor="@color/cos_light_black"
229 android:textSize="17sp" /> 175 android:textSize="17sp" />
230 176
231 - <ImageView 177 + <androidx.recyclerview.widget.RecyclerView
232 - android:id="@+id/iv_choose_all" 178 + android:id="@+id/rv_active_unified_coupons"
233 - android:layout_width="28dp" 179 + android:layout_width="match_parent"
234 - android:layout_height="28dp" 180 + android:layout_height="wrap_content"
235 - android:layout_marginStart="8dp" 181 + android:layout_below="@+id/tv_sm_coupons_title"
236 - android:scaleType="fitXY" 182 + android:clipToPadding="false"
237 - android:src="@drawable/ic_circle_gray" /> 183 + android:orientation="vertical"
238 - </LinearLayout> 184 + android:overScrollMode="never"
239 - </androidx.constraintlayout.widget.ConstraintLayout> 185 + android:paddingVertical="16dp"
186 + android:scrollbars="none" />
187 + </RelativeLayout>
240 188
241 - <androidx.recyclerview.widget.RecyclerView 189 + <RelativeLayout
242 - android:id="@+id/rv_active_single_unified_coupons" 190 + android:id="@+id/rl_active_unified_coupons"
243 - android:layout_width="match_parent" 191 + android:layout_width="match_parent"
244 - android:layout_height="wrap_content" 192 + android:layout_height="wrap_content"
245 - android:layout_below="@+id/cl_active_sm_coupons_title" 193 + android:layout_below="@+id/rl_unified_coupons"
246 - android:clipToPadding="false" 194 + android:background="@color/cos_light_grey3"
247 - android:orientation="vertical" 195 + android:orientation="vertical"
248 - android:overScrollMode="never" 196 + android:visibility="gone"
249 - android:paddingVertical="16dp" 197 + tools:visibility="visible">
250 - android:scrollbars="none" /> 198 +
251 - </RelativeLayout> 199 + <androidx.constraintlayout.widget.ConstraintLayout
200 + android:id="@+id/cl_active_sm_coupons_title"
201 + android:layout_width="match_parent"
202 + android:layout_height="wrap_content"
203 + android:layout_marginHorizontal="16dp"
204 + android:layout_marginTop="8dp"
205 + android:layout_marginBottom="8dp">
206 +
207 + <TextView
208 + android:id="@+id/tv_active_sm_coupons_title"
209 + android:layout_width="wrap_content"
210 + android:layout_height="wrap_content"
211 + android:gravity="center"
212 + android:lineHeight="24dp"
213 + android:text="@string/cos_coupon_active_unified_title"
214 + android:textColor="@color/cos_light_black"
215 + android:textSize="17sp"
216 + app:layout_constraintBottom_toBottomOf="parent"
217 + app:layout_constraintStart_toStartOf="parent"
218 + app:layout_constraintTop_toTopOf="parent" />
219 +
220 + <LinearLayout
221 + android:layout_width="wrap_content"
222 + android:layout_height="wrap_content"
223 + android:gravity="center"
224 + android:orientation="horizontal"
225 + app:layout_constraintBottom_toBottomOf="@+id/tv_active_sm_coupons_title"
226 + app:layout_constraintEnd_toEndOf="parent"
227 + app:layout_constraintTop_toTopOf="@+id/tv_active_sm_coupons_title">
228 +
229 + <TextView
230 + android:id="@+id/tv_choose_all"
231 + android:layout_width="wrap_content"
232 + android:layout_height="wrap_content"
233 + android:gravity="center"
234 + android:text="@string/cos_coupon_active_unified_choose_all_title"
235 + android:textColor="@color/cos_light_black"
236 + android:textSize="17sp" />
237 +
238 + <ImageView
239 + android:id="@+id/iv_choose_all"
240 + android:layout_width="28dp"
241 + android:layout_height="28dp"
242 + android:layout_marginStart="8dp"
243 + android:scaleType="fitXY"
244 + tools:src="@drawable/ic_circle_gray" />
245 + </LinearLayout>
246 + </androidx.constraintlayout.widget.ConstraintLayout>
247 +
248 + <androidx.recyclerview.widget.RecyclerView
249 + android:id="@+id/rv_active_single_unified_coupons"
250 + android:layout_width="match_parent"
251 + android:layout_height="wrap_content"
252 + android:layout_below="@+id/cl_active_sm_coupons_title"
253 + android:clipToPadding="false"
254 + android:orientation="vertical"
255 + android:overScrollMode="never"
256 + android:paddingVertical="16dp"
257 + android:scrollbars="none" />
258 + </RelativeLayout>
259 + </RelativeLayout>
260 + </androidx.core.widget.NestedScrollView>
252 261
253 <TextView 262 <TextView
254 android:id="@+id/tv_no_unified_coupons" 263 android:id="@+id/tv_no_unified_coupons"
...@@ -266,4 +275,29 @@ ...@@ -266,4 +275,29 @@
266 app:layout_constraintEnd_toEndOf="parent" 275 app:layout_constraintEnd_toEndOf="parent"
267 app:layout_constraintStart_toStartOf="parent" 276 app:layout_constraintStart_toStartOf="parent"
268 app:layout_constraintTop_toBottomOf="@+id/cl_bill_header" /> 277 app:layout_constraintTop_toBottomOf="@+id/cl_bill_header" />
278 +
279 + <LinearLayout
280 + android:id="@+id/ll_activate_unified"
281 + android:layout_width="match_parent"
282 + android:layout_height="55dp"
283 + android:layout_gravity="center"
284 + android:layout_marginHorizontal="24dp"
285 + android:layout_marginBottom="24dp"
286 + android:background="@drawable/selector_button_grey_dark"
287 + android:gravity="center"
288 + android:paddingVertical="8dp"
289 + app:layout_constraintBottom_toBottomOf="parent"
290 + app:layout_constraintEnd_toEndOf="parent"
291 + app:layout_constraintStart_toStartOf="parent">
292 +
293 + <TextView
294 + android:id="@+id/button_activate"
295 + android:layout_width="wrap_content"
296 + android:layout_height="wrap_content"
297 + android:gravity="center"
298 + android:includeFontPadding="false"
299 + android:text="@string/cos_activate_unified"
300 + android:textColor="@color/white"
301 + android:textSize="16sp" />
302 + </LinearLayout>
269 </androidx.constraintlayout.widget.ConstraintLayout> 303 </androidx.constraintlayout.widget.ConstraintLayout>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
69 <color name="cos_green12">#0EA600</color> 69 <color name="cos_green12">#0EA600</color>
70 <color name="cos_green6_tr">#660EA600</color> 70 <color name="cos_green6_tr">#660EA600</color>
71 <color name="cos_gray">#9D9D9C</color> 71 <color name="cos_gray">#9D9D9C</color>
72 + <color name="cos_gray_tr">#669D9D9C</color>
72 <color name="cos_gray2">#848484</color> 73 <color name="cos_gray2">#848484</color>
73 <color name="cos_light_blue">#00A5E3</color> 74 <color name="cos_light_blue">#00A5E3</color>
74 <color name="cos_grey_dark2">#32485A</color> 75 <color name="cos_grey_dark2">#32485A</color>
......
...@@ -82,6 +82,7 @@ ...@@ -82,6 +82,7 @@
82 <string name="cos_popup_gifts_subtitle">Σε αυτή την ενότητα βρίσκεις τα διαθέσιμα δώρα και επιβραβεύσεις αποκλειστικά για σένα!</string> 82 <string name="cos_popup_gifts_subtitle">Σε αυτή την ενότητα βρίσκεις τα διαθέσιμα δώρα και επιβραβεύσεις αποκλειστικά για σένα!</string>
83 <string name="cos_mycoupon_date">Το κουπόνι ισχύει έως %1$s</string> 83 <string name="cos_mycoupon_date">Το κουπόνι ισχύει έως %1$s</string>
84 <string name="cos_gift_it">Δώρισέ το</string> 84 <string name="cos_gift_it">Δώρισέ το</string>
85 + <string name="cos_activate_unified">Συνδύασε τις προσφορές σε ένα κουπόνι</string>
85 <string name="cos_popup_more_title">COSMOTE MORE FOR YOU</string> 86 <string name="cos_popup_more_title">COSMOTE MORE FOR YOU</string>
86 <string name="cos_popup_more_subtitle">Σε αυτή την ενότητα βρες έρευνες, παιχνίδια, διαγωνισμούς και επιβραβεύσεις για τις αθλητικές σου δραστηριότητες!</string> 87 <string name="cos_popup_more_subtitle">Σε αυτή την ενότητα βρες έρευνες, παιχνίδια, διαγωνισμούς και επιβραβεύσεις για τις αθλητικές σου δραστηριότητες!</string>
87 <string name="cos_deals_win_title">Μέχρι τώρα έχεις όφελος %1$s€ από τα FREE COUPONS</string> 88 <string name="cos_deals_win_title">Μέχρι τώρα έχεις όφελος %1$s€ από τα FREE COUPONS</string>
......