From 183ba1bce09227a580459c8692abcee341252259 Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Wed, 24 Jun 2020 09:58:30 -0700 Subject: [PATCH] For #11903: fix custom tab private gradient --- .../fenix/customtabs/CustomTabsIntegration.kt | 14 ++++-------- .../drawable/toolbar_background_private.xml | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 app/src/main/res/drawable/toolbar_background_private.xml diff --git a/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt b/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt index c561cbba2..900401314 100644 --- a/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt +++ b/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt @@ -5,7 +5,7 @@ package org.mozilla.fenix.customtabs import android.app.Activity -import androidx.appcompat.content.res.AppCompatResources +import androidx.appcompat.content.res.AppCompatResources.getDrawable import mozilla.components.browser.session.SessionManager import mozilla.components.browser.toolbar.BrowserToolbar import mozilla.components.browser.toolbar.display.DisplayToolbar @@ -30,16 +30,13 @@ class CustomTabsIntegration( // Remove toolbar shadow toolbar.elevation = 0f - val uncoloredEtpShield = AppCompatResources.getDrawable( - activity, - R.drawable.ic_tracking_protection_enabled - )!! + val uncoloredEtpShield = getDrawable(activity, R.drawable.ic_tracking_protection_enabled)!! toolbar.display.icons = toolbar.display.icons.copy( // Custom private tab backgrounds have bad contrast against the colored shield trackingProtectionTrackersBlocked = uncoloredEtpShield, trackingProtectionNothingBlocked = uncoloredEtpShield, - trackingProtectionException = AppCompatResources.getDrawable( + trackingProtectionException = getDrawable( activity, R.drawable.ic_tracking_protection_disabled )!! @@ -70,10 +67,7 @@ class CustomTabsIntegration( ) } - toolbar.background = AppCompatResources.getDrawable( - activity, - R.drawable.toolbar_background - ) + toolbar.background = getDrawable(activity, R.drawable.toolbar_background_private) } } diff --git a/app/src/main/res/drawable/toolbar_background_private.xml b/app/src/main/res/drawable/toolbar_background_private.xml new file mode 100644 index 000000000..146188097 --- /dev/null +++ b/app/src/main/res/drawable/toolbar_background_private.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + +