Panagiotis Triantafyllou

multiple click fixes

......@@ -58,7 +58,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms, mLlWebsite;
private Coupon mCoupon;
private Couponset mCouponset;
private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false;
private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false,
mShopsPressed = false, mGiftPressed = false, mEshopPressed = false;
private Merchant mMerchant;
// ===========================================================
......@@ -99,6 +100,9 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
public void onResume() {
super.onResume();
WarplyAnalyticsManager.logTrackersEvent(this, "screen", "CouponScreen");
mShopsPressed = false;
mGiftPressed = false;
mEshopPressed = false;
}
@Override
......@@ -119,6 +123,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
return;
}
if (view.getId() == R.id.ll_gift_it) {
if (!mGiftPressed) {
mGiftPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("ShareCoupon")
.concat(":")
.concat(mCoupon.getName()));
......@@ -130,9 +136,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
startActivity(intent);
else
startActivityForResult(intent, 1001);
}
return;
}
if (view.getId() == R.id.ll_shops) {
if (!mShopsPressed) {
mShopsPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShops");
if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(CouponInfoActivity.this) == ConnectionResult.SUCCESS) {
......@@ -147,7 +156,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
return;
}
}
}
if (view.getId() == R.id.ll_website) {
if (!mEshopPressed) {
mEshopPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShopWebsite");
if (!TextUtils.isEmpty(mMerchant.getWebsite())) {
......@@ -155,6 +167,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
intent.setData(Uri.parse(mMerchant.getWebsite()));
startActivity(intent);
}
}
return;
}
if (view.getId() == R.id.ll_show_barcode) {
......
......@@ -100,7 +100,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
private ExpandableLayout mElGifts;
private boolean mIsStayCollapsed = true;
private CardView mClExp;
private boolean mDfyPressed = false, mDealsBannerPressed = false;
private boolean mDfyPressed = false, mDealsBannerPressed = false, mQuestionnairePressed = false,
mHistoryPressed = false, mHistoryMarketPressed = false, mUnifiedPressed = false,
mCouponPressed = false;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -206,6 +208,11 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
});
mDfyPressed = false;
mDealsBannerPressed = false;
mQuestionnairePressed = false;
mHistoryPressed = false;
mHistoryMarketPressed = false;
mUnifiedPressed = false;
mCouponPressed = false;
}
@Override
......@@ -229,15 +236,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
return;
}
if (view.getId() == R.id.ll_user_questionnaire || view.getId() == R.id.ll_user_badge) {
if (!mQuestionnairePressed) {
mQuestionnairePressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
.concat("Questionnaire"));
startActivityForResult(WarpViewActivity.createIntentFromURL(LoyaltyWallet.this, WarplyManagerHelper.openQuestionnaire()), 1000);
}
return;
}
if (view.getId() == R.id.cl_deals_win_inner_cos) {
if(!mDealsBannerPressed) {
if (!mDealsBannerPressed) {
mDealsBannerPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
......@@ -256,6 +266,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
return;
}
if (view.getId() == R.id.cl_deals_win_inner) {
if (!mHistoryPressed) {
mHistoryPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
.concat("LoyaltyBanner"));
......@@ -267,6 +279,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
Intent intent = new Intent(LoyaltyWallet.this, LoyaltyAnalysisActivity.class);
startActivity(intent);
}
return;
}
if (view.getId() == R.id.cl_exp) {
......@@ -282,6 +295,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
if (view.getId() == R.id.cl_market_inner) {
// if (countValue > 0) {
if (!mHistoryMarketPressed) {
mHistoryMarketPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
.concat("MarketBanner"));
......@@ -291,6 +306,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent intent = new Intent(LoyaltyWallet.this, LoyaltyMarketAnalysisActivity.class);
startActivity(intent);
}
// }
return;
}
......@@ -340,6 +356,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
@Subscribe()
public void onMessageEvent(WarplyEventBusManager event) {
if (event.getCouponsAdded() != null) {
mCouponPressed = false;
CouponList tempCouponList = new CouponList();
CouponList cpnlist = new CouponList();
tempCouponList.clear();
......@@ -367,11 +384,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mRecyclerCoupons.setAdapter(mAdapterCoupons);
mAdapterCoupons.getPositionClicks()
.doOnNext(coupon -> {
if (!mCouponPressed) {
mCouponPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName()));
Intent intent = new Intent(LoyaltyWallet.this, CouponInfoActivity.class);
intent.putExtra("coupon", (Serializable) coupon);
intent.putExtra("isFromWallet", true);
startActivityForResult(intent, 1002);
}
})
.doOnError(error -> {
})
......@@ -418,11 +438,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mRvMarketCoupons.setAdapter(mAdapterMarketCoupons);
mAdapterMarketCoupons.getPositionClicks()
.doOnNext(coupon -> {
if (!mUnifiedPressed) {
mUnifiedPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("UnifiedCoupon").concat(":").concat(coupon.getBarcode()));
Intent intent = new Intent(LoyaltyWallet.this, UnifiedCouponInfoActivity.class);
intent.putExtra("coupon", (Serializable) coupon);
intent.putExtra("isFromWallet", true);
startActivity(intent);
}
// startActivityForResult(intent, 1002);
})
.doOnError(error -> {
......@@ -455,11 +478,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mRecyclerCoupons.setAdapter(mAdapterCoupons);
mAdapterCoupons.getPositionClicks()
.doOnNext(coupon -> {
if (!mCouponPressed) {
mCouponPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName()));
Intent intent = new Intent(LoyaltyWallet.this, CouponInfoActivity.class);
intent.putExtra("coupon", (Serializable) coupon);
intent.putExtra("isFromWallet", true);
startActivityForResult(intent, 1002);
}
})
.doOnError(error -> {
})
......
......@@ -53,7 +53,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
private LinearLayout mLlShops, mLlBarcodeContainer, mLlTerms, mLlMarketCoupons, mLlMarketExpand;
private UnifiedCoupon mCoupon;
private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false,
mIsMarketExpand = true;
mIsMarketExpand = true, mShopsPressed = false, mCouponPressed = false;
private RecyclerView mRecyclerCoupons;
private ActiveCouponAdapter mAdapterCoupons;
......@@ -102,6 +102,8 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
public void onResume() {
super.onResume();
WarplyAnalyticsManager.logTrackersEvent(this, "screen", "UnifiedCouponScreen");
mShopsPressed = false;
mCouponPressed = false;
}
@Override
......@@ -111,8 +113,9 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
return;
}
if (view.getId() == R.id.ll_shops) {
if (!mShopsPressed) {
mShopsPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShops");
if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(UnifiedCouponInfoActivity.this) == ConnectionResult.SUCCESS) {
Intent intent = new Intent(UnifiedCouponInfoActivity.this, ShopsActivity.class);
startActivity(intent);
......@@ -123,6 +126,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
return;
}
}
}
if (view.getId() == R.id.ll_terms_inner) {
if (mIsTermsShown) {
mTvTermsValue.setVisibility(View.GONE);
......@@ -203,11 +207,14 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
mRecyclerCoupons.setAdapter(mAdapterCoupons);
mAdapterCoupons.getPositionClicks()
.doOnNext(coupon -> {
if (!mCouponPressed) {
mCouponPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("MarketCoupon").concat(":").concat(coupon.getName()));
Intent intent = new Intent(UnifiedCouponInfoActivity.this, CouponInfoActivity.class);
intent.putExtra("coupon", (Serializable) coupon);
intent.putExtra("isFromWallet", true);
startActivity(intent);
}
})
.doOnError(error -> {
})
......