For #10026: Add a11y state listener to BaseBrowserFragment.
parent
cf0126e079
commit
e7a5613afb
|
@ -12,6 +12,7 @@ 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
|
||||||
|
import android.view.accessibility.AccessibilityManager
|
||||||
import androidx.annotation.CallSuper
|
import androidx.annotation.CallSuper
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
|
@ -96,6 +97,7 @@ import org.mozilla.fenix.components.toolbar.ToolbarIntegration
|
||||||
import org.mozilla.fenix.components.toolbar.ToolbarPosition
|
import org.mozilla.fenix.components.toolbar.ToolbarPosition
|
||||||
import org.mozilla.fenix.downloads.DownloadService
|
import org.mozilla.fenix.downloads.DownloadService
|
||||||
import org.mozilla.fenix.downloads.DynamicDownloadDialog
|
import org.mozilla.fenix.downloads.DynamicDownloadDialog
|
||||||
|
import org.mozilla.fenix.ext.accessibilityManager
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
import org.mozilla.fenix.ext.enterToImmersiveMode
|
import org.mozilla.fenix.ext.enterToImmersiveMode
|
||||||
import org.mozilla.fenix.ext.hideToolbar
|
import org.mozilla.fenix.ext.hideToolbar
|
||||||
|
@ -119,7 +121,7 @@ import java.lang.ref.WeakReference
|
||||||
@ExperimentalCoroutinesApi
|
@ExperimentalCoroutinesApi
|
||||||
@Suppress("TooManyFunctions", "LargeClass")
|
@Suppress("TooManyFunctions", "LargeClass")
|
||||||
abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, SessionManager.Observer,
|
abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, SessionManager.Observer,
|
||||||
OnBackLongPressedListener {
|
OnBackLongPressedListener, AccessibilityManager.AccessibilityStateChangeListener {
|
||||||
private lateinit var browserFragmentStore: BrowserFragmentStore
|
private lateinit var browserFragmentStore: BrowserFragmentStore
|
||||||
private lateinit var browserAnimator: BrowserAnimator
|
private lateinit var browserAnimator: BrowserAnimator
|
||||||
|
|
||||||
|
@ -714,6 +716,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
||||||
super.onStart()
|
super.onStart()
|
||||||
requireComponents.core.sessionManager.register(this, this, autoPause = true)
|
requireComponents.core.sessionManager.register(this, this, autoPause = true)
|
||||||
sitePermissionWifiIntegration.get()?.maybeAddWifiConnectedListener()
|
sitePermissionWifiIntegration.get()?.maybeAddWifiConnectedListener()
|
||||||
|
requireContext().accessibilityManager.addAccessibilityStateChangeListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
@CallSuper
|
@CallSuper
|
||||||
|
@ -1012,6 +1015,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
_browserToolbarView = null
|
_browserToolbarView = null
|
||||||
_browserInteractor = null
|
_browserInteractor = null
|
||||||
|
requireContext().accessibilityManager.removeAccessibilityStateChangeListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1020,4 +1024,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
||||||
private const val REQUEST_CODE_PROMPT_PERMISSIONS = 2
|
private const val REQUEST_CODE_PROMPT_PERMISSIONS = 2
|
||||||
private const val REQUEST_CODE_APP_PERMISSIONS = 3
|
private const val REQUEST_CODE_APP_PERMISSIONS = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onAccessibilityStateChanged(enabled: Boolean) {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue