For #11903: fix custom tab private gradient
parent
f39313d908
commit
183ba1bce0
|
@ -5,7 +5,7 @@
|
||||||
package org.mozilla.fenix.customtabs
|
package org.mozilla.fenix.customtabs
|
||||||
|
|
||||||
import android.app.Activity
|
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.session.SessionManager
|
||||||
import mozilla.components.browser.toolbar.BrowserToolbar
|
import mozilla.components.browser.toolbar.BrowserToolbar
|
||||||
import mozilla.components.browser.toolbar.display.DisplayToolbar
|
import mozilla.components.browser.toolbar.display.DisplayToolbar
|
||||||
|
@ -30,16 +30,13 @@ class CustomTabsIntegration(
|
||||||
// Remove toolbar shadow
|
// Remove toolbar shadow
|
||||||
toolbar.elevation = 0f
|
toolbar.elevation = 0f
|
||||||
|
|
||||||
val uncoloredEtpShield = AppCompatResources.getDrawable(
|
val uncoloredEtpShield = getDrawable(activity, R.drawable.ic_tracking_protection_enabled)!!
|
||||||
activity,
|
|
||||||
R.drawable.ic_tracking_protection_enabled
|
|
||||||
)!!
|
|
||||||
|
|
||||||
toolbar.display.icons = toolbar.display.icons.copy(
|
toolbar.display.icons = toolbar.display.icons.copy(
|
||||||
// Custom private tab backgrounds have bad contrast against the colored shield
|
// Custom private tab backgrounds have bad contrast against the colored shield
|
||||||
trackingProtectionTrackersBlocked = uncoloredEtpShield,
|
trackingProtectionTrackersBlocked = uncoloredEtpShield,
|
||||||
trackingProtectionNothingBlocked = uncoloredEtpShield,
|
trackingProtectionNothingBlocked = uncoloredEtpShield,
|
||||||
trackingProtectionException = AppCompatResources.getDrawable(
|
trackingProtectionException = getDrawable(
|
||||||
activity,
|
activity,
|
||||||
R.drawable.ic_tracking_protection_disabled
|
R.drawable.ic_tracking_protection_disabled
|
||||||
)!!
|
)!!
|
||||||
|
@ -70,10 +67,7 @@ class CustomTabsIntegration(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
toolbar.background = AppCompatResources.getDrawable(
|
toolbar.background = getDrawable(activity, R.drawable.toolbar_background_private)
|
||||||
activity,
|
|
||||||
R.drawable.toolbar_background
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 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 http://mozilla.org/MPL/2.0/. -->
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:angle="45"
|
||||||
|
android:startColor="@color/toolbar_start_gradient_private_theme"
|
||||||
|
android:centerColor="@color/toolbar_center_gradient_private_theme"
|
||||||
|
android:endColor="@color/toolbar_end_gradient_private_theme"
|
||||||
|
android:type="linear" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item android:gravity="top">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<size android:height="1dp" />
|
||||||
|
<solid android:color="@color/neutral_faded_private_theme" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
Loading…
Reference in New Issue