Merge "Fix dialog accessibility issues." into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
65ce0da897
@@ -299,6 +299,13 @@ private class AnimatedDialog(
|
|||||||
fullscreenTransparentBackground.setOnClickListener { dialog.dismiss() }
|
fullscreenTransparentBackground.setOnClickListener { dialog.dismiss() }
|
||||||
dialogContentWithBackground.isClickable = true
|
dialogContentWithBackground.isClickable = true
|
||||||
|
|
||||||
|
// Make sure the transparent and dialog backgrounds are not focusable by accessibility
|
||||||
|
// features.
|
||||||
|
fullscreenTransparentBackground.importantForAccessibility =
|
||||||
|
View.IMPORTANT_FOR_ACCESSIBILITY_NO
|
||||||
|
dialogContentWithBackground.importantForAccessibility =
|
||||||
|
View.IMPORTANT_FOR_ACCESSIBILITY_NO
|
||||||
|
|
||||||
fullscreenTransparentBackground.addView(
|
fullscreenTransparentBackground.addView(
|
||||||
dialogContentWithBackground,
|
dialogContentWithBackground,
|
||||||
FrameLayout.LayoutParams(
|
FrameLayout.LayoutParams(
|
||||||
@@ -342,8 +349,10 @@ private class AnimatedDialog(
|
|||||||
?.color
|
?.color
|
||||||
?.defaultColor ?: Color.BLACK
|
?.defaultColor ?: Color.BLACK
|
||||||
|
|
||||||
// Make the background view invisible until we start the animation.
|
// Make the background view invisible until we start the animation. We use the transition
|
||||||
dialogContentWithBackground.visibility = View.INVISIBLE
|
// visibility like GhostView does so that we don't mess up with the accessibility tree (see
|
||||||
|
// b/204944038#comment17).
|
||||||
|
dialogContentWithBackground.setTransitionVisibility(View.INVISIBLE)
|
||||||
|
|
||||||
// Make sure the dialog is visible instantly and does not do any window animation.
|
// Make sure the dialog is visible instantly and does not do any window animation.
|
||||||
window.attributes.windowAnimations = R.style.Animation_LaunchAnimation
|
window.attributes.windowAnimations = R.style.Animation_LaunchAnimation
|
||||||
|
|||||||
@@ -186,7 +186,11 @@ open class GhostedViewLaunchAnimatorController(
|
|||||||
// Making the ghost view invisible will make the ghosted view visible, so order is
|
// Making the ghost view invisible will make the ghosted view visible, so order is
|
||||||
// important here.
|
// important here.
|
||||||
ghostView.visibility = View.INVISIBLE
|
ghostView.visibility = View.INVISIBLE
|
||||||
ghostedView.visibility = View.INVISIBLE
|
|
||||||
|
// Make the ghosted view invisible again. We use the transition visibility like
|
||||||
|
// GhostView does so that we don't mess up with the accessibility tree (see
|
||||||
|
// b/204944038#comment17).
|
||||||
|
ghostedView.setTransitionVisibility(View.INVISIBLE)
|
||||||
backgroundView.visibility = View.INVISIBLE
|
backgroundView.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@@ -257,6 +261,10 @@ open class GhostedViewLaunchAnimatorController(
|
|||||||
|
|
||||||
GhostView.removeGhost(ghostedView)
|
GhostView.removeGhost(ghostedView)
|
||||||
launchContainerOverlay.remove(backgroundView)
|
launchContainerOverlay.remove(backgroundView)
|
||||||
|
|
||||||
|
// Make sure that the view is considered VISIBLE by accessibility by first making it
|
||||||
|
// INVISIBLE then VISIBLE (see b/204944038#comment17 for more info).
|
||||||
|
ghostedView.visibility = View.INVISIBLE
|
||||||
ghostedView.visibility = View.VISIBLE
|
ghostedView.visibility = View.VISIBLE
|
||||||
ghostedView.invalidate()
|
ghostedView.invalidate()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user