[Android] Migrate private NTP to Leo tokens and fix VPN icon visibility (#35905)
* [Android] Migrate private NTP to Leo tokens and fix VPN icon visibility - Drop Brave-local duplicates of ic_product_vpn / ic_antenna / ic_product_private_window so the private NTP renders the Leo (Nala) icons via resource_overlay; tint the inner icon layer to primitive_private_window_60 in IncognitoNewTabPageView so the designed purple still wins on the fixed-dark surface. - Remove Brave-local primitive_private_window_5/10/20/60/80/90 from brave_colors.xml; references now resolve through Leo's primitive scale (same hex for _60/80/90; slight neutral shift for _5/10/20). - Remove the runtime setBackgroundColor on the scroll view that was masking the gradient drawable defined in the layout XML. - Switch the private-tab logo to ic_social_brave_release_favicon_- fullheight_color (Leo) and size in dp (42 phone, 56 tablet) to match Figma and to stop scaling with accessibility font size. - Resize circle drawable to 32x32 (was 32x33), constrain inner icon via new_tab_page_incognito_icon_inner_size (20dp / 24dp tablet), and grow circle to 48dp on tablets. - Introduce per-form-factor style aliases (IncognitoNtpTitle / SectionTitle / SectionDescription / Cta) under values/ + values-sw600dp/ so phones and tablets land on the right Leo typography ramp without per-TextView attributes. - Delete the now-dead ntp_bg_incognito and incognito_modern_- primary_color color entries. Resolves: https://github.com/brave/brave-browser/issues/53958
This commit is contained in:
@@ -6,8 +6,12 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:drawable="@drawable/ic_midnight_purple_circle"
|
||||
android:width="@dimen/new_tab_page_incognito_icon_size"
|
||||
android:height="@dimen/new_tab_page_incognito_icon_size"
|
||||
android:gravity="center"/>
|
||||
<item
|
||||
android:drawable="@drawable/ic_antenna"
|
||||
android:width="@dimen/new_tab_page_incognito_icon_inner_size"
|
||||
android:height="@dimen/new_tab_page_incognito_icon_inner_size"
|
||||
android:gravity="center"/>
|
||||
</layer-list>
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--* Copyright (c) 2024 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/. -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@color/primitive_private_window_60"
|
||||
android:pathData="M18.31 16.35c0.33 0.4 0.9 0.41 1.33-0.04 1.52-1.64 2.36-3.87 2.36-6.28s-0.86-4.68-2.36-6.28c-0.42-0.46-1-0.44-1.33-0.05C18 4.06 18.1 4.53 18.45 4.93c1.2 1.33 1.87 3.12 1.87 5.1 0 1.96-0.67 3.75-1.87 5.08-0.36 0.4-0.46 0.87-0.14 1.24Zm-12.62 0c0.32-0.37 0.2-0.84-0.14-1.24-1.2-1.33-1.87-3.12-1.87-5.08 0-1.98 0.67-3.77 1.87-5.1 0.35-0.4 0.46-0.87 0.14-1.23-0.33-0.4-0.9-0.41-1.33 0.04C2.86 5.35 2 7.62 2 10.03s0.84 4.64 2.36 6.28c0.42 0.45 1 0.43 1.33 0.04Zm9.82-2.66c0.33 0.4 0.95 0.4 1.33-0.05 0.8-0.96 1.24-2.25 1.24-3.62s-0.44-2.66-1.24-3.6c-0.38-0.48-1-0.46-1.33-0.07-0.31 0.37-0.18 0.8 0.12 1.23 0.48 0.66 0.77 1.53 0.77 2.44 0 0.9-0.27 1.8-0.77 2.44-0.3 0.42-0.43 0.87-0.12 1.23Zm-7.02 0c0.3-0.36 0.18-0.8-0.12-1.23-0.5-0.64-0.78-1.53-0.78-2.44 0-0.9 0.3-1.78 0.78-2.44 0.3-0.42 0.42-0.86 0.12-1.23-0.33-0.39-0.95-0.4-1.33 0.06-0.8 0.95-1.24 2.24-1.24 3.61 0 1.37 0.44 2.66 1.24 3.62 0.38 0.46 1 0.45 1.33 0.05Zm3.5 6.9c0.5 0 0.8-0.35 0.8-0.89v-8.1c0.58-0.29 0.99-0.88 0.99-1.58 0-0.99-0.79-1.78-1.78-1.78s-1.77 0.8-1.77 1.78c0 0.7 0.39 1.3 0.97 1.58v8.1c0 0.53 0.33 0.9 0.8 0.9Z"/>
|
||||
</vector>
|
||||
@@ -6,13 +6,13 @@
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="33dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="32"
|
||||
android:viewportHeight="33"
|
||||
android:viewportHeight="32"
|
||||
>
|
||||
<group>
|
||||
<path
|
||||
android:pathData="M0,16.5C0,7.663 7.163,0.5 16,0.5C24.837,0.5 32,7.663 32,16.5C32,25.337 24.837,32.5 16,32.5C7.163,32.5 0,25.337 0,16.5Z"
|
||||
android:pathData="M0,16C0,7.163 7.163,0 16,0C24.837,0 32,7.163 32,16C32,24.837 24.837,32 16,32C7.163,32 0,24.837 0,16Z"
|
||||
android:fillColor="@color/primitive_private_window_20"/>
|
||||
</group>
|
||||
</vector>
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--* Copyright (c) 2024 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/. -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@color/primitive_private_window_60"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M3.1 11.37c0.14 0.46 0.42 3.12 1.27 3.89 0.87 0.79 4.17 0.78 4.8 0.43 1.42-0.76 1.99-3.24 2.24-4.32 0.14-0.62 0.59-0.62 0.59-0.62s0.47 0 0.62 0.62c0.25 1.08 0.8 3.56 2.2 4.33 0.64 0.34 3.94 0.36 4.81-0.43 0.85-0.77 1.13-3.44 1.27-3.9 0.14-0.46 0.85-0.92 1-1.08 0.14-0.15 0.14-0.76 0-0.92-0.29-0.3-3.62-0.58-7.22-0.15-0.71 0.09-0.98 0.3-2.68 0.3-1.7 0-1.97-0.22-2.69-0.3-3.58-0.43-6.92-0.15-7.2 0.15-0.14 0.16-0.14 0.77 0 0.92 0.14 0.16 0.84 0.62 0.99 1.08Z"/>
|
||||
</vector>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--* Copyright (c) 2024 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/. -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@color/primitive_private_window_60"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M5.05 6.13l6.8-3a0.36 0.36 0 0 1 0.3 0l6.8 3a0.33 0.33 0 0 1 0.2 0.3v4.52c0 4.52-3.09 8.71-7.15 9.9-4.06-1.19-7.15-5.38-7.15-9.9V6.42c0-0.12 0.07-0.24 0.2-0.3Zm7.74-4.46a1.96 1.96 0 0 0-1.58 0l-6.8 3a1.93 1.93 0 0 0-1.16 1.75v4.53c0 5.34 3.73 10.34 8.75 11.55 5.02-1.21 8.75-6.21 8.75-11.55V6.42c0-0.76-0.45-1.45-1.16-1.76l-6.8-3Zm-4.87 9.15A7 7 0 0 1 12 9.52c1.52 0 2.93 0.48 4.08 1.3a0.84 0.84 0 0 0 0.97-1.36A8.67 8.67 0 0 0 12 7.84a8.67 8.67 0 0 0-5.05 1.62 0.84 0.84 0 0 0 0.97 1.36Zm1.59 2.76A3.86 3.86 0 0 1 12 12.67c0.95 0 1.82 0.34 2.5 0.9a0.84 0.84 0 1 0 1.07-1.28A5.54 5.54 0 0 0 12 11a5.54 5.54 0 0 0-3.57 1.3 0.84 0.84 0 0 0 1.08 1.29Zm4.07 1.18c0.22 0.2 0.17 0.53-0.08 0.69a7.93 7.93 0 0 1-1.32 0.67 0.49 0.49 0 0 1-0.36 0 7.93 7.93 0 0 1-1.32-0.67c-0.25-0.16-0.3-0.5-0.08-0.69a2.38 2.38 0 0 1 1.58-0.6c0.6 0 1.16 0.23 1.58 0.6Z"/>
|
||||
</vector>
|
||||
@@ -10,7 +10,7 @@
|
||||
android:startColor="@color/primitive_private_window_20"
|
||||
android:centerColor="@color/primitive_private_window_10"
|
||||
android:endColor="@color/primitive_private_window_5"
|
||||
android:angle="225"
|
||||
android:angle="270"
|
||||
/>
|
||||
|
||||
</shape>
|
||||
|
||||
@@ -6,8 +6,12 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:drawable="@drawable/ic_midnight_purple_circle"
|
||||
android:width="@dimen/new_tab_page_incognito_icon_size"
|
||||
android:height="@dimen/new_tab_page_incognito_icon_size"
|
||||
android:gravity="center"/>
|
||||
<item
|
||||
android:drawable="@drawable/ic_product_private_window"
|
||||
android:width="@dimen/new_tab_page_incognito_icon_inner_size"
|
||||
android:height="@dimen/new_tab_page_incognito_icon_inner_size"
|
||||
android:gravity="center"/>
|
||||
</layer-list>
|
||||
|
||||
@@ -6,8 +6,12 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:drawable="@drawable/ic_midnight_purple_circle"
|
||||
android:width="@dimen/new_tab_page_incognito_icon_size"
|
||||
android:height="@dimen/new_tab_page_incognito_icon_size"
|
||||
android:gravity="center"/>
|
||||
<item
|
||||
android:drawable="@drawable/ic_product_vpn"
|
||||
android:width="@dimen/new_tab_page_incognito_icon_inner_size"
|
||||
android:height="@dimen/new_tab_page_incognito_icon_inner_size"
|
||||
android:gravity="center"/>
|
||||
</layer-list>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (c) 2026 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/. -->
|
||||
<resources>
|
||||
<style name="IncognitoNtpTitle" parent="FontHeadingDisplay2"/>
|
||||
<style name="IncognitoNtpSectionTitle" parent="LargeSemibold"/>
|
||||
<style name="IncognitoNtpSectionDescription" parent="DefaultRegular"/>
|
||||
<style name="IncognitoNtpCta" parent="DefaultSemibold"/>
|
||||
</resources>
|
||||
@@ -484,6 +484,21 @@
|
||||
<item name="fontStyle">normal</item>
|
||||
</style>
|
||||
|
||||
<style name="FontHeadingDisplay2">
|
||||
<item name="android:textSize">40sp</item>
|
||||
<item name="android:fontWeight">600</item>
|
||||
<item name="lineHeight">48sp</item>
|
||||
<item name="fontStyle">normal</item>
|
||||
</style>
|
||||
|
||||
<style name="IncognitoNtpTitle" parent="HeadingH1"/>
|
||||
|
||||
<style name="IncognitoNtpSectionTitle" parent="DefaultSemibold"/>
|
||||
|
||||
<style name="IncognitoNtpSectionDescription" parent="SmallRegular"/>
|
||||
|
||||
<style name="IncognitoNtpCta" parent="SmallSemibold"/>
|
||||
|
||||
<style name="MonospaceSmall">
|
||||
<item name="android:textSize">@dimen/monospace_small</item>
|
||||
<item name="lineHeight">16sp</item>
|
||||
|
||||
@@ -7,10 +7,13 @@ package org.chromium.chrome.browser.ntp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -75,7 +78,6 @@ public class IncognitoNewTabPageView extends FrameLayout {
|
||||
super.onFinishInflate();
|
||||
|
||||
mScrollView = (NewTabPageScrollView) findViewById(R.id.ntp_scrollview);
|
||||
mScrollView.setBackgroundColor(getContext().getColor(R.color.ntp_bg_incognito));
|
||||
setContentDescription(
|
||||
getResources().getText(R.string.accessibility_new_incognito_tab_page));
|
||||
|
||||
@@ -89,6 +91,23 @@ public class IncognitoNewTabPageView extends FrameLayout {
|
||||
mVpnCta = findViewById(R.id.tv_try_vpn);
|
||||
// Hide by default, will be shown by setVpnDisabledByPolicy() if allowed
|
||||
setVpnSectionVisibility(View.GONE);
|
||||
|
||||
// Nala icons default to @color/icon_default; override just the icon layer
|
||||
// (not the circle) so the private NTP shows the designed purple.
|
||||
int iconTint = getContext().getColor(R.color.primitive_private_window_60);
|
||||
tintLayerListIcon(R.id.iv_first_icon, iconTint);
|
||||
tintLayerListIcon(R.id.iv_second_icon, iconTint);
|
||||
tintLayerListIcon(R.id.iv_third_icon, iconTint);
|
||||
}
|
||||
|
||||
private void tintLayerListIcon(int imageViewId, int tint) {
|
||||
ImageView imageView = findViewById(imageViewId);
|
||||
if (imageView == null) return;
|
||||
Drawable drawable = imageView.getDrawable();
|
||||
if (!(drawable instanceof LayerDrawable)) return;
|
||||
LayerDrawable layers = (LayerDrawable) drawable.mutate();
|
||||
Drawable iconLayer = layers.getDrawable(1).mutate();
|
||||
iconLayer.setTint(tint);
|
||||
}
|
||||
|
||||
private void setVpnSectionVisibility(int visibility) {
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
android:layout_width="@dimen/new_tab_page_incognito_logo_size"
|
||||
android:layout_height="@dimen/new_tab_page_incognito_logo_size"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_brave_logo"
|
||||
android:src="@drawable/ic_social_brave_release_favicon_fullheight_color"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintTop_toTopOf="@+id/title"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/title"
|
||||
@@ -58,9 +58,8 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_marginTop="48dp"
|
||||
android:textStyle="bold"
|
||||
android:textSize="@dimen/new_tab_page_incognito_title_text_size"
|
||||
style="@style/IncognitoNtpTitle"
|
||||
android:layout_marginTop="96dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/brave_new_tab_private_header"
|
||||
@@ -90,7 +89,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_first_title"
|
||||
style="@style/DefaultSemibold"
|
||||
style="@style/IncognitoNtpSectionTitle"
|
||||
app:layout_constraintWidth_max="460dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_width="0dp"
|
||||
@@ -105,7 +104,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_first_description"
|
||||
style="@style/DefaultRegular"
|
||||
style="@style/IncognitoNtpSectionDescription"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -133,7 +132,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_second_title"
|
||||
style="@style/DefaultSemibold"
|
||||
style="@style/IncognitoNtpSectionTitle"
|
||||
app:layout_constraintWidth_max="460dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_width="0dp"
|
||||
@@ -148,7 +147,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_second_description"
|
||||
style="@style/DefaultRegular"
|
||||
style="@style/IncognitoNtpSectionDescription"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -176,7 +175,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_third_title"
|
||||
style="@style/DefaultSemibold"
|
||||
style="@style/IncognitoNtpSectionTitle"
|
||||
app:layout_constraintWidth_max="460dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_width="0dp"
|
||||
@@ -193,7 +192,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_third_description"
|
||||
style="@style/DefaultRegular"
|
||||
style="@style/IncognitoNtpSectionDescription"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
@@ -209,7 +208,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_try_vpn"
|
||||
style="@style/DefaultSemibold"
|
||||
style="@style/IncognitoNtpCta"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
<dimen name="onboarding_2_animation_height">300dp</dimen>
|
||||
<dimen name="onboarding_2_animation_width">500dp</dimen>
|
||||
|
||||
<dimen name="new_tab_page_incognito_title_text_size">40sp</dimen>
|
||||
<dimen name="new_tab_page_incognito_logo_size">56sp</dimen>
|
||||
<dimen name="new_tab_page_incognito_icon_size">48sp</dimen>
|
||||
<dimen name="new_tab_page_incognito_logo_size">56dp</dimen>
|
||||
<dimen name="new_tab_page_incognito_icon_size">48dp</dimen>
|
||||
<dimen name="new_tab_page_incognito_icon_inner_size">24dp</dimen>
|
||||
|
||||
<!-- Match this value with the upstream for Accessibility -->
|
||||
<dimen name="omnibox_search_engine_logo_composed_size">24dp</dimen>
|
||||
|
||||
@@ -124,12 +124,6 @@
|
||||
<color name="systemfeedback_info_icon">#0154cc</color>
|
||||
<color name="systemfeedback_info_text">#0154cc</color>
|
||||
<color name="container_background">#ffffff</color>
|
||||
<color name="primitive_private_window_5">#180339</color>
|
||||
<color name="primitive_private_window_10">#22044b</color>
|
||||
<color name="primitive_private_window_20">#390977</color>
|
||||
<color name="primitive_private_window_60">#9973f8</color>
|
||||
<color name="primitive_private_window_80">#cbc0f8</color>
|
||||
<color name="primitive_private_window_90">#e5e1f9</color>
|
||||
|
||||
<!-- Sync colors -->
|
||||
<color name="brave_sync_bg_color">@android:color/transparent</color>
|
||||
@@ -175,13 +169,9 @@
|
||||
<!-- Incognito mode colors -->
|
||||
<color name="toolbar_background_primary_dark">@color/primitive_private_window_5</color>
|
||||
<color name="toolbar_background_incognito">@color/primitive_private_window_5</color>
|
||||
<color name="ntp_bg_incognito">@color/incognito_modern_primary_color</color>
|
||||
<color name="brave_private_tabs_bg_color">#13052A</color>
|
||||
<color name="brave_private_reauth_unlock_button_bg_color">#4B415D</color>
|
||||
|
||||
<!-- Incognito background and branding colors -->
|
||||
<color name="incognito_modern_primary_color">#210950</color>
|
||||
|
||||
<color name="toolbar_text_box_background_incognito">@color/primitive_private_window_10</color>
|
||||
|
||||
<color name="compositor_tab_title_bar_text_incognito">@android:color/white</color>
|
||||
|
||||
@@ -53,9 +53,9 @@
|
||||
<dimen name="small_semibold">12sp</dimen>
|
||||
<dimen name="monospace_small">12sp</dimen>
|
||||
<dimen name="brave_toolbar_edge_padding_ntp">8dp</dimen>
|
||||
<dimen name="new_tab_page_incognito_title_text_size">28sp</dimen>
|
||||
<dimen name="new_tab_page_incognito_logo_size">42sp</dimen>
|
||||
<dimen name="new_tab_page_incognito_icon_size">32sp</dimen>
|
||||
<dimen name="new_tab_page_incognito_logo_size">42dp</dimen>
|
||||
<dimen name="new_tab_page_incognito_icon_size">32dp</dimen>
|
||||
<dimen name="new_tab_page_incognito_icon_inner_size">20dp</dimen>
|
||||
|
||||
<!-- Brave News cards-->
|
||||
<dimen name="brave_news_ad_title_textsize">17sp</dimen>
|
||||
|
||||
Reference in New Issue
Block a user