For #2035 Add TouchExplorationStateChangeListener and adjust toolbar
parent
46924544b6
commit
bc10c65c52
|
@ -78,7 +78,8 @@ import org.mozilla.fenix.utils.Settings
|
|||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
@SuppressWarnings("TooManyFunctions", "LargeClass")
|
||||
class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
||||
class BrowserFragment : Fragment(), BackHandler, CoroutineScope,
|
||||
AccessibilityManager.TouchExplorationStateChangeListener {
|
||||
private lateinit var toolbarComponent: ToolbarComponent
|
||||
|
||||
private var sessionObserver: Session.Observer? = null
|
||||
|
@ -304,8 +305,8 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|||
@Suppress("ComplexMethod")
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
setToolbarBehavior(false)
|
||||
sessionObserver = subscribeToSession()
|
||||
updateToolbar()
|
||||
getAutoDisposeObservable<SearchAction>()
|
||||
.subscribe {
|
||||
when (it) {
|
||||
|
@ -568,6 +569,16 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|||
return observer
|
||||
}
|
||||
|
||||
override fun onTouchExplorationStateChanged(enabled: Boolean) {
|
||||
updateToolbar()
|
||||
}
|
||||
|
||||
private fun updateToolbar() {
|
||||
getSessionById()?.loading?.let {
|
||||
setToolbarBehavior(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setToolbarBehavior(loading: Boolean) {
|
||||
if (getSessionById()?.isCustomTabSession() == true) { return }
|
||||
|
||||
|
|
Loading…
Reference in New Issue