Add bg selector for vpn paywall
Add currency symbol Update colors for paywall
This commit is contained in:
@@ -36,6 +36,7 @@ import org.chromium.chrome.browser.vpn.utils.BraveVpnUtils;
|
||||
import org.chromium.ui.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Currency;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -517,7 +518,9 @@ public class InAppPurchaseWrapper {
|
||||
if (pricingPhase != null) {
|
||||
double price = ((double) pricingPhase.getPriceAmountMicros() / MICRO_UNITS);
|
||||
String priceString = String.format(Locale.getDefault(), "%.2f", price);
|
||||
return pricingPhase.getPriceCurrencyCode() + " " + priceString;
|
||||
String currencySymbol =
|
||||
Currency.getInstance(pricingPhase.getPriceCurrencyCode()).getSymbol();
|
||||
return currencySymbol + " " + priceString;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -527,7 +530,9 @@ public class InAppPurchaseWrapper {
|
||||
if (pricingPhase != null) {
|
||||
double yearlyPrice = ((double) pricingPhase.getPriceAmountMicros() / MICRO_UNITS) * 12;
|
||||
String priceString = String.format(Locale.getDefault(), "%.2f", yearlyPrice);
|
||||
return pricingPhase.getPriceCurrencyCode() + priceString;
|
||||
String currencySymbol =
|
||||
Currency.getInstance(pricingPhase.getPriceCurrencyCode()).getSymbol();
|
||||
return currencySymbol + " " + priceString;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -21,19 +21,15 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.android.billingclient.api.ProductDetails;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.billing.InAppPurchaseWrapper;
|
||||
import org.chromium.chrome.browser.billing.LinkSubscriptionUtils;
|
||||
import org.chromium.chrome.browser.util.LiveDataUtil;
|
||||
import org.chromium.chrome.browser.util.TabUtils;
|
||||
import org.chromium.chrome.browser.vpn.BraveVpnNativeWorker;
|
||||
import org.chromium.chrome.browser.vpn.adapters.BraveVpnPlanPagerAdapter;
|
||||
import org.chromium.chrome.browser.vpn.utils.BraveVpnUtils;
|
||||
import org.chromium.ui.text.SpanApplier;
|
||||
import org.chromium.ui.text.SpanApplier.SpanInfo;
|
||||
@@ -259,12 +255,12 @@ public class VpnPaywallActivity extends BraveVpnParentActivity {
|
||||
private void updateSelectedPlanView() {
|
||||
mYearlySelectorLayout.setBackgroundResource(
|
||||
mSelectedPlanType == SelectedPlanType.YEARLY
|
||||
? R.drawable.vpn_plan_selected_bg
|
||||
: R.drawable.vpn_plan_bg);
|
||||
? R.drawable.vpn_paywall_selected_bg
|
||||
: R.drawable.vpn_paywall_bg);
|
||||
mMonthlySelectorLayout.setBackgroundResource(
|
||||
mSelectedPlanType == SelectedPlanType.MONTHLY
|
||||
? R.drawable.vpn_plan_selected_bg
|
||||
: R.drawable.vpn_plan_bg);
|
||||
? R.drawable.vpn_paywall_selected_bg
|
||||
: R.drawable.vpn_paywall_bg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,11 +26,10 @@ import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.chrome.browser.BraveRewardsNativeWorker;
|
||||
import org.chromium.chrome.browser.vpn.BraveVpnNativeWorker;
|
||||
import org.chromium.chrome.browser.vpn.activities.BraveVpnPlansActivity;
|
||||
import org.chromium.chrome.browser.vpn.activities.VpnPaywallActivity;
|
||||
import org.chromium.chrome.browser.vpn.activities.BraveVpnProfileActivity;
|
||||
import org.chromium.chrome.browser.vpn.activities.BraveVpnSupportActivity;
|
||||
import org.chromium.chrome.browser.vpn.activities.VpnAlwaysOnActivity;
|
||||
import org.chromium.chrome.browser.vpn.activities.VpnPaywallActivity;
|
||||
import org.chromium.chrome.browser.vpn.activities.VpnServerSelectionActivity;
|
||||
import org.chromium.chrome.browser.vpn.fragments.BraveVpnAlwaysOnErrorDialogFragment;
|
||||
import org.chromium.chrome.browser.vpn.fragments.BraveVpnConfirmDialogFragment;
|
||||
|
||||
@@ -1,10 +1,22 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF62757E"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M11.91 3.62L5.5 6.47A0.23 0.23 0 0 0 5.36 6.7v4.3c0 4.28 2.88 8.23 6.65 9.35 3.77-1.12 6.65-5.07 6.65-9.34V6.69a0.23 0.23 0 0 0-0.14-0.22l-6.41-2.85a0.23 0.23 0 0 0-0.2 0Zm-0.65-1.46a1.83 1.83 0 0 1 1.5 0L19.16 5c0.67 0.3 1.1 0.95 1.1 1.68v4.3c0 5.1-3.53 9.86-8.26 11.01-4.73-1.16-8.25-5.91-8.25-11V6.69C3.76 5.96 4.18 5.3 4.85 5l6.41-2.85Zm1.06 12.83a0.83 0.83 0 0 1-1.2 0.14l-2.99-2.5a0.83 0.83 0 1 1 1.07-1.28l2.3 1.93L14.67 9a0.83 0.83 0 1 1 1.35 0.99l-3.69 5Z"/>
|
||||
</vector>
|
||||
android:pathData="M11.91 3.62L5.5 6.47A0.23 0.23 0 0 0 5.36 6.7v4.3c0 4.28 2.88 8.23 6.65 9.35 3.77-1.12 6.65-5.07 6.65-9.34V6.69a0.23 0.23 0 0 0-0.14-0.22l-6.41-2.85a0.23 0.23 0 0 0-0.2 0Zm-0.65-1.46a1.83 1.83 0 0 1 1.5 0L19.16 5c0.67 0.3 1.1 0.95 1.1 1.68v4.3c0 5.1-3.53 9.86-8.26 11.01-4.73-1.16-8.25-5.91-8.25-11V6.69C3.76 5.96 4.18 5.3 4.85 5l6.41-2.85Zm1.06 12.83a0.83 0.83 0 0 1-1.2 0.14l-2.99-2.5a0.83 0.83 0 1 1 1.07-1.28l2.3 1.93L14.67 9a0.83 0.83 0 1 1 1.35 0.99l-3.69 5Z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:startY="15.8337"
|
||||
android:startX="29.7384"
|
||||
android:endY="-4.08883"
|
||||
android:endX="7.78831"
|
||||
android:type="linear">
|
||||
<item android:offset="0" android:color="#FFBF14A2"/>
|
||||
<item android:offset="1" android:color="#FFF73A1C"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
</vector>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (c) 2023 The Brave Authors. All rights reserved.
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/primitive_blurple_20"/>
|
||||
<corners android:radius="12dp"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (c) 2023 The Brave Authors. All rights reserved.
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/primitive_blurple_35"/>
|
||||
<corners android:radius="12dp"/>
|
||||
<stroke android:width="2dp" android:color="@color/primitive_blurple_50"/>
|
||||
</shape>
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/brave_plan_bg"
|
||||
android:background="@color/primitive_blurple_25"
|
||||
android:orientation="vertical"
|
||||
tools:context=".BraveVpnPlansActivity">
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/BraveVpnToolbar"
|
||||
android:theme="@style/VpnPaywallToolbar"
|
||||
android:minHeight="?attr/actionBarSize"/>
|
||||
|
||||
<ScrollView
|
||||
@@ -35,6 +35,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/DefaultRegular"
|
||||
android:textAlignment="textStart"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textColor="@android:color/white"
|
||||
@@ -47,6 +48,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/DefaultRegular"
|
||||
android:textAlignment="textStart"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textColor="@android:color/white"
|
||||
@@ -59,6 +61,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/DefaultRegular"
|
||||
android:textAlignment="textStart"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textColor="@android:color/white"
|
||||
@@ -71,6 +74,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/DefaultRegular"
|
||||
android:textAlignment="textStart"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textColor="@android:color/white"
|
||||
@@ -83,6 +87,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/DefaultRegular"
|
||||
android:textAlignment="textStart"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textColor="@android:color/white"
|
||||
@@ -93,19 +98,20 @@
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:background="@color/primitive_primary_80"/>
|
||||
android:background="@color/primitive_blurple_35"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/DefaultRegular"
|
||||
android:drawablePadding="8dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:text="@string/powered_by"
|
||||
android:textColor="@android:color/white"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginBottom="12dp"
|
||||
app:drawableTint="@android:color/white"
|
||||
app:drawableRightCompat="@drawable/ic_guardian" />
|
||||
|
||||
@@ -116,9 +122,9 @@
|
||||
style="@style/DefaultRegular"
|
||||
android:text="@string/trial_text"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginBottom="@dimen/vpn_plan_margin" />
|
||||
android:textAlignment="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/yearly_selector_layout"
|
||||
@@ -126,9 +132,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:paddingVertical="@dimen/vpn_plan_section_margin"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:background="@drawable/vpn_plan_bg"
|
||||
android:padding="16dp"
|
||||
android:background="@drawable/vpn_paywall_bg"
|
||||
android:orientation="horizontal"
|
||||
android:baselineAligned="false">
|
||||
|
||||
@@ -143,13 +148,10 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/one_year"
|
||||
style="@style/LargeSemibold"
|
||||
android:drawablePadding="6dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_gravity="start"
|
||||
android:gravity="start"
|
||||
android:textAlignment="textStart"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:textSize="16sp"
|
||||
app:drawableEndCompat="@drawable/ic_discount" />
|
||||
|
||||
<TextView
|
||||
@@ -157,12 +159,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/renew_monthly_save"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_gravity="start"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/primitive_blurple_95"
|
||||
android:textAlignment="textStart"
|
||||
android:alpha="0.6"
|
||||
android:textSize="16sp"/>
|
||||
style="@style/DefaultRegular"/>
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
@@ -186,13 +185,11 @@
|
||||
<TextView
|
||||
android:id="@+id/yearly_subscription_amount_text"
|
||||
android:layout_width="wrap_content"
|
||||
style="@style/SmallRegular"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_gravity="start"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/primitive_blurple_95"
|
||||
android:textAlignment="textStart"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:textSize="16sp"/>
|
||||
android:layout_marginBottom="2dp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
@@ -200,12 +197,9 @@
|
||||
android:id="@+id/removed_value_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="end"
|
||||
android:textAlignment="textEnd"
|
||||
android:alpha="0.6"
|
||||
android:textSize="16sp"/>
|
||||
android:textColor="@color/primitive_blurple_95"
|
||||
style="@style/SmallRegular"
|
||||
android:textAlignment="textEnd"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -215,13 +209,11 @@
|
||||
android:id="@+id/monthly_selector_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:baselineAligned="false"
|
||||
android:paddingVertical="@dimen/vpn_plan_section_margin"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:background="@drawable/vpn_plan_bg"
|
||||
android:padding="16dp"
|
||||
android:background="@drawable/vpn_paywall_bg"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
@@ -237,22 +229,16 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/monthly_subscription"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_gravity="start"
|
||||
android:gravity="start"
|
||||
android:textAlignment="textStart"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:textSize="16sp"/>
|
||||
style="@style/LargeSemibold"
|
||||
android:textAlignment="textStart"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/renews_monthly"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_gravity="start"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/primitive_blurple_95"
|
||||
android:textAlignment="textStart"
|
||||
android:alpha="0.6"
|
||||
android:textSize="16sp"/>
|
||||
style="@style/DefaultRegular"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -272,11 +258,9 @@
|
||||
android:id="@+id/monthly_subscription_amount_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_gravity="start"
|
||||
android:gravity="start"
|
||||
android:textAlignment="textStart"
|
||||
android:textSize="16sp"/>
|
||||
style="@style/SmallRegular"
|
||||
android:textColor="@color/primitive_blurple_95"
|
||||
android:textAlignment="textEnd"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
@@ -291,13 +275,12 @@
|
||||
android:textColor="@color/primitive_primary_30"
|
||||
android:textAlignment="textStart"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"/>
|
||||
android:gravity="center"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/HeadingH4"
|
||||
style="@style/DefaultSemibold"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/already_purchased"
|
||||
@@ -308,7 +291,7 @@
|
||||
android:id="@+id/refresh_credentials_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/HeadingH4"
|
||||
style="@style/DefaultSemibold"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
@@ -325,7 +308,8 @@
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/primitive_primary_70"/>
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@color/primitive_blurple_35"/>
|
||||
|
||||
<android.widget.Button
|
||||
android:id="@+id/vpn_plan_action_button"
|
||||
|
||||
@@ -410,4 +410,10 @@
|
||||
|
||||
<color name="location_bar_background_color_for_ntp">#f2f2f2</color>
|
||||
<color name="toolbar_background_color_for_ntp">@android:color/white</color>
|
||||
|
||||
<color name="primitive_blurple_20">#251491</color>
|
||||
<color name="primitive_blurple_25">#2E19B0</color>
|
||||
<color name="primitive_blurple_35">#3e37d4</color>
|
||||
<color name="primitive_blurple_50">#6261ff</color>
|
||||
<color name="primitive_blurple_95">#efefff</color>
|
||||
</resources>
|
||||
|
||||
@@ -280,6 +280,13 @@
|
||||
<item name="android:textColorPrimary">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="VpnPaywallToolbar" parent="Theme.AppCompat.Light">
|
||||
<item name="colorControlNormal">@android:color/white</item>
|
||||
<item name="android:background">@color/primitive_blurple_25</item>
|
||||
<item name="titleTextColor">@android:color/white</item>
|
||||
<item name="android:textColorPrimary">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="BraveLeoToolbar" parent="Theme.AppCompat.Light">
|
||||
<item name="colorControlNormal">@android:color/white</item>
|
||||
<item name="android:background">@color/brave_leo_plans_bg</item>
|
||||
|
||||
Reference in New Issue
Block a user