Bug 1813875 - Prevent the inherited theming implementation being applied to Custom Tab views

fenix/124.1.0
t-p-white 4 months ago committed by mergify[bot]
parent f8edd00fe1
commit a36f35eebd

@ -233,8 +233,10 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
// There is disk read violations on some devices such as samsung and pixel for android 9/10 // There is disk read violations on some devices such as samsung and pixel for android 9/10
components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) { components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) {
// Theme setup should always be called before super.onCreate // Browsing mode & theme setup should always be called before super.onCreate.
setupThemeAndBrowsingMode(getModeFromIntentOrLastKnown(intent)) setupBrowsingMode(getModeFromIntentOrLastKnown(intent))
setupTheme()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
@ -870,12 +872,18 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
return false return false
} }
private fun setupThemeAndBrowsingMode(mode: BrowsingMode) { private fun setupBrowsingMode(mode: BrowsingMode) {
settings().lastKnownMode = mode settings().lastKnownMode = mode
browsingModeManager = createBrowsingModeManager(mode) browsingModeManager = createBrowsingModeManager(mode)
}
private fun setupTheme() {
themeManager = createThemeManager() themeManager = createThemeManager()
themeManager.setActivityTheme(this) // ExternalAppBrowserActivity handles it's own theming as it can be customized.
themeManager.applyStatusBarTheme(this) if (this !is ExternalAppBrowserActivity) {
themeManager.setActivityTheme(this)
themeManager.applyStatusBarTheme(this)
}
} }
// Stop active media when activity is destroyed. // Stop active media when activity is destroyed.

@ -13,7 +13,6 @@ import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.provider.Settings import android.provider.Settings
import android.util.Log import android.util.Log
import android.view.Gravity
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -138,6 +137,7 @@ import org.mozilla.fenix.components.toolbar.ToolbarIntegration
import org.mozilla.fenix.components.toolbar.interactor.BrowserToolbarInteractor import org.mozilla.fenix.components.toolbar.interactor.BrowserToolbarInteractor
import org.mozilla.fenix.components.toolbar.interactor.DefaultBrowserToolbarInteractor import org.mozilla.fenix.components.toolbar.interactor.DefaultBrowserToolbarInteractor
import org.mozilla.fenix.crashes.CrashContentIntegration import org.mozilla.fenix.crashes.CrashContentIntegration
import org.mozilla.fenix.customtabs.ExternalAppBrowserActivity
import org.mozilla.fenix.databinding.FragmentBrowserBinding import org.mozilla.fenix.databinding.FragmentBrowserBinding
import org.mozilla.fenix.downloads.DynamicDownloadDialog import org.mozilla.fenix.downloads.DynamicDownloadDialog
import org.mozilla.fenix.downloads.FirstPartyDownloadDialog import org.mozilla.fenix.downloads.FirstPartyDownloadDialog
@ -266,7 +266,11 @@ abstract class BaseBrowserFragment :
_binding = FragmentBrowserBinding.inflate(inflater, container, false) _binding = FragmentBrowserBinding.inflate(inflater, container, false)
val activity = activity as HomeActivity val activity = activity as HomeActivity
activity.themeManager.applyStatusBarTheme(activity) // ExternalAppBrowserActivity handles it's own theming as it can be customized.
if (activity !is ExternalAppBrowserActivity) {
activity.themeManager.applyStatusBarTheme(activity)
}
val originalContext = ActivityContextWrapper.getOriginalContext(activity) val originalContext = ActivityContextWrapper.getOriginalContext(activity)
binding.engineView.setActivityContext(originalContext) binding.engineView.setActivityContext(originalContext)
@ -1567,7 +1571,10 @@ abstract class BaseBrowserFragment :
activity?.exitImmersiveMode() activity?.exitImmersiveMode()
(view as? SwipeGestureLayout)?.isSwipeEnabled = true (view as? SwipeGestureLayout)?.isSwipeEnabled = true
(activity as? HomeActivity)?.let { activity -> (activity as? HomeActivity)?.let { activity ->
activity.themeManager.applyStatusBarTheme(activity) // ExternalAppBrowserActivity handles it's own theming as it can be customized.
if (activity !is ExternalAppBrowserActivity) {
activity.themeManager.applyStatusBarTheme(activity)
}
} }
if (webAppToolbarShouldBeVisible) { if (webAppToolbarShouldBeVisible) {
browserToolbarView.view.isVisible = true browserToolbarView.view.isVisible = true

Loading…
Cancel
Save