Panagiotis Triantafyllou

box history tile added

......@@ -5,7 +5,6 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.view.View;
......@@ -23,8 +22,8 @@ import io.github.inflationx.calligraphy3.TypefaceUtils;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.WarplyBoxAnalysisEventModel;
import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
......@@ -45,11 +44,11 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
private int mTimer = 0;
private Handler mSecondsHandler;
private TextView mTvFavValue, mTvDealsValue, mTvGiftsValue, mTvMarketValue, mTvDealsValueAll,
mTvGiftsValueAll, mTvMarketAll;
mTvGiftsValueAll, mTvMarketAll, mTvBoxValue, mTvBoxValueAll;
private float mFavValue = 0.0f, countValue = 0.0f;
private RelativeLayout mRlDealsBanner, mRlGiftsBanner, mRlUnifiedBanner;
private RelativeLayout mRlDealsBanner, mRlGiftsBanner, mRlUnifiedBanner, mRlBoxBanner;
private boolean mDealsBannerPressed = false, mHistoryPressed = false,
mHistoryMarketPressed = false;
mHistoryMarketPressed = false, mBoxBannerPressed = false;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -64,12 +63,15 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
mIvBack = findViewById(R.id.iv_loyalty_history_close);
mTvFavValue = findViewById(R.id.tv_exp_value);
mTvDealsValue = findViewById(R.id.tv_deals_value);
mTvBoxValue = findViewById(R.id.tv_box_value);
mTvGiftsValue = findViewById(R.id.tv_gifts_value);
mTvMarketValue = findViewById(R.id.tv_market_value);
mTvDealsValueAll = findViewById(R.id.tv_deals_value_all);
mTvBoxValueAll = findViewById(R.id.tv_box_value_all);
mTvGiftsValueAll = findViewById(R.id.tv_gifts_value_all);
mTvMarketAll = findViewById(R.id.tv_market_value_all);
mRlDealsBanner = findViewById(R.id.rl_first_banner);
mRlBoxBanner = findViewById(R.id.rl_fourth_banner);
mRlGiftsBanner = findViewById(R.id.rl_third_banner);
mRlUnifiedBanner = findViewById(R.id.rl_second_banner);
......@@ -105,6 +107,7 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
mDealsBannerPressed = false;
mHistoryPressed = false;
mHistoryMarketPressed = false;
mBoxBannerPressed = false;
}
@Override
......@@ -187,6 +190,25 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
Intent intent = new Intent(LoyaltyHistoryActivity.this, LoyaltyMarketAnalysisActivity.class);
startActivity(intent);
}
return;
}
/** Box History */
if (view.getId() == R.id.rl_fourth_banner) {
if (!mBoxBannerPressed) {
mBoxBannerPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyHistoryScreen")
.concat(":")
.concat("BoxBanner"));
WarplyBoxAnalysisEventModel warplyBoxAnalysisEventModel = new WarplyBoxAnalysisEventModel();
warplyBoxAnalysisEventModel.setPressed(true);
EventBus.getDefault().post(new WarplyEventBusManager(warplyBoxAnalysisEventModel));
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_box_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
}
}
}
......@@ -204,6 +226,7 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
mRlDealsBanner.setOnClickListener(this);
mRlGiftsBanner.setOnClickListener(this);
mRlUnifiedBanner.setOnClickListener(this);
mRlBoxBanner.setOnClickListener(this);
/** First Banner */
String badgeValueFirst = String.format(Locale.GERMAN, "%.02f", WarplyManagerHelper.getDealsCouponsSum());
......@@ -282,6 +305,22 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
}
/** Third Banner */
/** Fourth Banner */
String badgeValueFourth = String.format(Locale.GERMAN, "%.02f", WarplyManagerHelper.getBoxCouponsSum());
mTvBoxValue.setText(String.format(getString(R.string.cos_value), badgeValueFourth));
if (String.valueOf(WarplyManagerHelper.getBoxCouponsSum()).length() >= 3) {
mTvBoxValue.setTextSize(12);
} else {
mTvBoxValue.setTextSize(14);
}
SpannableStringBuilder sBuilderFourth = new SpannableStringBuilder();
sBuilderFourth.append(String.format(getString(R.string.cos_box_win_title_cos), badgeValueFourth));
CalligraphyTypefaceSpan typefaceBoldSpanFourth = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilderFourth.setSpan(typefaceBoldSpanFourth, 24, 24 + badgeValueFourth.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvBoxValueAll.setText(sBuilderFourth, TextView.BufferType.SPANNABLE);
mFavValue += WarplyManagerHelper.getBoxCouponsSum();
/** Fourth Banner */
/** Sum Banner */
String allValue = String.format(Locale.GERMAN, "%.02f", mFavValue);
mTvFavValue.setText(String.format(getString(R.string.cos_value), allValue));
......
......@@ -312,22 +312,6 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener
return;
}
/** New History */
// if (view.getId() == R.id.ll_loyalty_history) {
// if (!mHistoryBadgePressed) {
// WarplyAnalyticsManager.logTrackersEvent(getContext(), "click", ("LoyaltyWalletScreen")
// .concat(":")
// .concat("LoyaltyHistoryBadge"));
//
// LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
// analyticsEvent.setEventName("did_tap_history_badge");
// analyticsEvent.setParameter("screen", "Loyalty Wallet");
// EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
//
// Intent intent = new Intent(getContext(), LoyaltyHistoryActivity.class);
// startActivity(intent);
// }
// return;
// }
if (view.getId() == R.id.iv_loyalty_history) {
if (!mHistoryBadgePressed) {
WarplyAnalyticsManager.logTrackersEvent(getContext(), "click", ("LoyaltyWalletScreen")
......
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
/**
* Created by Panagiotis Triantafyllou on 01-May-24.
*/
public class WarplyBoxAnalysisEventModel {
private boolean isPressed = false;
public WarplyBoxAnalysisEventModel() {
this.isPressed = false;
}
public boolean isPressed() {
return isPressed;
}
public void setPressed(boolean pressed) {
isPressed = pressed;
}
}
......@@ -119,7 +119,7 @@ public class WarplyManagerHelper {
mAlertDialogRejectSharing, mAlertDialogReturnSharing, mAlertDialogErrorSharing,
mAlertDialogErrorUsedSharing, mAlertDialogErrorExpiredSharing, mAlertDialogNoInternet;
private static LoyaltyBadgeModel mLoyaltyBadge = new LoyaltyBadgeModel();
private static float mDealsSum = 0.0f, mUnifiedDiscount = 0.0f;
private static float mDealsSum = 0.0f, mUnifiedDiscount = 0.0f, mBoxSum = 0.0f;
private static MerchantList mMerchantList = new MerchantList();
public static double mMetersWebview = 0.0d;
public static int mStepsWebview = 0;
......@@ -1408,6 +1408,14 @@ public class WarplyManagerHelper {
mDealsSum = sum;
}
public static float getBoxCouponsSum() {
return mBoxSum;
}
public static void setBoxCouponsSum(float sum) {
mBoxSum = sum;
}
public static ArrayList<UnifiedCoupon> getMarketCoupons() {
return mMarketCoupons;
}
......
......@@ -23,6 +23,7 @@ import ly.warp.sdk.io.models.UnifiedCouponsEventModel;
import ly.warp.sdk.io.models.VouchersActivityEventModel;
import ly.warp.sdk.io.models.VouchersFetchedEventModel;
import ly.warp.sdk.io.models.VouchersServiceUnavailableEventModel;
import ly.warp.sdk.io.models.WarplyBoxAnalysisEventModel;
import ly.warp.sdk.io.models.WarplyCCMSEnabledModel;
import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
......@@ -46,6 +47,7 @@ public class WarplyEventBusManager {
private WarplyPacingEventModel pacing;
private WarplyPacingCardServiceEnabledModel pacingService;
private WarplyDealsAnalysisEventModel dealsAnalysis;
WarplyBoxAnalysisEventModel boxAnalysis;
private WarplyCCMSEnabledModel ccmsActivated;
private LoyaltyGiftsForYouOfferClickEvent giftsYou;
private QuestionnaireEventModel questionnaire;
......@@ -189,6 +191,10 @@ public class WarplyEventBusManager {
this.dealsAnalysis = dealsAnalysis;
}
public WarplyEventBusManager(WarplyBoxAnalysisEventModel boxAnalysis) {
this.boxAnalysis = boxAnalysis;
}
public WarplyEventBusManager(VouchersServiceUnavailableEventModel serviceUnavailable) {
this.serviceUnavailable = serviceUnavailable;
}
......@@ -254,6 +260,9 @@ public class WarplyEventBusManager {
public WarplyDealsAnalysisEventModel getDealsAnalysis() {
return dealsAnalysis;
}
public WarplyBoxAnalysisEventModel getBoxAnalysis() {
return boxAnalysis;
}
public WarplyCCMSEnabledModel getCcmsActivated() {
return ccmsActivated;
......
......@@ -349,6 +349,87 @@
</LinearLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_fourth_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginHorizontal="16dp"
android:layout_below="@+id/rl_third_banner">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:translationZ="3dp">
<ImageView
android:id="@+id/iv_box_logo"
android:layout_width="76dp"
android:layout_height="76dp"
android:src="@drawable/ic_box_polygon" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_box_win_inner_cos"
android:layout_width="76dp"
android:layout_height="76dp">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_horizontal_50_box"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.68" />
<TextView
android:id="@+id/tv_box_value"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:textColor="@color/cos_light_black"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_50_box"
tools:text="18.00€" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
<androidx.cardview.widget.CardView
android:id="@+id/cv_box_win_inner_cos"
android:layout_width="match_parent"
android:layout_height="72dp"
android:layout_marginStart="48dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="2dp"
android:layout_marginBottom="2dp"
app:cardCornerRadius="16dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/tv_box_value_all"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="30dp"
android:layout_marginEnd="16dp"
android:includeFontPadding="false"
android:lineHeight="22dp"
android:text="@string/cos_box_win_title_cos"
android:textColor="@color/cos_light_black"
android:textSize="15sp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
......
......@@ -80,6 +80,7 @@
<string name="cos_popup_more_subtitle">Σε αυτή την ενότητα βρες έρευνες, παιχνίδια, διαγωνισμούς και επιβραβεύσεις για τις αθλητικές σου δραστηριότητες!</string>
<string name="cos_deals_win_title">Μέχρι τώρα έχεις όφελος %1$s€ από τα FREE COUPONS</string>
<string name="cos_deals_win_title_cos">Μέχρι τώρα έχεις όφελος %1$s€ από τα DEALS FOR YOU</string>
<string name="cos_box_win_title_cos">Μέχρι τώρα έχεις όφελος %1$s€ από το BOX</string>
<string name="cos_mygifts">Τα δώρα μου</string>
<string name="cos_gifts_banner_title">Δώρα:</string>
<string name="cos_see_more">Δες περισσότερα</string>
......