Panagiotis Triantafyllou

vouchers part3

......@@ -82,7 +82,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
private ConstraintLayout mClDealsBanner, mClDealsView,
mClGiftsBanner, mClToolbar, mClMarket;
private LinearLayout mLlQuestionnaire, mLlUserBadge, mLlEmptyWallet, mLlDeals, mLlGifts,
mLlMarketView, mLlHistory, mLlBannerInfo, mLlVouchers;
mLlMarketView, mLlHistory, mLlBannerInfo, mLlVouchers, mLlVouchersSpinner;
private FlowLayout mLlActiveCodesView;
private float couponDfyValue = 0.0f, mFavValue = 0.0f;
private RecyclerView mRecyclerCoupons, mRvMarketCoupons;
......@@ -162,6 +162,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mRecyclerCoupons = findViewById(R.id.rv_active_coupons);
mCvVouchers = findViewById(R.id.cv_vouchers);
mLlVouchers = findViewById(R.id.ll_vouchers);
mLlVouchersSpinner = findViewById(R.id.ll_vouchers_spinner);
/** Deals Badge */
// if (WarplyManagerHelper.getActiveDFYCoupons() != null) {
......@@ -254,7 +255,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
return;
}
if (view.getId() == R.id.cl_deals_win_inner_cos || view.getId() == R.id.rv_deals_count) {
/** Deals History */
if (view.getId() == R.id.cl_deals_win_inner_cos) {
if (!mDealsBannerPressed) {
mDealsBannerPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
......@@ -272,15 +274,21 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
return;
}
/** Active Unified Banner */
if (view.getId() == R.id.rv_sm_count) {
if (!mUnifiedCountPressed) {
mUnifiedCountPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
.concat("SMDealsBanner"));
.concat("ActiveMarketBanner"));
// LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
// analyticsEvent.setEventName("did_tap_sm_deals_badge");
// analyticsEvent.setParameter("screen", "Loyalty Wallet");
// EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_sm_deals_badge");
analyticsEvent.setEventName("did_tap_market_active_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
......@@ -289,15 +297,21 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
return;
}
/** Active Coupons Banner */
if (view.getId() == R.id.rv_gifts_count) {
if (!mGiftsCountPressed) {
mGiftsCountPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
.concat("GFYBanner"));
.concat("ActiveLoyaltyBanner"));
// LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
// analyticsEvent.setEventName("did_tap_gifts_badge");
// analyticsEvent.setParameter("screen", "Loyalty Wallet");
// EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_gifts_badge");
analyticsEvent.setEventName("did_tap_gifts_for_you_active_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
......@@ -306,6 +320,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
return;
}
/** Coupons History */
if (view.getId() == R.id.cl_deals_win_inner) {
if (!mHistoryPressed) {
mHistoryPressed = true;
......@@ -334,23 +349,25 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
return;
}
/** Unified History */
if (view.getId() == R.id.cl_market_inner) {
// if (countValue > 0) {
if (!mHistoryMarketPressed) {
mHistoryMarketPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
.concat("MarketBanner"));
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_market_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent intent = new Intent(LoyaltyWallet.this, LoyaltyMarketAnalysisActivity.class);
startActivity(intent);
}
// }
return;
}
/** New History */
if (view.getId() == R.id.ll_loyalty_history) {
if (!mHistoryBadgePressed) {
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
......@@ -361,9 +378,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
analyticsEvent.setEventName("did_tap_history_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
//TODO: add new history intent
}
return;
}
/** Vouchers Client's Screen */
if (view.getId() == R.id.cv_vouchers) {
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
......@@ -378,13 +398,19 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
EventBus.getDefault().post(new WarplyEventBusManager(vouchersActivity));
return;
}
if (view.getId() == R.id.cl_mygifts) {
/** Active Deals Banner */
if (view.getId() == R.id.cl_mygifts || view.getId() == R.id.rv_deals_count) {
if (!mDfyPressed) {
mDfyPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
.concat("ActiveDealsBanner"));
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_deals_for_you_active_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
ActiveDFYCouponEventModel activeCouponEventModel = new ActiveDFYCouponEventModel();
activeCouponEventModel.setPressed(true);
EventBus.getDefault().post(new WarplyEventBusManager(activeCouponEventModel));
......@@ -425,13 +451,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
public void onMessageEvent(WarplyEventBusManager event) {
if (event.getVouchersFetched() != null) {
if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
//TODO: hide spinner
runOnUiThread(() -> {
mLlVouchersSpinner.setVisibility(View.GONE);
mLlVouchers.setVisibility(View.VISIBLE);
});
} else {
//.equals("false)
//TODO: hide spinner
runOnUiThread(() -> {
mLlVouchersSpinner.setVisibility(View.GONE);
});
}
return;
}
......@@ -968,10 +995,20 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
private void checkForEmpty() {
if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() == 0)
&& (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() == 0)
&& (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() == 0)
&& (TextUtils.isEmpty(WarplyManagerHelper.getShowVouchersBanner()))) {
mLlEmptyWallet.setVisibility(View.VISIBLE);
//TODO: check for spinner and show it
&& (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() == 0)) {
if (TextUtils.isEmpty(WarplyManagerHelper.getShowVouchersBanner())) {
mLlBannerInfo.setVisibility(View.VISIBLE);
mLlVouchersSpinner.setVisibility(View.VISIBLE);
} else if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
mLlBannerInfo.setVisibility(View.VISIBLE);
mLlVouchersSpinner.setVisibility(View.GONE);
mLlVouchers.setVisibility(View.VISIBLE);
} else if (WarplyManagerHelper.getShowVouchersBanner().equals("false")) {
mLlBannerInfo.setVisibility(View.GONE);
mLlVouchersSpinner.setVisibility(View.GONE);
mLlVouchers.setVisibility(View.GONE);
mLlEmptyWallet.setVisibility(View.VISIBLE);
}
} else {
mLlEmptyWallet.setVisibility(View.GONE);
if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() > 0)
......@@ -979,8 +1016,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
|| (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0)) {
mLlBannerInfo.setVisibility(View.VISIBLE);
}
if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
if (TextUtils.isEmpty(WarplyManagerHelper.getShowVouchersBanner())) {
mLlVouchersSpinner.setVisibility(View.VISIBLE);
} else if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
mLlVouchersSpinner.setVisibility(View.GONE);
mLlVouchers.setVisibility(View.VISIBLE);
} else if (WarplyManagerHelper.getShowVouchersBanner().equals("false")) {
mLlVouchersSpinner.setVisibility(View.GONE);
mLlVouchers.setVisibility(View.GONE);
}
}
}
......
......@@ -467,6 +467,22 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/ll_vouchers_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:orientation="vertical"
android:gravity="center_horizontal"
android:visibility="gone"
tools:visibility="visible">
<ProgressBar
android:id="@+id/pb_vouchers"
android:layout_width="48dp"
android:layout_height="48dp"
android:theme="@style/progressBarGreen"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_vouchers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -68,4 +68,8 @@
<item name="cornerSizeBottomRight">0dp</item>
</style>
<style name="progressBarGreen" parent="@style/Theme.AppCompat">
<item name="colorAccent">@color/cos_green12</item>
</style>
</resources>
\ No newline at end of file
......