Panagiotis Triantafyllou

redesign supermarket part2

......@@ -461,15 +461,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
String badgeValueFirst = String.format("%.02f", WarplyManagerHelper.getDealsCouponsSum());
mTvDealsValue.setText(String.format(getString(R.string.cos_value), badgeValueFirst));
SpannableStringBuilder sBuilder = new SpannableStringBuilder();
sBuilder
.append(getString(R.string.cos_wallet_text1))
.append(String.format(getString(R.string.cos_value), String.valueOf(WarplyManagerHelper.getDealsCouponsSum())))
.append(getString(R.string.cos_wallet_text2));
CalligraphyTypefaceSpan typefaceRegularSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
CalligraphyTypefaceSpan typefaceBoldSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilder.setSpan(typefaceRegularSpan, 0, getString(R.string.cos_wallet_text1).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilder.setSpan(typefaceRegularSpan, getString(R.string.cos_wallet_text1).length() + String.valueOf(WarplyManagerHelper.getDealsCouponsSum()).length(), getString(R.string.cos_wallet_text1).length() + String.valueOf(WarplyManagerHelper.getDealsCouponsSum()).length() + getString(R.string.cos_wallet_text2).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilder.setSpan(typefaceBoldSpan, getString(R.string.cos_wallet_text1).length(), getString(R.string.cos_wallet_text1).length() + String.valueOf(WarplyManagerHelper.getDealsCouponsSum()).length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilder.append(String.format(getString(R.string.cos_deals_win_title_cos), badgeValueFirst));
CalligraphyTypefaceSpan typefaceBoldSpanFirst = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilder.setSpan(typefaceBoldSpanFirst, 15, 16 + badgeValueFirst.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvDealsValueAll.setText(sBuilder, TextView.BufferType.SPANNABLE);
mFavValue += WarplyManagerHelper.getDealsCouponsSum();
......@@ -478,22 +472,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
String badgeValue = String.format("%.02f", WarplyManagerHelper.getLoyaltyBadge().getValue());
mTvGiftsValue.setText(String.format(getString(R.string.cos_value), badgeValue));
SpannableStringBuilder sBuilderSecond = new SpannableStringBuilder();
sBuilderSecond
.append(getString(R.string.cos_wallet_text3))
.append(String.format(getString(R.string.cos_value), badgeValue))
.append(getString(R.string.cos_wallet_text4))
.append(String.format(getString(R.string.cos_value2), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount())))
.append(getString(R.string.cos_wallet_text5));
CalligraphyTypefaceSpan typefaceRegularSpanSecond = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
CalligraphyTypefaceSpan typefaceRegularSpan2 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
CalligraphyTypefaceSpan typefaceRegularSpan3 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
sBuilderSecond.append(String.format(getString(R.string.cos_deals_win_title), badgeValue));
CalligraphyTypefaceSpan typefaceBoldSpanSecond = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
CalligraphyTypefaceSpan typefaceBoldSpan2 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilderSecond.setSpan(typefaceRegularSpanSecond, 0, getString(R.string.cos_wallet_text3).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilderSecond.setSpan(typefaceBoldSpanSecond, getString(R.string.cos_wallet_text3).length(), getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilderSecond.setSpan(typefaceRegularSpan2, getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1, getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilderSecond.setSpan(typefaceBoldSpan2, getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length(), getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length() + String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilderSecond.setSpan(typefaceRegularSpan3, getString(R.string.cos_wallet_text3).length() + 1 + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length() + String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()).length(), getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1 + getString(R.string.cos_wallet_text4).length() + String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()).length() + getString(R.string.cos_wallet_text5).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilderSecond.setSpan(typefaceBoldSpanSecond, 15, 16 + badgeValue.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvGiftsValueAll.setText(sBuilderSecond, TextView.BufferType.SPANNABLE);
mFavValue += WarplyManagerHelper.getLoyaltyBadge().getValue();
}
......@@ -511,13 +492,13 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
}
mFavValue += countValue;
if (countValue > 0) {
String badgeValue = String.format("%.02f", countValue);
mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
} else {
String badgeValue = String.format("%.02f", 0.0f);
mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
}
String badgeValue = String.format("%.02f", countValue);
mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
SpannableStringBuilder sBuilderThird = new SpannableStringBuilder();
sBuilderThird.append(String.format(getString(R.string.cos_supermarket_win), badgeValue));
CalligraphyTypefaceSpan typefaceBoldSpanThird = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilderThird.setSpan(typefaceBoldSpanThird, 15, 16 + badgeValue.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvMarketAll.setText(sBuilderThird, TextView.BufferType.SPANNABLE);
} else {
String badgeValue = String.format("%.02f", 0.0f);
mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
......@@ -526,6 +507,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
// Sum Expandable Banner
String allValue = String.format("%.02f", mFavValue);
mTvFavValue.setText(String.format(getString(R.string.cos_value), allValue));
SpannableStringBuilder sBuilderExp = new SpannableStringBuilder();
sBuilderExp.append(String.format(getString(R.string.cos_for_you_all), allValue));
CalligraphyTypefaceSpan typefaceBoldExp = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilderExp.setSpan(typefaceBoldExp, 26, 27 + allValue.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvFavValueAll.setText(sBuilderExp, TextView.BufferType.SPANNABLE);
mClExp.setVisibility(View.VISIBLE);
if (WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() > 0) {
String codes = "";
......@@ -613,14 +600,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
if (mLlMarketView.getVisibility() == View.GONE
&& WarplyManagerHelper.getDealsCouponsSum() == 0
&& (WarplyManagerHelper.getLoyaltyBadge() != null && WarplyManagerHelper.getLoyaltyBadge().getCouponCount() == 0)
&& mLlDeals.getVisibility() == View.GONE) {
&& countValue == 0) {
mIvExpArrow.setVisibility(View.GONE);
// mLlEmptyWallet.setVisibility(View.VISIBLE);
mIsStayCollapsed = true;
} else {
mIvExpArrow.setVisibility(View.VISIBLE);
mIsStayCollapsed = false;
} //TODO: change the case
}
mIvBack.setOnClickListener(this);
mLlQuestionnaire.setOnClickListener(this);
......
......@@ -3,13 +3,13 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
android:background="@color/white">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_loyalty_wallet_header"
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="@android:color/white">
android:background="@color/white">
<ImageView
android:id="@+id/iv_coupon_info_back"
......@@ -119,7 +119,7 @@
android:gravity="center"
android:textColor="@color/cos_light_black"
android:textIsSelectable="true"
android:textSize="25dp"
android:textSize="25sp"
tools:text="1A2C378" />
<LinearLayout
......@@ -208,6 +208,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="24dp"
android:textSize="16sp"
android:textColor="@color/cos_gray"
tools:text="@string/cos_coupon_date" />
......@@ -289,7 +290,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="32dp"
android:layout_marginTop="24dp"
android:gravity="center">
<LinearLayout
......@@ -326,11 +327,11 @@
android:layout_below="@+id/ll_terms_inner"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="16dp"
android:textSize="16sp"
android:textColor="@color/cos_gray"
android:textSize="16sp"
android:visibility="gone"
tools:text="@string/cos_coupon_date"
tools:visibility="visible"/>
tools:visibility="visible" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
......
......@@ -141,7 +141,9 @@
android:layout_marginTop="24dp"
android:background="@drawable/shape_cos_white_border"
android:paddingHorizontal="14dp"
android:paddingVertical="14dp">
android:paddingVertical="14dp"
android:visibility="gone"
tools:visibility="visible">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_horizontal_64_exp"
......
......@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cl_custom_layout"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_height="150dp"
android:layout_marginHorizontal="4dp"
android:layout_marginVertical="4dp"
android:background="@drawable/ic_coupon_background">
......
......@@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_height="150dp"
android:layout_marginHorizontal="4dp"
android:layout_marginVertical="4dp"
android:background="@drawable/ic_coupon_background_new2">
......