mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
Bug 1812149 - Add ActivityContextWrapper before updating locale
From ohall's learnings, we know that we need to use the original Android Activity Context with the system PrintManager. When a configuration change happens, a new Context is created and the original is lost. The most straight-forward way to do that is to use a ContextWrapper which internally holds a reference to the original context.
This commit is contained in:
parent
b5b7ad6a7c
commit
59c4860c1e
@ -99,6 +99,7 @@ import mozilla.components.support.ktx.android.view.hideKeyboard
|
||||
import mozilla.components.support.ktx.kotlin.getOrigin
|
||||
import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifAnyChanged
|
||||
import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifChanged
|
||||
import mozilla.components.support.locale.ActivityContextWrapper
|
||||
import org.mozilla.fenix.BuildConfig
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.GleanMetrics.MediaState
|
||||
@ -250,6 +251,8 @@ abstract class BaseBrowserFragment :
|
||||
|
||||
val activity = activity as HomeActivity
|
||||
activity.themeManager.applyStatusBarTheme(activity)
|
||||
val originalContext = ActivityContextWrapper.getOriginalContext(activity)
|
||||
binding.engineView.setActivityContext(originalContext)
|
||||
|
||||
browserFragmentStore = StoreProvider.get(this) {
|
||||
BrowserFragmentStore(
|
||||
@ -1494,7 +1497,9 @@ abstract class BaseBrowserFragment :
|
||||
message = "onDestroyView()",
|
||||
)
|
||||
|
||||
binding.engineView.setActivityContext(null)
|
||||
requireContext().accessibilityManager.removeAccessibilityStateChangeListener(this)
|
||||
|
||||
_browserToolbarView = null
|
||||
_browserToolbarInteractor = null
|
||||
_binding = null
|
||||
|
Loading…
Reference in New Issue
Block a user