Showing
10 changed files
with
119 additions
and
11 deletions
| ... | @@ -191,6 +191,8 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli | ... | @@ -191,6 +191,8 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli |
| 191 | 191 | ||
| 192 | mPbLoading.setVisibility(View.VISIBLE); | 192 | mPbLoading.setVisibility(View.VISIBLE); |
| 193 | WarplyManager.createUnifiedCoupon(tempArray, mCreateUnifiedCallback); | 193 | WarplyManager.createUnifiedCoupon(tempArray, mCreateUnifiedCallback); |
| 194 | + } else { | ||
| 195 | + mIsActivatePressed = false; | ||
| 194 | } | 196 | } |
| 195 | } | 197 | } |
| 196 | } | 198 | } | ... | ... |
| ... | @@ -2,6 +2,7 @@ package ly.warp.sdk.activities; | ... | @@ -2,6 +2,7 @@ package ly.warp.sdk.activities; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | +import android.content.DialogInterface; | ||
| 5 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 6 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
| 7 | import android.util.Log; | 8 | import android.util.Log; |
| ... | @@ -190,13 +191,20 @@ public class ContextualActivity extends Activity implements View.OnClickListener | ... | @@ -190,13 +191,20 @@ public class ContextualActivity extends Activity implements View.OnClickListener |
| 190 | 191 | ||
| 191 | final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this, R.style.BottomSheetDialog); | 192 | final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this, R.style.BottomSheetDialog); |
| 192 | bottomSheetDialog.setContentView(R.layout.dl_share); | 193 | bottomSheetDialog.setContentView(R.layout.dl_share); |
| 194 | + bottomSheetDialog.setOnDismissListener(dialog -> { | ||
| 195 | + mIsActivatePressed = false; | ||
| 196 | + bottomSheetDialog.dismiss(); | ||
| 197 | + }); | ||
| 193 | TextView tvHeader = bottomSheetDialog.findViewById(R.id.tv_sender_value); | 198 | TextView tvHeader = bottomSheetDialog.findViewById(R.id.tv_sender_value); |
| 194 | WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, tvHeader); | 199 | WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, tvHeader); |
| 195 | tvHeader.setText(R.string.cos_coupon_share_telco); | 200 | tvHeader.setText(R.string.cos_coupon_share_telco); |
| 196 | LinearLayout parent = bottomSheetDialog.findViewById(R.id.ll_share_dialog_view_inner); | 201 | LinearLayout parent = bottomSheetDialog.findViewById(R.id.ll_share_dialog_view_inner); |
| 197 | 202 | ||
| 198 | ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_sender_list_close); | 203 | ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_sender_list_close); |
| 199 | - dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss()); | 204 | + dialogClose.setOnClickListener(view -> { |
| 205 | + mIsActivatePressed = false; | ||
| 206 | + bottomSheetDialog.dismiss(); | ||
| 207 | + }); | ||
| 200 | 208 | ||
| 201 | if (mCCMS.getEligibleAssets() != null && mCCMS.getEligibleAssets().size() > 0) { | 209 | if (mCCMS.getEligibleAssets() != null && mCCMS.getEligibleAssets().size() > 0) { |
| 202 | for (int i = 0; i < mCCMS.getEligibleAssets().size(); i++) { | 210 | for (int i = 0; i < mCCMS.getEligibleAssets().size(); i++) { | ... | ... |
| ... | @@ -325,8 +325,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -325,8 +325,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
| 325 | final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this, R.style.BottomSheetDialog); | 325 | final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this, R.style.BottomSheetDialog); |
| 326 | bottomSheetDialog.setContentView(R.layout.dl_bottom_sheet_merchants); | 326 | bottomSheetDialog.setContentView(R.layout.dl_bottom_sheet_merchants); |
| 327 | bottomSheetDialog.setOnDismissListener(dialog -> { | 327 | bottomSheetDialog.setOnDismissListener(dialog -> { |
| 328 | - bottomSheetDialog.dismiss(); | ||
| 329 | mIsFindItPressed = false; | 328 | mIsFindItPressed = false; |
| 329 | + bottomSheetDialog.dismiss(); | ||
| 330 | }); | 330 | }); |
| 331 | TextView sheetTitle = bottomSheetDialog.findViewById(R.id.tv_sm_sheet_title); | 331 | TextView sheetTitle = bottomSheetDialog.findViewById(R.id.tv_sm_sheet_title); |
| 332 | TextView sheetSubtitle = bottomSheetDialog.findViewById(R.id.tv_sm_sheet_subtitle); | 332 | TextView sheetSubtitle = bottomSheetDialog.findViewById(R.id.tv_sm_sheet_subtitle); |
| ... | @@ -336,8 +336,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -336,8 +336,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
| 336 | 336 | ||
| 337 | ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_sm_sheet_close); | 337 | ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_sm_sheet_close); |
| 338 | dialogClose.setOnClickListener(view -> { | 338 | dialogClose.setOnClickListener(view -> { |
| 339 | - bottomSheetDialog.dismiss(); | ||
| 340 | mIsFindItPressed = false; | 339 | mIsFindItPressed = false; |
| 340 | + bottomSheetDialog.dismiss(); | ||
| 341 | }); | 341 | }); |
| 342 | 342 | ||
| 343 | for (int i = 0; i < shopAvailability.length(); i++) { | 343 | for (int i = 0; i < shopAvailability.length(); i++) { |
| ... | @@ -374,6 +374,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -374,6 +374,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
| 374 | .into(merchantLogo); | 374 | .into(merchantLogo); |
| 375 | ConstraintLayout buyButton = (ConstraintLayout) v.findViewById(R.id.cl_button_sm_buy_it); | 375 | ConstraintLayout buyButton = (ConstraintLayout) v.findViewById(R.id.cl_button_sm_buy_it); |
| 376 | buyButton.setOnClickListener(view -> { | 376 | buyButton.setOnClickListener(view -> { |
| 377 | + mIsFindItPressed = false; | ||
| 377 | bottomSheetDialog.dismiss(); | 378 | bottomSheetDialog.dismiss(); |
| 378 | if (!TextUtils.isEmpty(finalProductUrl)) { | 379 | if (!TextUtils.isEmpty(finalProductUrl)) { |
| 379 | Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(finalProductUrl)); | 380 | Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(finalProductUrl)); | ... | ... |
| ... | @@ -64,7 +64,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -64,7 +64,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene |
| 64 | private EditText mEdtReceiver; | 64 | private EditText mEdtReceiver; |
| 65 | private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing, | 65 | private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing, |
| 66 | mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing, mAlertDialogNoAssets; | 66 | mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing, mAlertDialogNoAssets; |
| 67 | - private boolean mIsFromWallet = false, mIsActiveUnified = false; | 67 | + private boolean mIsFromWallet = false, mIsActiveUnified = false, mIsSharePressed = false; |
| 68 | private RelativeLayout mPbLoading; | 68 | private RelativeLayout mPbLoading; |
| 69 | 69 | ||
| 70 | // =========================================================== | 70 | // =========================================================== |
| ... | @@ -118,6 +118,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -118,6 +118,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene |
| 118 | @Override | 118 | @Override |
| 119 | public void onResume() { | 119 | public void onResume() { |
| 120 | super.onResume(); | 120 | super.onResume(); |
| 121 | + mIsSharePressed = false; | ||
| 121 | WarplyAnalyticsManager.logTrackersEvent(this, "screen", "CouponShareScreen"); | 122 | WarplyAnalyticsManager.logTrackersEvent(this, "screen", "CouponShareScreen"); |
| 122 | 123 | ||
| 123 | WarplyManager.getConsumer(new WarplyConsumerRequest() | 124 | WarplyManager.getConsumer(new WarplyConsumerRequest() |
| ... | @@ -162,7 +163,10 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -162,7 +163,10 @@ public class CouponShareActivity extends Activity implements View.OnClickListene |
| 162 | } | 163 | } |
| 163 | if (view.getId() == R.id.ll_share_button) { | 164 | if (view.getId() == R.id.ll_share_button) { |
| 164 | if (!TextUtils.isEmpty(mSender) && !mTvPhoneHeader.getText().toString().equals(R.string.cos_coupon_share_sender) && !TextUtils.isEmpty(mEdtReceiver.getText().toString())) { | 165 | if (!TextUtils.isEmpty(mSender) && !mTvPhoneHeader.getText().toString().equals(R.string.cos_coupon_share_sender) && !TextUtils.isEmpty(mEdtReceiver.getText().toString())) { |
| 165 | - askSharingDialog(); | 166 | + if (!mIsSharePressed) { |
| 167 | + mIsSharePressed = true; | ||
| 168 | + askSharingDialog(); | ||
| 169 | + } | ||
| 166 | } else { | 170 | } else { |
| 167 | errorSharingDialog2(); | 171 | errorSharingDialog2(); |
| 168 | } | 172 | } |
| ... | @@ -200,6 +204,9 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -200,6 +204,9 @@ public class CouponShareActivity extends Activity implements View.OnClickListene |
| 200 | private void showSharingDialog() { | 204 | private void showSharingDialog() { |
| 201 | final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this, R.style.BottomSheetDialog); | 205 | final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this, R.style.BottomSheetDialog); |
| 202 | bottomSheetDialog.setContentView(R.layout.dl_share); | 206 | bottomSheetDialog.setContentView(R.layout.dl_share); |
| 207 | + bottomSheetDialog.setOnDismissListener(dialog -> { | ||
| 208 | + bottomSheetDialog.dismiss(); | ||
| 209 | + }); | ||
| 203 | LinearLayout parent = bottomSheetDialog.findViewById(R.id.ll_share_dialog_view_inner); | 210 | LinearLayout parent = bottomSheetDialog.findViewById(R.id.ll_share_dialog_view_inner); |
| 204 | 211 | ||
| 205 | ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_sender_list_close); | 212 | ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_sender_list_close); |
| ... | @@ -326,6 +333,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -326,6 +333,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene |
| 326 | }).start(); | 333 | }).start(); |
| 327 | }) | 334 | }) |
| 328 | .setNegativeButton(R.string.cos_dlg_negative_button2, (dialogNegative, whichNegative) -> { | 335 | .setNegativeButton(R.string.cos_dlg_negative_button2, (dialogNegative, whichNegative) -> { |
| 336 | + mIsSharePressed = false; | ||
| 329 | dialogNegative.dismiss(); | 337 | dialogNegative.dismiss(); |
| 330 | }) | 338 | }) |
| 331 | .show(); | 339 | .show(); |
| ... | @@ -347,6 +355,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -347,6 +355,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene |
| 347 | private final CallbackReceiver<JSONObject> mCouponSharingCallback = new CallbackReceiver<JSONObject>() { | 355 | private final CallbackReceiver<JSONObject> mCouponSharingCallback = new CallbackReceiver<JSONObject>() { |
| 348 | @Override | 356 | @Override |
| 349 | public void onSuccess(JSONObject result) { | 357 | public void onSuccess(JSONObject result) { |
| 358 | + mIsSharePressed = false; | ||
| 350 | int status = result.optInt("status", 2); | 359 | int status = result.optInt("status", 2); |
| 351 | String message = result.optString("msg", ""); | 360 | String message = result.optString("msg", ""); |
| 352 | if (status == 1) { | 361 | if (status == 1) { |
| ... | @@ -373,6 +382,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -373,6 +382,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene |
| 373 | 382 | ||
| 374 | @Override | 383 | @Override |
| 375 | public void onFailure(int errorCode) { | 384 | public void onFailure(int errorCode) { |
| 385 | + mIsSharePressed = false; | ||
| 376 | Log.v("COUPON_SHARE", String.valueOf(errorCode)); | 386 | Log.v("COUPON_SHARE", String.valueOf(errorCode)); |
| 377 | runOnUiThread(() -> { | 387 | runOnUiThread(() -> { |
| 378 | mPbLoading.setVisibility(View.GONE); | 388 | mPbLoading.setVisibility(View.GONE); | ... | ... |
| ... | @@ -228,6 +228,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -228,6 +228,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
| 228 | private final CallbackReceiver<JSONObject> mRedeemCouponCallback = new CallbackReceiver<JSONObject>() { | 228 | private final CallbackReceiver<JSONObject> mRedeemCouponCallback = new CallbackReceiver<JSONObject>() { |
| 229 | @Override | 229 | @Override |
| 230 | public void onSuccess(JSONObject result) { | 230 | public void onSuccess(JSONObject result) { |
| 231 | + mIsGiftPressed = false; | ||
| 231 | mPbLoading.setVisibility(View.GONE); | 232 | mPbLoading.setVisibility(View.GONE); |
| 232 | int status = result.optInt("status"); | 233 | int status = result.optInt("status"); |
| 233 | if (status == 1) { | 234 | if (status == 1) { |
| ... | @@ -283,6 +284,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -283,6 +284,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
| 283 | 284 | ||
| 284 | @Override | 285 | @Override |
| 285 | public void onFailure(int errorCode) { | 286 | public void onFailure(int errorCode) { |
| 287 | + mIsGiftPressed = false; | ||
| 286 | mPbLoading.setVisibility(View.GONE); | 288 | mPbLoading.setVisibility(View.GONE); |
| 287 | showDialog(false, errorCode); | 289 | showDialog(false, errorCode); |
| 288 | mLlRedeem.setEnabled(true); | 290 | mLlRedeem.setEnabled(true); | ... | ... |
| ... | @@ -2,6 +2,7 @@ package ly.warp.sdk.activities; | ... | @@ -2,6 +2,7 @@ package ly.warp.sdk.activities; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | +import android.content.DialogInterface; | ||
| 5 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 6 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
| 7 | import android.util.Log; | 8 | import android.util.Log; |
| ... | @@ -10,6 +11,7 @@ import android.view.View; | ... | @@ -10,6 +11,7 @@ import android.view.View; |
| 10 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
| 11 | import android.widget.ImageView; | 12 | import android.widget.ImageView; |
| 12 | import android.widget.LinearLayout; | 13 | import android.widget.LinearLayout; |
| 14 | +import android.widget.RelativeLayout; | ||
| 13 | import android.widget.TextView; | 15 | import android.widget.TextView; |
| 14 | 16 | ||
| 15 | import androidx.appcompat.app.AlertDialog; | 17 | import androidx.appcompat.app.AlertDialog; |
| ... | @@ -59,7 +61,8 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -59,7 +61,8 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
| 59 | private String mSender = ""; | 61 | private String mSender = ""; |
| 60 | private AlertDialog mAlertDialogAskActivate, mAlertDialogErrorActivating, mAlertDialogSuccessActivating; | 62 | private AlertDialog mAlertDialogAskActivate, mAlertDialogErrorActivating, mAlertDialogSuccessActivating; |
| 61 | private LinearLayout mLlSeeMore; | 63 | private LinearLayout mLlSeeMore; |
| 62 | - private boolean mIsSeeMoreShown = false; | 64 | + private boolean mIsSeeMoreShown = false, mIsActivatePressed = false; |
| 65 | + private RelativeLayout mPbLoading; | ||
| 63 | 66 | ||
| 64 | // =========================================================== | 67 | // =========================================================== |
| 65 | // Methods for/from SuperClass/Interfaces | 68 | // Methods for/from SuperClass/Interfaces |
| ... | @@ -92,6 +95,8 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -92,6 +95,8 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
| 92 | mTvSeeMoreValue = findViewById(R.id.tv_see_more_value); | 95 | mTvSeeMoreValue = findViewById(R.id.tv_see_more_value); |
| 93 | mFontButtonGetIt = findViewById(R.id.button_get_it); | 96 | mFontButtonGetIt = findViewById(R.id.button_get_it); |
| 94 | mFontButtonSeeMore = findViewById(R.id.tv_see_more); | 97 | mFontButtonSeeMore = findViewById(R.id.tv_see_more); |
| 98 | + mPbLoading = findViewById(R.id.pb_loading); | ||
| 99 | + mPbLoading.setOnTouchListener((v, event) -> true); | ||
| 95 | WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mTvTelcoHeaderTitle); | 100 | WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mTvTelcoHeaderTitle); |
| 96 | WarpUtils.renderCustomFont(this, R.font.peridot_semi_bold, mTvTelcoGiftValue, mFontButtonGetIt); | 101 | WarpUtils.renderCustomFont(this, R.font.peridot_semi_bold, mTvTelcoGiftValue, mFontButtonGetIt); |
| 97 | WarpUtils.renderCustomFont(this, R.font.peridot_regular, mTvTelcoGiftType, mTvTelcoGiftDuration, | 102 | WarpUtils.renderCustomFont(this, R.font.peridot_regular, mTvTelcoGiftType, mTvTelcoGiftDuration, |
| ... | @@ -104,6 +109,7 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -104,6 +109,7 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
| 104 | @Override | 109 | @Override |
| 105 | public void onResume() { | 110 | public void onResume() { |
| 106 | super.onResume(); | 111 | super.onResume(); |
| 112 | + mIsActivatePressed = false; | ||
| 107 | WarplyAnalyticsManager.logTrackersEvent(this, "screen", "TelcoScreen"); | 113 | WarplyAnalyticsManager.logTrackersEvent(this, "screen", "TelcoScreen"); |
| 108 | 114 | ||
| 109 | // new Thread(() -> { | 115 | // new Thread(() -> { |
| ... | @@ -122,7 +128,10 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -122,7 +128,10 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
| 122 | return; | 128 | return; |
| 123 | } | 129 | } |
| 124 | if (view.getId() == R.id.ll_activate_button) { | 130 | if (view.getId() == R.id.ll_activate_button) { |
| 125 | - showActivationDialog(); | 131 | + if (!mIsActivatePressed) { |
| 132 | + mIsActivatePressed = true; | ||
| 133 | + showActivationDialog(); | ||
| 134 | + } | ||
| 126 | return; | 135 | return; |
| 127 | } | 136 | } |
| 128 | if (view.getId() == R.id.ll_see_more) { | 137 | if (view.getId() == R.id.ll_see_more) { |
| ... | @@ -174,13 +183,20 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -174,13 +183,20 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
| 174 | private void showActivationDialog() { | 183 | private void showActivationDialog() { |
| 175 | final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this, R.style.BottomSheetDialog); | 184 | final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this, R.style.BottomSheetDialog); |
| 176 | bottomSheetDialog.setContentView(R.layout.dl_share); | 185 | bottomSheetDialog.setContentView(R.layout.dl_share); |
| 186 | + bottomSheetDialog.setOnDismissListener(dialog -> { | ||
| 187 | + mIsActivatePressed = false; | ||
| 188 | + bottomSheetDialog.dismiss(); | ||
| 189 | + }); | ||
| 177 | TextView tvHeader = bottomSheetDialog.findViewById(R.id.tv_sender_value); | 190 | TextView tvHeader = bottomSheetDialog.findViewById(R.id.tv_sender_value); |
| 178 | WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, tvHeader); | 191 | WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, tvHeader); |
| 179 | tvHeader.setText(R.string.cos_coupon_share_telco); | 192 | tvHeader.setText(R.string.cos_coupon_share_telco); |
| 180 | LinearLayout parent = bottomSheetDialog.findViewById(R.id.ll_share_dialog_view_inner); | 193 | LinearLayout parent = bottomSheetDialog.findViewById(R.id.ll_share_dialog_view_inner); |
| 181 | 194 | ||
| 182 | ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_sender_list_close); | 195 | ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_sender_list_close); |
| 183 | - dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss()); | 196 | + dialogClose.setOnClickListener(view -> { |
| 197 | + mIsActivatePressed = false; | ||
| 198 | + bottomSheetDialog.dismiss(); | ||
| 199 | + }); | ||
| 184 | 200 | ||
| 185 | if (mCCMS.getEligibleAssets() != null && mCCMS.getEligibleAssets().size() > 0) { | 201 | if (mCCMS.getEligibleAssets() != null && mCCMS.getEligibleAssets().size() > 0) { |
| 186 | for (int i = 0; i < mCCMS.getEligibleAssets().size(); i++) { | 202 | for (int i = 0; i < mCCMS.getEligibleAssets().size(); i++) { |
| ... | @@ -245,9 +261,11 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -245,9 +261,11 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
| 245 | .setTitle(R.string.cos_dlg_activate_telco_title) | 261 | .setTitle(R.string.cos_dlg_activate_telco_title) |
| 246 | .setMessage(R.string.cos_dlg_activate_telco_subtitle) | 262 | .setMessage(R.string.cos_dlg_activate_telco_subtitle) |
| 247 | .setPositiveButton(R.string.cos_dlg_positive_button, (dialogPositive, whichPositive) -> { | 263 | .setPositiveButton(R.string.cos_dlg_positive_button, (dialogPositive, whichPositive) -> { |
| 264 | + mPbLoading.setVisibility(View.VISIBLE); | ||
| 248 | activateGift(); | 265 | activateGift(); |
| 249 | }) | 266 | }) |
| 250 | .setNegativeButton(R.string.cos_dlg_negative_button2, (dialogNegative, whichNegative) -> { | 267 | .setNegativeButton(R.string.cos_dlg_negative_button2, (dialogNegative, whichNegative) -> { |
| 268 | + mIsActivatePressed = false; | ||
| 251 | dialogNegative.dismiss(); | 269 | dialogNegative.dismiss(); |
| 252 | }) | 270 | }) |
| 253 | .show(); | 271 | .show(); |
| ... | @@ -315,8 +333,10 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -315,8 +333,10 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
| 315 | private CallbackReceiver<JSONObject> mSubmitCallback = new CallbackReceiver<JSONObject>() { | 333 | private CallbackReceiver<JSONObject> mSubmitCallback = new CallbackReceiver<JSONObject>() { |
| 316 | @Override | 334 | @Override |
| 317 | public void onSuccess(JSONObject result) { | 335 | public void onSuccess(JSONObject result) { |
| 336 | + mIsActivatePressed = false; | ||
| 318 | int status = result.optInt("status", 2); | 337 | int status = result.optInt("status", 2); |
| 319 | runOnUiThread(() -> { | 338 | runOnUiThread(() -> { |
| 339 | + mPbLoading.setVisibility(View.GONE); | ||
| 320 | if (status == 1) | 340 | if (status == 1) |
| 321 | successActivatingDialog(); | 341 | successActivatingDialog(); |
| 322 | else | 342 | else |
| ... | @@ -346,7 +366,11 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -346,7 +366,11 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
| 346 | 366 | ||
| 347 | @Override | 367 | @Override |
| 348 | public void onFailure(int errorCode) { | 368 | public void onFailure(int errorCode) { |
| 349 | - runOnUiThread(() -> errorActivatingDialog()); | 369 | + mIsActivatePressed = false; |
| 370 | + runOnUiThread(() -> { | ||
| 371 | + mPbLoading.setVisibility(View.GONE); | ||
| 372 | + errorActivatingDialog(); | ||
| 373 | + }); | ||
| 350 | } | 374 | } |
| 351 | }; | 375 | }; |
| 352 | 376 | ... | ... |
| ... | @@ -72,7 +72,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL | ... | @@ -72,7 +72,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL |
| 72 | mLlCancelUnified; | 72 | mLlCancelUnified; |
| 73 | private UnifiedCoupon mCoupon; | 73 | private UnifiedCoupon mCoupon; |
| 74 | private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false, | 74 | private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false, |
| 75 | - mIsMarketExpand = true, mShopsPressed = false, mCouponPressed = false; | 75 | + mIsMarketExpand = true, mShopsPressed = false, mCouponPressed = false, mCancelPressed = false; |
| 76 | private RecyclerView mRecyclerCoupons; | 76 | private RecyclerView mRecyclerCoupons; |
| 77 | private ActiveCouponAdapter mAdapterCoupons; | 77 | private ActiveCouponAdapter mAdapterCoupons; |
| 78 | private AlertDialog mErrorAlertDialog, mSuccessAlertDialog, mAskCancelUnifiedAlertDialog; | 78 | private AlertDialog mErrorAlertDialog, mSuccessAlertDialog, mAskCancelUnifiedAlertDialog; |
| ... | @@ -144,6 +144,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL | ... | @@ -144,6 +144,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL |
| 144 | WarplyAnalyticsManager.logTrackersEvent(this, "screen", "UnifiedCouponScreen"); | 144 | WarplyAnalyticsManager.logTrackersEvent(this, "screen", "UnifiedCouponScreen"); |
| 145 | mShopsPressed = false; | 145 | mShopsPressed = false; |
| 146 | mCouponPressed = false; | 146 | mCouponPressed = false; |
| 147 | + mCancelPressed = false; | ||
| 147 | } | 148 | } |
| 148 | 149 | ||
| 149 | @Override | 150 | @Override |
| ... | @@ -184,7 +185,10 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL | ... | @@ -184,7 +185,10 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL |
| 184 | return; | 185 | return; |
| 185 | } | 186 | } |
| 186 | if (view.getId() == R.id.ll_cancel_coupon) { | 187 | if (view.getId() == R.id.ll_cancel_coupon) { |
| 187 | - askCancelUnifiedDialog(); | 188 | + if(!mCancelPressed) { |
| 189 | + mCancelPressed = true; | ||
| 190 | + askCancelUnifiedDialog(); | ||
| 191 | + } | ||
| 188 | } | 192 | } |
| 189 | } | 193 | } |
| 190 | 194 | ||
| ... | @@ -438,6 +442,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL | ... | @@ -438,6 +442,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL |
| 438 | cancelUnified(); | 442 | cancelUnified(); |
| 439 | }) | 443 | }) |
| 440 | .setNegativeButton(R.string.cos_dlg_negative_button4, (dialogNegative, whichNegative) -> { | 444 | .setNegativeButton(R.string.cos_dlg_negative_button4, (dialogNegative, whichNegative) -> { |
| 445 | + mCancelPressed = false; | ||
| 441 | dialogNegative.dismiss(); | 446 | dialogNegative.dismiss(); |
| 442 | }) | 447 | }) |
| 443 | .show(); | 448 | .show(); |
| ... | @@ -476,12 +481,14 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL | ... | @@ -476,12 +481,14 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL |
| 476 | private final CallbackReceiver<Integer> mCancelUnifiedCallback = new CallbackReceiver<Integer>() { | 481 | private final CallbackReceiver<Integer> mCancelUnifiedCallback = new CallbackReceiver<Integer>() { |
| 477 | @Override | 482 | @Override |
| 478 | public void onSuccess(Integer result) { | 483 | public void onSuccess(Integer result) { |
| 484 | + mCancelPressed = false; | ||
| 479 | mPbLoading.setVisibility(View.GONE); | 485 | mPbLoading.setVisibility(View.GONE); |
| 480 | successDialog(); | 486 | successDialog(); |
| 481 | } | 487 | } |
| 482 | 488 | ||
| 483 | @Override | 489 | @Override |
| 484 | public void onFailure(int errorCode) { | 490 | public void onFailure(int errorCode) { |
| 491 | + mCancelPressed = false; | ||
| 485 | mPbLoading.setVisibility(View.GONE); | 492 | mPbLoading.setVisibility(View.GONE); |
| 486 | errorDialog(); | 493 | errorDialog(); |
| 487 | } | 494 | } | ... | ... |
| ... | @@ -1349,6 +1349,34 @@ public class WarplyManagerHelper { | ... | @@ -1349,6 +1349,34 @@ public class WarplyManagerHelper { |
| 1349 | } | 1349 | } |
| 1350 | } | 1350 | } |
| 1351 | 1351 | ||
| 1352 | + public static void updateCampaignItem(String sessionUuid) { | ||
| 1353 | + Campaign tempCampaign; | ||
| 1354 | + for (Campaign cmp : WarplyManagerHelper.getCampaignListAll()) { | ||
| 1355 | + if (cmp.getSessionUUID().equals(sessionUuid)) { | ||
| 1356 | + if (mCampaignListAll != null && !mCampaignListAll.isEmpty()) { | ||
| 1357 | + mCampaignListAll.remove(cmp); | ||
| 1358 | + tempCampaign = cmp; | ||
| 1359 | + tempCampaign.setNew(false); | ||
| 1360 | + mCampaignListAll.add(tempCampaign); | ||
| 1361 | + } | ||
| 1362 | + break; | ||
| 1363 | + } | ||
| 1364 | + } | ||
| 1365 | + | ||
| 1366 | + Campaign tempCarouselCampaign; | ||
| 1367 | + for (Campaign cmp : WarplyManagerHelper.getCarouselList()) { | ||
| 1368 | + if (cmp.getSessionUUID().equals(sessionUuid)) { | ||
| 1369 | + if (mCarouselList != null && !mCarouselList.isEmpty()) { | ||
| 1370 | + mCarouselList.remove(cmp); | ||
| 1371 | + tempCarouselCampaign = cmp; | ||
| 1372 | + tempCarouselCampaign.setNew(false); | ||
| 1373 | + mCarouselList.add(tempCarouselCampaign); | ||
| 1374 | + } | ||
| 1375 | + break; | ||
| 1376 | + } | ||
| 1377 | + } | ||
| 1378 | + } | ||
| 1379 | + | ||
| 1352 | public static void setCouponList(CouponList couponList) { | 1380 | public static void setCouponList(CouponList couponList) { |
| 1353 | LoyaltyBadgeModel badge = new LoyaltyBadgeModel(); | 1381 | LoyaltyBadgeModel badge = new LoyaltyBadgeModel(); |
| 1354 | CouponList cpnlist = new CouponList(); | 1382 | CouponList cpnlist = new CouponList(); | ... | ... |
| ... | @@ -5418,6 +5418,10 @@ public class WarplyManager { | ... | @@ -5418,6 +5418,10 @@ public class WarplyManager { |
| 5418 | dynatraceEvent.setEventName("custom_success_read_campaign_loyalty"); | 5418 | dynatraceEvent.setEventName("custom_success_read_campaign_loyalty"); |
| 5419 | EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | 5419 | EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); |
| 5420 | 5420 | ||
| 5421 | + /* New Addition start */ | ||
| 5422 | + WarplyManagerHelper.updateCampaignItem(sessionUuid); | ||
| 5423 | + /* New Addition end */ | ||
| 5424 | + | ||
| 5421 | // getCampaigns(new CallbackReceiver<ArrayList<Campaign>>() { | 5425 | // getCampaigns(new CallbackReceiver<ArrayList<Campaign>>() { |
| 5422 | // @Override | 5426 | // @Override |
| 5423 | // public void onSuccess(ArrayList<Campaign> result) { | 5427 | // public void onSuccess(ArrayList<Campaign> result) { |
| ... | @@ -5439,6 +5443,10 @@ public class WarplyManager { | ... | @@ -5439,6 +5443,10 @@ public class WarplyManager { |
| 5439 | dynatraceEvent.setEventName("custom_success_read_campaign_loyalty"); | 5443 | dynatraceEvent.setEventName("custom_success_read_campaign_loyalty"); |
| 5440 | EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | 5444 | EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); |
| 5441 | 5445 | ||
| 5446 | + /* New Addition start */ | ||
| 5447 | + WarplyManagerHelper.updateCampaignItem(sessionUuid); | ||
| 5448 | + /* New Addition end */ | ||
| 5449 | + | ||
| 5442 | // getCampaigns(new CallbackReceiver<ArrayList<Campaign>>() { | 5450 | // getCampaigns(new CallbackReceiver<ArrayList<Campaign>>() { |
| 5443 | // @Override | 5451 | // @Override |
| 5444 | // public void onSuccess(ArrayList<Campaign> result) { | 5452 | // public void onSuccess(ArrayList<Campaign> result) { | ... | ... |
| ... | @@ -216,4 +216,22 @@ | ... | @@ -216,4 +216,22 @@ |
| 216 | </RelativeLayout> | 216 | </RelativeLayout> |
| 217 | </androidx.constraintlayout.widget.ConstraintLayout> | 217 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 218 | </ScrollView> | 218 | </ScrollView> |
| 219 | + | ||
| 220 | + <RelativeLayout | ||
| 221 | + android:id="@+id/pb_loading" | ||
| 222 | + android:layout_width="match_parent" | ||
| 223 | + android:layout_height="match_parent" | ||
| 224 | + android:layout_centerInParent="true" | ||
| 225 | + android:background="@android:color/transparent" | ||
| 226 | + android:visibility="gone" | ||
| 227 | + tools:visibility="visible"> | ||
| 228 | + | ||
| 229 | + <ProgressBar | ||
| 230 | + android:layout_width="48dp" | ||
| 231 | + android:layout_height="48dp" | ||
| 232 | + android:layout_centerInParent="true" | ||
| 233 | + android:indeterminate="true" | ||
| 234 | + android:indeterminateTint="@color/cos_green5" | ||
| 235 | + android:indeterminateTintMode="src_atop" /> | ||
| 236 | + </RelativeLayout> | ||
| 219 | </RelativeLayout> | 237 | </RelativeLayout> | ... | ... |
-
Please register or login to post a comment