Showing
6 changed files
with
83 additions
and
22 deletions
... | @@ -518,6 +518,10 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -518,6 +518,10 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
518 | } | 518 | } |
519 | 519 | ||
520 | mValuesList.addAll(gfyList); | 520 | mValuesList.addAll(gfyList); |
521 | +// HashSet hs = new HashSet(); | ||
522 | +// hs.addAll(mValuesList); | ||
523 | +// mValuesList.clear(); | ||
524 | +// mValuesList.addAll(hs); | ||
521 | } | 525 | } |
522 | } | 526 | } |
523 | 527 | ... | ... |
... | @@ -12,6 +12,7 @@ import android.view.View; | ... | @@ -12,6 +12,7 @@ import android.view.View; |
12 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
13 | import android.widget.ImageView; | 13 | import android.widget.ImageView; |
14 | import android.widget.LinearLayout; | 14 | import android.widget.LinearLayout; |
15 | +import android.widget.ScrollView; | ||
15 | import android.widget.TextView; | 16 | import android.widget.TextView; |
16 | 17 | ||
17 | import androidx.appcompat.app.AlertDialog; | 18 | import androidx.appcompat.app.AlertDialog; |
... | @@ -21,8 +22,8 @@ import androidx.recyclerview.widget.RecyclerView; | ... | @@ -21,8 +22,8 @@ import androidx.recyclerview.widget.RecyclerView; |
21 | 22 | ||
22 | import com.bumptech.glide.Glide; | 23 | import com.bumptech.glide.Glide; |
23 | import com.bumptech.glide.load.engine.DiskCacheStrategy; | 24 | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
24 | -import com.google.android.flexbox.FlexboxLayout; | ||
25 | 25 | ||
26 | +import org.apmem.tools.layouts.FlowLayout; | ||
26 | import org.greenrobot.eventbus.EventBus; | 27 | import org.greenrobot.eventbus.EventBus; |
27 | import org.greenrobot.eventbus.Subscribe; | 28 | import org.greenrobot.eventbus.Subscribe; |
28 | 29 | ||
... | @@ -67,11 +68,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -67,11 +68,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
67 | private ConstraintLayout mClDealsBanner, mClDealsView, | 68 | private ConstraintLayout mClDealsBanner, mClDealsView, |
68 | mClGiftsBanner; | 69 | mClGiftsBanner; |
69 | private LinearLayout mLlQuestionnaire, mLlUserBadge, mLlEmptyWallet; | 70 | private LinearLayout mLlQuestionnaire, mLlUserBadge, mLlEmptyWallet; |
70 | - FlexboxLayout mLlActiveCodesView; | 71 | + FlowLayout mLlActiveCodesView; |
71 | private float couponDfyValue = 0.0f; | 72 | private float couponDfyValue = 0.0f; |
72 | private RecyclerView mRecyclerCoupons; | 73 | private RecyclerView mRecyclerCoupons; |
73 | private ActiveCouponAdapter mAdapterCoupons; | 74 | private ActiveCouponAdapter mAdapterCoupons; |
74 | private AlertDialog mAlertDialogNonTelco; | 75 | private AlertDialog mAlertDialogNonTelco; |
76 | + private ScrollView mScActiveCodes; | ||
75 | 77 | ||
76 | // =========================================================== | 78 | // =========================================================== |
77 | // Methods for/from SuperClass/Interfaces | 79 | // Methods for/from SuperClass/Interfaces |
... | @@ -102,6 +104,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -102,6 +104,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
102 | mTvActiveCouponsHeader = findViewById(R.id.tv_active_coupons_header); | 104 | mTvActiveCouponsHeader = findViewById(R.id.tv_active_coupons_header); |
103 | mLlEmptyWallet = findViewById(R.id.ll_empty_wallet); | 105 | mLlEmptyWallet = findViewById(R.id.ll_empty_wallet); |
104 | mLlActiveCodesView = findViewById(R.id.ll_active_deals_codes_view); | 106 | mLlActiveCodesView = findViewById(R.id.ll_active_deals_codes_view); |
107 | + mScActiveCodes = findViewById(R.id.sv_active_deals_codes_view); | ||
105 | 108 | ||
106 | // ArrayList<ActiveDFYCouponModel> dlist = new ArrayList<>(); | 109 | // ArrayList<ActiveDFYCouponModel> dlist = new ArrayList<>(); |
107 | // ActiveDFYCouponModel model = new ActiveDFYCouponModel(); | 110 | // ActiveDFYCouponModel model = new ActiveDFYCouponModel(); |
... | @@ -402,13 +405,13 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -402,13 +405,13 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
402 | mTvActiveTitle.setText(String.format(getString(R.string.cos_active_deals_plural), String.valueOf(WarplyManagerHelper.getActiveDFYCoupons().size()))); | 405 | mTvActiveTitle.setText(String.format(getString(R.string.cos_active_deals_plural), String.valueOf(WarplyManagerHelper.getActiveDFYCoupons().size()))); |
403 | mTvActiveCode.setVisibility(View.GONE); | 406 | mTvActiveCode.setVisibility(View.GONE); |
404 | 407 | ||
405 | - //TODO fix logic | 408 | +// Collections.reverse(WarplyManagerHelper.getActiveDFYCoupons()); |
406 | - for (ActiveDFYCouponModel dealsItem : WarplyManagerHelper.getActiveDFYCoupons().subList(0, 4)) { | 409 | + for (int i = 0; i < WarplyManagerHelper.getActiveDFYCoupons().size(); i++) { |
407 | LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); | 410 | LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
408 | LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_selectable, null); | 411 | LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_selectable, null); |
409 | TextView textView = (TextView) v.findViewById(R.id.tv_code_copy); | 412 | TextView textView = (TextView) v.findViewById(R.id.tv_code_copy); |
410 | TextView textViewComma = (TextView) v.findViewById(R.id.tv_code_comma); | 413 | TextView textViewComma = (TextView) v.findViewById(R.id.tv_code_comma); |
411 | - textView.setText(dealsItem.getCode()); | 414 | + textView.setText(WarplyManagerHelper.getActiveDFYCoupons().get(i).getCode()); |
412 | textView.setTextIsSelectable(true); | 415 | textView.setTextIsSelectable(true); |
413 | textViewComma.setText(getString(R.string.cos_comma)); | 416 | textViewComma.setText(getString(R.string.cos_comma)); |
414 | mLlActiveCodesView.addView(v, 0, new ViewGroup.LayoutParams( | 417 | mLlActiveCodesView.addView(v, 0, new ViewGroup.LayoutParams( |
... | @@ -416,6 +419,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -416,6 +419,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
416 | ViewGroup.LayoutParams.WRAP_CONTENT)); | 419 | ViewGroup.LayoutParams.WRAP_CONTENT)); |
417 | } | 420 | } |
418 | 421 | ||
422 | + mScActiveCodes.setVisibility(View.VISIBLE); | ||
419 | mLlActiveCodesView.setVisibility(View.VISIBLE); | 423 | mLlActiveCodesView.setVisibility(View.VISIBLE); |
420 | } | 424 | } |
421 | // mTvActiveCode.setText(codes); | 425 | // mTvActiveCode.setText(codes); | ... | ... |
... | @@ -42,6 +42,7 @@ import org.json.JSONObject; | ... | @@ -42,6 +42,7 @@ import org.json.JSONObject; |
42 | import java.io.Serializable; | 42 | import java.io.Serializable; |
43 | import java.util.ArrayList; | 43 | import java.util.ArrayList; |
44 | import java.util.HashMap; | 44 | import java.util.HashMap; |
45 | +import java.util.HashSet; | ||
45 | 46 | ||
46 | import ly.warp.sdk.R; | 47 | import ly.warp.sdk.R; |
47 | import ly.warp.sdk.Warply; | 48 | import ly.warp.sdk.Warply; |
... | @@ -214,6 +215,9 @@ public class WarplyManagerHelper { | ... | @@ -214,6 +215,9 @@ public class WarplyManagerHelper { |
214 | } else if (status == 5) { | 215 | } else if (status == 5) { |
215 | String modalText5 = result.optString("msg", ""); | 216 | String modalText5 = result.optString("msg", ""); |
216 | errorUsedDialog(context, modalText5); | 217 | errorUsedDialog(context, modalText5); |
218 | + } else if (status == 7) { | ||
219 | + String modalText7 = result.optString("msg", ""); | ||
220 | + returnDialog(context, modalText7, sharingId); | ||
217 | } else | 221 | } else |
218 | errorSharingDialog(context); | 222 | errorSharingDialog(context); |
219 | } | 223 | } |
... | @@ -357,6 +361,52 @@ public class WarplyManagerHelper { | ... | @@ -357,6 +361,52 @@ public class WarplyManagerHelper { |
357 | } | 361 | } |
358 | 362 | ||
359 | /** | 363 | /** |
364 | + * Return dialog | ||
365 | + */ | ||
366 | + private static void returnDialog(Context context, String message, String sharingId) { | ||
367 | + mAlertDialogErrorSharing = new AlertDialog.Builder(context) | ||
368 | + .setTitle(R.string.cos_dlg_return_title) | ||
369 | + .setMessage(message) | ||
370 | + .setNegativeButton(R.string.cos_dlg_negative_button, (dialogPositive, whichPositive) -> { | ||
371 | + rejectSharingDialog(context, sharingId); | ||
372 | + }) | ||
373 | + .setPositiveButton(R.string.cos_dlg_positive_button, (dialogNegative, whichNegative) -> { | ||
374 | + WarplyManager.cosmoteRetrieveSharing(new CosmoteRetrieveSharingRequest() | ||
375 | + .setSharingId(sharingId) | ||
376 | + .setAccept(true), | ||
377 | + new CallbackReceiver<JSONObject>() { | ||
378 | + @Override | ||
379 | + public void onSuccess(JSONObject result) { | ||
380 | + int status = result.optInt("status", 2); | ||
381 | + if (status == 1) { | ||
382 | + WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), new CallbackReceiver<CouponList>() { | ||
383 | + @Override | ||
384 | + public void onSuccess(CouponList result) { | ||
385 | + WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); | ||
386 | + couponsChanged.setChanged(true); | ||
387 | + EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged)); | ||
388 | + } | ||
389 | + | ||
390 | + @Override | ||
391 | + public void onFailure(int errorCode) { | ||
392 | + | ||
393 | + } | ||
394 | + }); | ||
395 | + acceptSharingDialog(context); | ||
396 | + } else | ||
397 | + errorSharingDialog(context); | ||
398 | + } | ||
399 | + | ||
400 | + @Override | ||
401 | + public void onFailure(int errorCode) { | ||
402 | + errorSharingDialog(context); | ||
403 | + } | ||
404 | + }); | ||
405 | + }) | ||
406 | + .show(); | ||
407 | + } | ||
408 | + | ||
409 | + /** | ||
360 | * Expired dialog | 410 | * Expired dialog |
361 | */ | 411 | */ |
362 | private static void errorExpiredDialog(Context context, String message) { | 412 | private static void errorExpiredDialog(Context context, String message) { |
... | @@ -1005,6 +1055,10 @@ public class WarplyManagerHelper { | ... | @@ -1005,6 +1055,10 @@ public class WarplyManagerHelper { |
1005 | public static void setCarouselList(CampaignList carouselList) { | 1055 | public static void setCarouselList(CampaignList carouselList) { |
1006 | mCarouselList.clear(); | 1056 | mCarouselList.clear(); |
1007 | mCarouselList = carouselList; | 1057 | mCarouselList = carouselList; |
1058 | + HashSet hs = new HashSet(); | ||
1059 | + hs.addAll(mCarouselList); | ||
1060 | + mCarouselList.clear(); | ||
1061 | + mCarouselList.addAll(hs); | ||
1008 | } | 1062 | } |
1009 | 1063 | ||
1010 | public static CampaignList getCarouselList() { | 1064 | public static CampaignList getCarouselList() { | ... | ... |
... | @@ -1369,7 +1369,7 @@ public class WarplyManager { | ... | @@ -1369,7 +1369,7 @@ public class WarplyManager { |
1369 | public void onSuccess(CampaignList result) { | 1369 | public void onSuccess(CampaignList result) { |
1370 | // receiver.onSuccess(result); | 1370 | // receiver.onSuccess(result); |
1371 | mNewCampaignList.clear(); | 1371 | mNewCampaignList.clear(); |
1372 | - mNewCampaignList = result; | 1372 | + mNewCampaignList.addAll(result); |
1373 | getCampaignsPersonalized(request, new CallbackReceiver<CampaignList>() { | 1373 | getCampaignsPersonalized(request, new CallbackReceiver<CampaignList>() { |
1374 | @Override | 1374 | @Override |
1375 | public void onSuccess(CampaignList resultPersonalized) { | 1375 | public void onSuccess(CampaignList resultPersonalized) { | ... | ... |
... | @@ -335,23 +335,21 @@ | ... | @@ -335,23 +335,21 @@ |
335 | tools:text="961544809" | 335 | tools:text="961544809" |
336 | tools:visibility="gone" /> | 336 | tools:visibility="gone" /> |
337 | 337 | ||
338 | - <com.google.android.flexbox.FlexboxLayout | 338 | + <ScrollView |
339 | - android:id="@+id/ll_active_deals_codes_view" | 339 | + android:id="@+id/sv_active_deals_codes_view" |
340 | android:layout_width="match_parent" | 340 | android:layout_width="match_parent" |
341 | - android:layout_height="wrap_content" | 341 | + android:layout_height="48dp" |
342 | - android:visibility="gone" | 342 | + android:nestedScrollingEnabled="true" |
343 | - app:flexDirection="row" | 343 | + android:visibility="gone"> |
344 | - app:flexWrap="wrap" | 344 | + |
345 | - app:justifyContent="flex_start"> | 345 | + <org.apmem.tools.layouts.FlowLayout |
346 | - | 346 | + android:id="@+id/ll_active_deals_codes_view" |
347 | - </com.google.android.flexbox.FlexboxLayout> | 347 | + android:layout_width="match_parent" |
348 | - | 348 | + android:layout_height="wrap_content" |
349 | - <!-- <org.apmem.tools.layouts.FlowLayout--> | 349 | + android:visibility="gone"> |
350 | - <!-- android:id="@+id/ll_active_deals_codes_view"--> | 350 | + |
351 | - <!-- android:layout_width="match_parent"--> | 351 | + </org.apmem.tools.layouts.FlowLayout> |
352 | - <!-- android:layout_height="wrap_content">--> | 352 | + </ScrollView> |
353 | - | ||
354 | - <!-- </org.apmem.tools.layouts.FlowLayout>--> | ||
355 | 353 | ||
356 | <TextView | 354 | <TextView |
357 | android:id="@+id/tv_active_deals_date_text" | 355 | android:id="@+id/tv_active_deals_date_text" | ... | ... |
... | @@ -39,6 +39,7 @@ | ... | @@ -39,6 +39,7 @@ |
39 | <string name="cos_redeem_coupon">Απόκτησέ το</string> | 39 | <string name="cos_redeem_coupon">Απόκτησέ το</string> |
40 | <string name="cos_dlg_success_subtitle">Το κουπόνι εξαργυρώθηκε με επιτυχία</string> | 40 | <string name="cos_dlg_success_subtitle">Το κουπόνι εξαργυρώθηκε με επιτυχία</string> |
41 | <string name="cos_dlg_error_title">Αποτυχία</string> | 41 | <string name="cos_dlg_error_title">Αποτυχία</string> |
42 | + <string name="cos_dlg_return_title">Επιστροφή δώρου</string> | ||
42 | <string name="cos_dlg_error_subtitle">Κάτι πήγε στραβά</string> | 43 | <string name="cos_dlg_error_subtitle">Κάτι πήγε στραβά</string> |
43 | <string name="cos_dlg_error_subtitle_non_buyable">Το κουπόνι δεν είναι διαθέσιμο για αγορά</string> | 44 | <string name="cos_dlg_error_subtitle_non_buyable">Το κουπόνι δεν είναι διαθέσιμο για αγορά</string> |
44 | <string name="cos_dlg_error_subtitle_no_points">Δεν έχεις αρκετούς πόντους</string> | 45 | <string name="cos_dlg_error_subtitle_no_points">Δεν έχεις αρκετούς πόντους</string> | ... | ... |
-
Please register or login to post a comment