Panagiotis Triantafyllou

redesign supermarket part2

...@@ -461,15 +461,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -461,15 +461,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
461 String badgeValueFirst = String.format("%.02f", WarplyManagerHelper.getDealsCouponsSum()); 461 String badgeValueFirst = String.format("%.02f", WarplyManagerHelper.getDealsCouponsSum());
462 mTvDealsValue.setText(String.format(getString(R.string.cos_value), badgeValueFirst)); 462 mTvDealsValue.setText(String.format(getString(R.string.cos_value), badgeValueFirst));
463 SpannableStringBuilder sBuilder = new SpannableStringBuilder(); 463 SpannableStringBuilder sBuilder = new SpannableStringBuilder();
464 - sBuilder 464 + sBuilder.append(String.format(getString(R.string.cos_deals_win_title_cos), badgeValueFirst));
465 - .append(getString(R.string.cos_wallet_text1)) 465 + CalligraphyTypefaceSpan typefaceBoldSpanFirst = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
466 - .append(String.format(getString(R.string.cos_value), String.valueOf(WarplyManagerHelper.getDealsCouponsSum()))) 466 + sBuilder.setSpan(typefaceBoldSpanFirst, 15, 16 + badgeValueFirst.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
467 - .append(getString(R.string.cos_wallet_text2));
468 - CalligraphyTypefaceSpan typefaceRegularSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
469 - CalligraphyTypefaceSpan typefaceBoldSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
470 - sBuilder.setSpan(typefaceRegularSpan, 0, getString(R.string.cos_wallet_text1).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
471 - 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);
472 - 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);
473 mTvDealsValueAll.setText(sBuilder, TextView.BufferType.SPANNABLE); 467 mTvDealsValueAll.setText(sBuilder, TextView.BufferType.SPANNABLE);
474 mFavValue += WarplyManagerHelper.getDealsCouponsSum(); 468 mFavValue += WarplyManagerHelper.getDealsCouponsSum();
475 469
...@@ -478,22 +472,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -478,22 +472,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
478 String badgeValue = String.format("%.02f", WarplyManagerHelper.getLoyaltyBadge().getValue()); 472 String badgeValue = String.format("%.02f", WarplyManagerHelper.getLoyaltyBadge().getValue());
479 mTvGiftsValue.setText(String.format(getString(R.string.cos_value), badgeValue)); 473 mTvGiftsValue.setText(String.format(getString(R.string.cos_value), badgeValue));
480 SpannableStringBuilder sBuilderSecond = new SpannableStringBuilder(); 474 SpannableStringBuilder sBuilderSecond = new SpannableStringBuilder();
481 - sBuilderSecond 475 + sBuilderSecond.append(String.format(getString(R.string.cos_deals_win_title), badgeValue));
482 - .append(getString(R.string.cos_wallet_text3))
483 - .append(String.format(getString(R.string.cos_value), badgeValue))
484 - .append(getString(R.string.cos_wallet_text4))
485 - .append(String.format(getString(R.string.cos_value2), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount())))
486 - .append(getString(R.string.cos_wallet_text5));
487 - CalligraphyTypefaceSpan typefaceRegularSpanSecond = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
488 - CalligraphyTypefaceSpan typefaceRegularSpan2 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
489 - CalligraphyTypefaceSpan typefaceRegularSpan3 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
490 CalligraphyTypefaceSpan typefaceBoldSpanSecond = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf")); 476 CalligraphyTypefaceSpan typefaceBoldSpanSecond = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
491 - CalligraphyTypefaceSpan typefaceBoldSpan2 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf")); 477 + sBuilderSecond.setSpan(typefaceBoldSpanSecond, 15, 16 + badgeValue.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
492 - sBuilderSecond.setSpan(typefaceRegularSpanSecond, 0, getString(R.string.cos_wallet_text3).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
493 - sBuilderSecond.setSpan(typefaceBoldSpanSecond, getString(R.string.cos_wallet_text3).length(), getString(R.string.cos_wallet_text3).length() + badgeValue.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
494 - 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);
495 - 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);
496 - 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);
497 mTvGiftsValueAll.setText(sBuilderSecond, TextView.BufferType.SPANNABLE); 478 mTvGiftsValueAll.setText(sBuilderSecond, TextView.BufferType.SPANNABLE);
498 mFavValue += WarplyManagerHelper.getLoyaltyBadge().getValue(); 479 mFavValue += WarplyManagerHelper.getLoyaltyBadge().getValue();
499 } 480 }
...@@ -511,13 +492,13 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -511,13 +492,13 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
511 } 492 }
512 } 493 }
513 mFavValue += countValue; 494 mFavValue += countValue;
514 - if (countValue > 0) {
515 String badgeValue = String.format("%.02f", countValue); 495 String badgeValue = String.format("%.02f", countValue);
516 mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue)); 496 mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
517 - } else { 497 + SpannableStringBuilder sBuilderThird = new SpannableStringBuilder();
518 - String badgeValue = String.format("%.02f", 0.0f); 498 + sBuilderThird.append(String.format(getString(R.string.cos_supermarket_win), badgeValue));
519 - mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue)); 499 + CalligraphyTypefaceSpan typefaceBoldSpanThird = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
520 - } 500 + sBuilderThird.setSpan(typefaceBoldSpanThird, 15, 16 + badgeValue.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
501 + mTvMarketAll.setText(sBuilderThird, TextView.BufferType.SPANNABLE);
521 } else { 502 } else {
522 String badgeValue = String.format("%.02f", 0.0f); 503 String badgeValue = String.format("%.02f", 0.0f);
523 mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue)); 504 mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
...@@ -526,6 +507,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -526,6 +507,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
526 // Sum Expandable Banner 507 // Sum Expandable Banner
527 String allValue = String.format("%.02f", mFavValue); 508 String allValue = String.format("%.02f", mFavValue);
528 mTvFavValue.setText(String.format(getString(R.string.cos_value), allValue)); 509 mTvFavValue.setText(String.format(getString(R.string.cos_value), allValue));
510 + SpannableStringBuilder sBuilderExp = new SpannableStringBuilder();
511 + sBuilderExp.append(String.format(getString(R.string.cos_for_you_all), allValue));
512 + CalligraphyTypefaceSpan typefaceBoldExp = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
513 + sBuilderExp.setSpan(typefaceBoldExp, 26, 27 + allValue.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
514 + mTvFavValueAll.setText(sBuilderExp, TextView.BufferType.SPANNABLE);
515 + mClExp.setVisibility(View.VISIBLE);
529 516
530 if (WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() > 0) { 517 if (WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() > 0) {
531 String codes = ""; 518 String codes = "";
...@@ -613,14 +600,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -613,14 +600,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
613 if (mLlMarketView.getVisibility() == View.GONE 600 if (mLlMarketView.getVisibility() == View.GONE
614 && WarplyManagerHelper.getDealsCouponsSum() == 0 601 && WarplyManagerHelper.getDealsCouponsSum() == 0
615 && (WarplyManagerHelper.getLoyaltyBadge() != null && WarplyManagerHelper.getLoyaltyBadge().getCouponCount() == 0) 602 && (WarplyManagerHelper.getLoyaltyBadge() != null && WarplyManagerHelper.getLoyaltyBadge().getCouponCount() == 0)
616 - && mLlDeals.getVisibility() == View.GONE) { 603 + && countValue == 0) {
617 mIvExpArrow.setVisibility(View.GONE); 604 mIvExpArrow.setVisibility(View.GONE);
618 // mLlEmptyWallet.setVisibility(View.VISIBLE); 605 // mLlEmptyWallet.setVisibility(View.VISIBLE);
619 mIsStayCollapsed = true; 606 mIsStayCollapsed = true;
620 } else { 607 } else {
621 mIvExpArrow.setVisibility(View.VISIBLE); 608 mIvExpArrow.setVisibility(View.VISIBLE);
622 mIsStayCollapsed = false; 609 mIsStayCollapsed = false;
623 - } //TODO: change the case 610 + }
624 611
625 mIvBack.setOnClickListener(this); 612 mIvBack.setOnClickListener(this);
626 mLlQuestionnaire.setOnClickListener(this); 613 mLlQuestionnaire.setOnClickListener(this);
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
3 xmlns:tools="http://schemas.android.com/tools" 3 xmlns:tools="http://schemas.android.com/tools"
4 android:layout_width="match_parent" 4 android:layout_width="match_parent"
5 android:layout_height="match_parent" 5 android:layout_height="match_parent"
6 - android:background="@android:color/white"> 6 + android:background="@color/white">
7 7
8 <androidx.constraintlayout.widget.ConstraintLayout 8 <androidx.constraintlayout.widget.ConstraintLayout
9 android:id="@+id/cl_loyalty_wallet_header" 9 android:id="@+id/cl_loyalty_wallet_header"
10 android:layout_width="match_parent" 10 android:layout_width="match_parent"
11 android:layout_height="64dp" 11 android:layout_height="64dp"
12 - android:background="@android:color/white"> 12 + android:background="@color/white">
13 13
14 <ImageView 14 <ImageView
15 android:id="@+id/iv_coupon_info_back" 15 android:id="@+id/iv_coupon_info_back"
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
119 android:gravity="center" 119 android:gravity="center"
120 android:textColor="@color/cos_light_black" 120 android:textColor="@color/cos_light_black"
121 android:textIsSelectable="true" 121 android:textIsSelectable="true"
122 - android:textSize="25dp" 122 + android:textSize="25sp"
123 tools:text="1A2C378" /> 123 tools:text="1A2C378" />
124 124
125 <LinearLayout 125 <LinearLayout
...@@ -208,6 +208,7 @@ ...@@ -208,6 +208,7 @@
208 android:layout_height="wrap_content" 208 android:layout_height="wrap_content"
209 android:layout_gravity="center" 209 android:layout_gravity="center"
210 android:layout_marginTop="24dp" 210 android:layout_marginTop="24dp"
211 + android:textSize="16sp"
211 android:textColor="@color/cos_gray" 212 android:textColor="@color/cos_gray"
212 tools:text="@string/cos_coupon_date" /> 213 tools:text="@string/cos_coupon_date" />
213 214
...@@ -289,7 +290,7 @@ ...@@ -289,7 +290,7 @@
289 android:layout_width="wrap_content" 290 android:layout_width="wrap_content"
290 android:layout_height="wrap_content" 291 android:layout_height="wrap_content"
291 android:layout_gravity="center" 292 android:layout_gravity="center"
292 - android:layout_marginTop="32dp" 293 + android:layout_marginTop="24dp"
293 android:gravity="center"> 294 android:gravity="center">
294 295
295 <LinearLayout 296 <LinearLayout
...@@ -326,11 +327,11 @@ ...@@ -326,11 +327,11 @@
326 android:layout_below="@+id/ll_terms_inner" 327 android:layout_below="@+id/ll_terms_inner"
327 android:layout_marginHorizontal="32dp" 328 android:layout_marginHorizontal="32dp"
328 android:layout_marginTop="16dp" 329 android:layout_marginTop="16dp"
329 - android:textSize="16sp"
330 android:textColor="@color/cos_gray" 330 android:textColor="@color/cos_gray"
331 + android:textSize="16sp"
331 android:visibility="gone" 332 android:visibility="gone"
332 tools:text="@string/cos_coupon_date" 333 tools:text="@string/cos_coupon_date"
333 - tools:visibility="visible"/> 334 + tools:visibility="visible" />
334 </RelativeLayout> 335 </RelativeLayout>
335 </LinearLayout> 336 </LinearLayout>
336 </ScrollView> 337 </ScrollView>
......
...@@ -141,7 +141,9 @@ ...@@ -141,7 +141,9 @@
141 android:layout_marginTop="24dp" 141 android:layout_marginTop="24dp"
142 android:background="@drawable/shape_cos_white_border" 142 android:background="@drawable/shape_cos_white_border"
143 android:paddingHorizontal="14dp" 143 android:paddingHorizontal="14dp"
144 - android:paddingVertical="14dp"> 144 + android:paddingVertical="14dp"
145 + android:visibility="gone"
146 + tools:visibility="visible">
145 147
146 <androidx.constraintlayout.widget.Guideline 148 <androidx.constraintlayout.widget.Guideline
147 android:id="@+id/gl_horizontal_64_exp" 149 android:id="@+id/gl_horizontal_64_exp"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
4 xmlns:tools="http://schemas.android.com/tools" 4 xmlns:tools="http://schemas.android.com/tools"
5 android:id="@+id/cl_custom_layout" 5 android:id="@+id/cl_custom_layout"
6 android:layout_width="match_parent" 6 android:layout_width="match_parent"
7 - android:layout_height="130dp" 7 + android:layout_height="150dp"
8 android:layout_marginHorizontal="4dp" 8 android:layout_marginHorizontal="4dp"
9 android:layout_marginVertical="4dp" 9 android:layout_marginVertical="4dp"
10 android:background="@drawable/ic_coupon_background"> 10 android:background="@drawable/ic_coupon_background">
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
3 xmlns:app="http://schemas.android.com/apk/res-auto" 3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 xmlns:tools="http://schemas.android.com/tools" 4 xmlns:tools="http://schemas.android.com/tools"
5 android:layout_width="match_parent" 5 android:layout_width="match_parent"
6 - android:layout_height="130dp" 6 + android:layout_height="150dp"
7 android:layout_marginHorizontal="4dp" 7 android:layout_marginHorizontal="4dp"
8 android:layout_marginVertical="4dp" 8 android:layout_marginVertical="4dp"
9 android:background="@drawable/ic_coupon_background_new2"> 9 android:background="@drawable/ic_coupon_background_new2">
......