Showing
10 changed files
with
226 additions
and
4 deletions
... | @@ -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 |
This diff is collapsed. Click to expand it.
... | @@ -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> | ... | ... |
-
Please register or login to post a comment