Invalidate talkback accessibility tree after transitioning

Using AutoTransition seems to allow the talkback accessibility nodes to
stay out of sync if the user starts iterating the view during the
transition. Calling `notifySubtreeAccessibilityStateChangedIfNeeded()`
on the end of the transition gets us back into the correct state.

Test: manual; start iterating view via talkback swiping while the
channel dialog editor transitions between app notifications on/off
Fixes: 133822221

Change-Id: I7218bc0734cf05372b8fbecfb6eeef69cb3f1d40
This commit is contained in:
Evan Laird
2019-06-07 14:55:59 -04:00
parent 445d7b38e4
commit b8c5103d4c

View File

@@ -24,6 +24,7 @@ import android.content.Context
import android.graphics.drawable.Drawable
import android.text.TextUtils
import android.transition.AutoTransition
import android.transition.Transition
import android.transition.TransitionManager
import android.util.AttributeSet
import android.view.LayoutInflater
@@ -62,6 +63,23 @@ class ChannelEditorListView(c: Context, attrs: AttributeSet) : LinearLayout(c, a
val transition = AutoTransition()
transition.duration = 200
transition.addListener(object : Transition.TransitionListener {
override fun onTransitionEnd(p0: Transition?) {
notifySubtreeAccessibilityStateChangedIfNeeded()
}
override fun onTransitionResume(p0: Transition?) {
}
override fun onTransitionPause(p0: Transition?) {
}
override fun onTransitionCancel(p0: Transition?) {
}
override fun onTransitionStart(p0: Transition?) {
}
})
TransitionManager.beginDelayedTransition(this, transition)
// Remove any rows