From 1d06f6cc21ad437d62de33af8af3c1ad58cccec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=97=D0=B0=D1=86=D0=B5=D0=BF=D0=B8=D0=BD?= Date: Wed, 10 Jul 2019 13:56:21 +0300 Subject: [PATCH] [android] Changed yearly saving calculation for bookmarks subscription --- .../maps/purchase/BookmarkSubscriptionFragment.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/android/src/com/mapswithme/maps/purchase/BookmarkSubscriptionFragment.java b/android/src/com/mapswithme/maps/purchase/BookmarkSubscriptionFragment.java index 0e74c0b43c..d17eaa5a30 100644 --- a/android/src/com/mapswithme/maps/purchase/BookmarkSubscriptionFragment.java +++ b/android/src/com/mapswithme/maps/purchase/BookmarkSubscriptionFragment.java @@ -202,8 +202,7 @@ public class BookmarkSubscriptionFragment extends BaseMwmFragment TextView priceView = getViewOrThrow().findViewById(R.id.annual_price); priceView.setText(price); TextView savingView = getViewOrThrow().findViewById(R.id.sale); - String saving = Utils.formatCurrencyString(calculateYearlySaving(), details.getCurrencyCode()); - savingView.setText(getString(R.string.annual_save_component, saving)); + savingView.setText(getString(R.string.annual_save_component, calculateYearlySaving())); } private void updateMonthlyButton() @@ -214,11 +213,11 @@ public class BookmarkSubscriptionFragment extends BaseMwmFragment priceView.setText(price); } - private float calculateYearlySaving() + private int calculateYearlySaving() { float pricePerMonth = getProductDetailsForPeriod(PurchaseUtils.Period.P1M).getPrice(); float pricePerYear = getProductDetailsForPeriod(PurchaseUtils.Period.P1Y).getPrice(); - return pricePerMonth * PurchaseUtils.MONTHS_IN_YEAR - pricePerYear; + return (int) (100 * (1 - pricePerYear / (pricePerMonth * PurchaseUtils.MONTHS_IN_YEAR))); } @NonNull