Panagiotis Triantafyllou

multiple click fixes

...@@ -58,7 +58,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -58,7 +58,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
58 private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms, mLlWebsite; 58 private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms, mLlWebsite;
59 private Coupon mCoupon; 59 private Coupon mCoupon;
60 private Couponset mCouponset; 60 private Couponset mCouponset;
61 - private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false; 61 + private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false,
62 + mShopsPressed = false, mGiftPressed = false, mEshopPressed = false;
62 private Merchant mMerchant; 63 private Merchant mMerchant;
63 64
64 // =========================================================== 65 // ===========================================================
...@@ -99,6 +100,9 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -99,6 +100,9 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
99 public void onResume() { 100 public void onResume() {
100 super.onResume(); 101 super.onResume();
101 WarplyAnalyticsManager.logTrackersEvent(this, "screen", "CouponScreen"); 102 WarplyAnalyticsManager.logTrackersEvent(this, "screen", "CouponScreen");
103 + mShopsPressed = false;
104 + mGiftPressed = false;
105 + mEshopPressed = false;
102 } 106 }
103 107
104 @Override 108 @Override
...@@ -119,41 +123,50 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -119,41 +123,50 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
119 return; 123 return;
120 } 124 }
121 if (view.getId() == R.id.ll_gift_it) { 125 if (view.getId() == R.id.ll_gift_it) {
122 - WarplyAnalyticsManager.logTrackersEvent(this, "click", ("ShareCoupon") 126 + if (!mGiftPressed) {
123 - .concat(":") 127 + mGiftPressed = true;
124 - .concat(mCoupon.getName())); 128 + WarplyAnalyticsManager.logTrackersEvent(this, "click", ("ShareCoupon")
125 - 129 + .concat(":")
126 - Intent intent = new Intent(CouponInfoActivity.this, CouponShareActivity.class); 130 + .concat(mCoupon.getName()));
127 - intent.putExtra("coupon", (Serializable) mCoupon); 131 +
128 - intent.putExtra("isFromWallet", mIsFromWallet); 132 + Intent intent = new Intent(CouponInfoActivity.this, CouponShareActivity.class);
129 - if (!mIsFromWallet) 133 + intent.putExtra("coupon", (Serializable) mCoupon);
130 - startActivity(intent); 134 + intent.putExtra("isFromWallet", mIsFromWallet);
131 - else 135 + if (!mIsFromWallet)
132 - startActivityForResult(intent, 1001); 136 + startActivity(intent);
137 + else
138 + startActivityForResult(intent, 1001);
139 + }
133 return; 140 return;
134 } 141 }
135 if (view.getId() == R.id.ll_shops) { 142 if (view.getId() == R.id.ll_shops) {
136 - WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShops"); 143 + if (!mShopsPressed) {
137 - 144 + mShopsPressed = true;
138 - if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(CouponInfoActivity.this) == ConnectionResult.SUCCESS) { 145 + WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShops");
139 - Intent intent = new Intent(CouponInfoActivity.this, ShopsActivity.class); 146 +
140 - intent.putExtra("couponset", (Serializable) mCouponset); 147 + if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(CouponInfoActivity.this) == ConnectionResult.SUCCESS) {
141 - startActivity(intent); 148 + Intent intent = new Intent(CouponInfoActivity.this, ShopsActivity.class);
142 - return; 149 + intent.putExtra("couponset", (Serializable) mCouponset);
143 - } else { 150 + startActivity(intent);
144 - Intent intent = new Intent(CouponInfoActivity.this, ShopsHuaweiActivity.class); 151 + return;
145 - intent.putExtra("couponset", (Serializable) mCouponset); 152 + } else {
146 - startActivity(intent); 153 + Intent intent = new Intent(CouponInfoActivity.this, ShopsHuaweiActivity.class);
147 - return; 154 + intent.putExtra("couponset", (Serializable) mCouponset);
155 + startActivity(intent);
156 + return;
157 + }
148 } 158 }
149 } 159 }
150 if (view.getId() == R.id.ll_website) { 160 if (view.getId() == R.id.ll_website) {
151 - WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShopWebsite"); 161 + if (!mEshopPressed) {
152 - 162 + mEshopPressed = true;
153 - if (!TextUtils.isEmpty(mMerchant.getWebsite())) { 163 + WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShopWebsite");
154 - Intent intent = new Intent(Intent.ACTION_VIEW); 164 +
155 - intent.setData(Uri.parse(mMerchant.getWebsite())); 165 + if (!TextUtils.isEmpty(mMerchant.getWebsite())) {
156 - startActivity(intent); 166 + Intent intent = new Intent(Intent.ACTION_VIEW);
167 + intent.setData(Uri.parse(mMerchant.getWebsite()));
168 + startActivity(intent);
169 + }
157 } 170 }
158 return; 171 return;
159 } 172 }
......
...@@ -100,7 +100,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -100,7 +100,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
100 private ExpandableLayout mElGifts; 100 private ExpandableLayout mElGifts;
101 private boolean mIsStayCollapsed = true; 101 private boolean mIsStayCollapsed = true;
102 private CardView mClExp; 102 private CardView mClExp;
103 - private boolean mDfyPressed = false, mDealsBannerPressed = false; 103 + private boolean mDfyPressed = false, mDealsBannerPressed = false, mQuestionnairePressed = false,
104 + mHistoryPressed = false, mHistoryMarketPressed = false, mUnifiedPressed = false,
105 + mCouponPressed = false;
104 106
105 // =========================================================== 107 // ===========================================================
106 // Methods for/from SuperClass/Interfaces 108 // Methods for/from SuperClass/Interfaces
...@@ -206,6 +208,11 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -206,6 +208,11 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
206 }); 208 });
207 mDfyPressed = false; 209 mDfyPressed = false;
208 mDealsBannerPressed = false; 210 mDealsBannerPressed = false;
211 + mQuestionnairePressed = false;
212 + mHistoryPressed = false;
213 + mHistoryMarketPressed = false;
214 + mUnifiedPressed = false;
215 + mCouponPressed = false;
209 } 216 }
210 217
211 @Override 218 @Override
...@@ -229,15 +236,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -229,15 +236,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
229 return; 236 return;
230 } 237 }
231 if (view.getId() == R.id.ll_user_questionnaire || view.getId() == R.id.ll_user_badge) { 238 if (view.getId() == R.id.ll_user_questionnaire || view.getId() == R.id.ll_user_badge) {
232 - WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") 239 + if (!mQuestionnairePressed) {
233 - .concat(":") 240 + mQuestionnairePressed = true;
234 - .concat("Questionnaire")); 241 + WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
242 + .concat(":")
243 + .concat("Questionnaire"));
235 244
236 - startActivityForResult(WarpViewActivity.createIntentFromURL(LoyaltyWallet.this, WarplyManagerHelper.openQuestionnaire()), 1000); 245 + startActivityForResult(WarpViewActivity.createIntentFromURL(LoyaltyWallet.this, WarplyManagerHelper.openQuestionnaire()), 1000);
246 + }
237 return; 247 return;
238 } 248 }
239 if (view.getId() == R.id.cl_deals_win_inner_cos) { 249 if (view.getId() == R.id.cl_deals_win_inner_cos) {
240 - if(!mDealsBannerPressed) { 250 + if (!mDealsBannerPressed) {
241 mDealsBannerPressed = true; 251 mDealsBannerPressed = true;
242 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") 252 WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
243 .concat(":") 253 .concat(":")
...@@ -256,17 +266,20 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -256,17 +266,20 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
256 return; 266 return;
257 } 267 }
258 if (view.getId() == R.id.cl_deals_win_inner) { 268 if (view.getId() == R.id.cl_deals_win_inner) {
259 - WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") 269 + if (!mHistoryPressed) {
260 - .concat(":") 270 + mHistoryPressed = true;
261 - .concat("LoyaltyBanner")); 271 + WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
272 + .concat(":")
273 + .concat("LoyaltyBanner"));
262 274
263 - LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); 275 + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
264 - analyticsEvent.setEventName("did_tap_gifts_for_you_badge"); 276 + analyticsEvent.setEventName("did_tap_gifts_for_you_badge");
265 - analyticsEvent.setParameter("screen", "Loyalty Wallet"); 277 + analyticsEvent.setParameter("screen", "Loyalty Wallet");
266 - EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); 278 + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
267 279
268 - Intent intent = new Intent(LoyaltyWallet.this, LoyaltyAnalysisActivity.class); 280 + Intent intent = new Intent(LoyaltyWallet.this, LoyaltyAnalysisActivity.class);
269 - startActivity(intent); 281 + startActivity(intent);
282 + }
270 return; 283 return;
271 } 284 }
272 if (view.getId() == R.id.cl_exp) { 285 if (view.getId() == R.id.cl_exp) {
...@@ -282,15 +295,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -282,15 +295,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
282 } 295 }
283 if (view.getId() == R.id.cl_market_inner) { 296 if (view.getId() == R.id.cl_market_inner) {
284 // if (countValue > 0) { 297 // if (countValue > 0) {
285 - WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") 298 + if (!mHistoryMarketPressed) {
286 - .concat(":") 299 + mHistoryMarketPressed = true;
287 - .concat("MarketBanner")); 300 + WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
288 - LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); 301 + .concat(":")
289 - analyticsEvent.setEventName("did_tap_market_badge"); 302 + .concat("MarketBanner"));
290 - analyticsEvent.setParameter("screen", "Loyalty Wallet"); 303 + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
291 - EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); 304 + analyticsEvent.setEventName("did_tap_market_badge");
292 - Intent intent = new Intent(LoyaltyWallet.this, LoyaltyMarketAnalysisActivity.class); 305 + analyticsEvent.setParameter("screen", "Loyalty Wallet");
293 - startActivity(intent); 306 + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
307 + Intent intent = new Intent(LoyaltyWallet.this, LoyaltyMarketAnalysisActivity.class);
308 + startActivity(intent);
309 + }
294 // } 310 // }
295 return; 311 return;
296 } 312 }
...@@ -340,6 +356,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -340,6 +356,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
340 @Subscribe() 356 @Subscribe()
341 public void onMessageEvent(WarplyEventBusManager event) { 357 public void onMessageEvent(WarplyEventBusManager event) {
342 if (event.getCouponsAdded() != null) { 358 if (event.getCouponsAdded() != null) {
359 + mCouponPressed = false;
343 CouponList tempCouponList = new CouponList(); 360 CouponList tempCouponList = new CouponList();
344 CouponList cpnlist = new CouponList(); 361 CouponList cpnlist = new CouponList();
345 tempCouponList.clear(); 362 tempCouponList.clear();
...@@ -367,11 +384,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -367,11 +384,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
367 mRecyclerCoupons.setAdapter(mAdapterCoupons); 384 mRecyclerCoupons.setAdapter(mAdapterCoupons);
368 mAdapterCoupons.getPositionClicks() 385 mAdapterCoupons.getPositionClicks()
369 .doOnNext(coupon -> { 386 .doOnNext(coupon -> {
370 - WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName())); 387 + if (!mCouponPressed) {
371 - Intent intent = new Intent(LoyaltyWallet.this, CouponInfoActivity.class); 388 + mCouponPressed = true;
372 - intent.putExtra("coupon", (Serializable) coupon); 389 + WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName()));
373 - intent.putExtra("isFromWallet", true); 390 + Intent intent = new Intent(LoyaltyWallet.this, CouponInfoActivity.class);
374 - startActivityForResult(intent, 1002); 391 + intent.putExtra("coupon", (Serializable) coupon);
392 + intent.putExtra("isFromWallet", true);
393 + startActivityForResult(intent, 1002);
394 + }
375 }) 395 })
376 .doOnError(error -> { 396 .doOnError(error -> {
377 }) 397 })
...@@ -418,11 +438,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -418,11 +438,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
418 mRvMarketCoupons.setAdapter(mAdapterMarketCoupons); 438 mRvMarketCoupons.setAdapter(mAdapterMarketCoupons);
419 mAdapterMarketCoupons.getPositionClicks() 439 mAdapterMarketCoupons.getPositionClicks()
420 .doOnNext(coupon -> { 440 .doOnNext(coupon -> {
421 - WarplyAnalyticsManager.logTrackersEvent(this, "click", ("UnifiedCoupon").concat(":").concat(coupon.getBarcode())); 441 + if (!mUnifiedPressed) {
422 - Intent intent = new Intent(LoyaltyWallet.this, UnifiedCouponInfoActivity.class); 442 + mUnifiedPressed = true;
423 - intent.putExtra("coupon", (Serializable) coupon); 443 + WarplyAnalyticsManager.logTrackersEvent(this, "click", ("UnifiedCoupon").concat(":").concat(coupon.getBarcode()));
424 - intent.putExtra("isFromWallet", true); 444 + Intent intent = new Intent(LoyaltyWallet.this, UnifiedCouponInfoActivity.class);
425 - startActivity(intent); 445 + intent.putExtra("coupon", (Serializable) coupon);
446 + intent.putExtra("isFromWallet", true);
447 + startActivity(intent);
448 + }
426 // startActivityForResult(intent, 1002); 449 // startActivityForResult(intent, 1002);
427 }) 450 })
428 .doOnError(error -> { 451 .doOnError(error -> {
...@@ -455,11 +478,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -455,11 +478,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
455 mRecyclerCoupons.setAdapter(mAdapterCoupons); 478 mRecyclerCoupons.setAdapter(mAdapterCoupons);
456 mAdapterCoupons.getPositionClicks() 479 mAdapterCoupons.getPositionClicks()
457 .doOnNext(coupon -> { 480 .doOnNext(coupon -> {
458 - WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName())); 481 + if (!mCouponPressed) {
459 - Intent intent = new Intent(LoyaltyWallet.this, CouponInfoActivity.class); 482 + mCouponPressed = true;
460 - intent.putExtra("coupon", (Serializable) coupon); 483 + WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName()));
461 - intent.putExtra("isFromWallet", true); 484 + Intent intent = new Intent(LoyaltyWallet.this, CouponInfoActivity.class);
462 - startActivityForResult(intent, 1002); 485 + intent.putExtra("coupon", (Serializable) coupon);
486 + intent.putExtra("isFromWallet", true);
487 + startActivityForResult(intent, 1002);
488 + }
463 }) 489 })
464 .doOnError(error -> { 490 .doOnError(error -> {
465 }) 491 })
......
...@@ -53,7 +53,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL ...@@ -53,7 +53,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
53 private LinearLayout mLlShops, mLlBarcodeContainer, mLlTerms, mLlMarketCoupons, mLlMarketExpand; 53 private LinearLayout mLlShops, mLlBarcodeContainer, mLlTerms, mLlMarketCoupons, mLlMarketExpand;
54 private UnifiedCoupon mCoupon; 54 private UnifiedCoupon mCoupon;
55 private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false, 55 private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false,
56 - mIsMarketExpand = true; 56 + mIsMarketExpand = true, mShopsPressed = false, mCouponPressed = false;
57 private RecyclerView mRecyclerCoupons; 57 private RecyclerView mRecyclerCoupons;
58 private ActiveCouponAdapter mAdapterCoupons; 58 private ActiveCouponAdapter mAdapterCoupons;
59 59
...@@ -102,6 +102,8 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL ...@@ -102,6 +102,8 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
102 public void onResume() { 102 public void onResume() {
103 super.onResume(); 103 super.onResume();
104 WarplyAnalyticsManager.logTrackersEvent(this, "screen", "UnifiedCouponScreen"); 104 WarplyAnalyticsManager.logTrackersEvent(this, "screen", "UnifiedCouponScreen");
105 + mShopsPressed = false;
106 + mCouponPressed = false;
105 } 107 }
106 108
107 @Override 109 @Override
...@@ -111,16 +113,18 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL ...@@ -111,16 +113,18 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
111 return; 113 return;
112 } 114 }
113 if (view.getId() == R.id.ll_shops) { 115 if (view.getId() == R.id.ll_shops) {
114 - WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShops"); 116 + if (!mShopsPressed) {
115 - 117 + mShopsPressed = true;
116 - if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(UnifiedCouponInfoActivity.this) == ConnectionResult.SUCCESS) { 118 + WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShops");
117 - Intent intent = new Intent(UnifiedCouponInfoActivity.this, ShopsActivity.class); 119 + if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(UnifiedCouponInfoActivity.this) == ConnectionResult.SUCCESS) {
118 - startActivity(intent); 120 + Intent intent = new Intent(UnifiedCouponInfoActivity.this, ShopsActivity.class);
119 - return; 121 + startActivity(intent);
120 - } else { 122 + return;
121 - Intent intent = new Intent(UnifiedCouponInfoActivity.this, ShopsHuaweiActivity.class); 123 + } else {
122 - startActivity(intent); 124 + Intent intent = new Intent(UnifiedCouponInfoActivity.this, ShopsHuaweiActivity.class);
123 - return; 125 + startActivity(intent);
126 + return;
127 + }
124 } 128 }
125 } 129 }
126 if (view.getId() == R.id.ll_terms_inner) { 130 if (view.getId() == R.id.ll_terms_inner) {
...@@ -203,11 +207,14 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL ...@@ -203,11 +207,14 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
203 mRecyclerCoupons.setAdapter(mAdapterCoupons); 207 mRecyclerCoupons.setAdapter(mAdapterCoupons);
204 mAdapterCoupons.getPositionClicks() 208 mAdapterCoupons.getPositionClicks()
205 .doOnNext(coupon -> { 209 .doOnNext(coupon -> {
206 - WarplyAnalyticsManager.logTrackersEvent(this, "click", ("MarketCoupon").concat(":").concat(coupon.getName())); 210 + if (!mCouponPressed) {
207 - Intent intent = new Intent(UnifiedCouponInfoActivity.this, CouponInfoActivity.class); 211 + mCouponPressed = true;
208 - intent.putExtra("coupon", (Serializable) coupon); 212 + WarplyAnalyticsManager.logTrackersEvent(this, "click", ("MarketCoupon").concat(":").concat(coupon.getName()));
209 - intent.putExtra("isFromWallet", true); 213 + Intent intent = new Intent(UnifiedCouponInfoActivity.this, CouponInfoActivity.class);
210 - startActivity(intent); 214 + intent.putExtra("coupon", (Serializable) coupon);
215 + intent.putExtra("isFromWallet", true);
216 + startActivity(intent);
217 + }
211 }) 218 })
212 .doOnError(error -> { 219 .doOnError(error -> {
213 }) 220 })
......