Bug 1845234 - Adds a new background gradient for TPBM

fenix/118.0
Jeff Boek 10 months ago committed by mergify[bot]
parent c0f4bfbf89
commit da401c1782

@ -23,8 +23,11 @@ import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
import org.mozilla.fenix.customtabs.ExternalAppBrowserActivity
import org.mozilla.fenix.ext.settings
abstract class ThemeManager {
abstract class ThemeManager(
private val privacyStyleRes: Int,
) {
abstract var currentTheme: BrowsingMode
@ -34,7 +37,7 @@ abstract class ThemeManager {
@get:StyleRes
val currentThemeResource get() = when (currentTheme) {
BrowsingMode.Normal -> R.style.NormalTheme
BrowsingMode.Private -> R.style.PrivateTheme
BrowsingMode.Private -> privacyStyleRes
}
/**
@ -118,7 +121,7 @@ abstract class ThemeManager {
class DefaultThemeManager(
currentTheme: BrowsingMode,
private val activity: Activity,
) : ThemeManager() {
) : ThemeManager(privacyStyleRes = activity.getStyleRes()) {
override var currentTheme: BrowsingMode = currentTheme
set(value) {
if (currentTheme != value) {
@ -136,3 +139,9 @@ class DefaultThemeManager(
}
}
}
private fun Activity.getStyleRes(): Int = if (settings().feltPrivateBrowsingEnabled) {
R.style.FeltPrivateTheme
} else {
R.style.PrivateTheme
}

@ -0,0 +1,16 @@
<?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/. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:angle="45"
android:startColor="@color/fx_mobile_private_layer_color_4_start"
android:centerColor="@color/fx_mobile_private_layer_color_4_center"
android:endColor="@color/fx_mobile_private_layer_color_4_end"
android:type="linear" />
</shape>
</item>
</selector>

@ -347,6 +347,9 @@
</style>
<style name="PrivateTheme" parent="PrivateThemeBase" />
<style name="FeltPrivateTheme" parent="PrivateThemeBase">
<item name="homeBackground">@drawable/felt_private_home_background_gradient</item>
</style>
<!-- Fade animation for theme switching -->
<style name="WindowAnimationTransition">

Loading…
Cancel
Save