diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2018-05-15 13:55:57 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2018-05-16 13:11:00 -0700 |
commit | de7532154259ed79d7ed6d2fcc9e82ff2860a5a3 (patch) | |
tree | a8865d45fd1ce0b2dc6d01beee460e34b35d27a3 /src/com/android/launcher3/folder | |
parent | 6ae02c6a61e2d2c7014bd5f8b2a0266c5b802245 (diff) | |
download | android_packages_apps_Trebuchet-de7532154259ed79d7ed6d2fcc9e82ff2860a5a3.tar.gz android_packages_apps_Trebuchet-de7532154259ed79d7ed6d2fcc9e82ff2860a5a3.tar.bz2 android_packages_apps_Trebuchet-de7532154259ed79d7ed6d2fcc9e82ff2860a5a3.zip |
Fixing wrong accessibility focus when opening a floating view
> Using common logic for announcing a floating view for widgets and folders
Bug: 79091095
Bug: 79748886
Change-Id: Ibb3fe48e68e724f50d69f51a03d3b35ad0baf625
Diffstat (limited to 'src/com/android/launcher3/folder')
-rw-r--r-- | src/com/android/launcher3/folder/Folder.java | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index 99c800d14..b49952f15 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -31,6 +31,7 @@ import android.text.InputType; import android.text.Selection; import android.util.AttributeSet; import android.util.Log; +import android.util.Pair; import android.view.ActionMode; import android.view.FocusFinder; import android.view.KeyEvent; @@ -516,15 +517,11 @@ public class Folder extends AbstractFloatingView implements DragSource, public void onAnimationStart(Animator animation) { mFolderIcon.setBackgroundVisible(false); mFolderIcon.drawLeaveBehindIfExists(); - - sendCustomAccessibilityEvent( - Folder.this, - AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, - mContent.getAccessibilityDescription()); } @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; + announceAccessibilityChanges(); mLauncher.getUserEventDispatcher().resetElapsedContainerMillis("folder opened"); mContent.setFocusOnFirstChild(); @@ -574,11 +571,6 @@ public class Folder extends AbstractFloatingView implements DragSource, } mContent.verifyVisibleHighResIcons(mContent.getNextPage()); - - // Notify the accessibility manager that this folder "window" has appeared and occluded - // the workspace items - sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); - dragLayer.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } public void beginExternalDrag() { @@ -612,6 +604,7 @@ public class Folder extends AbstractFloatingView implements DragSource, animateClosed(); } else { closeComplete(false); + post(this::announceAccessibilityChanges); } // Notify the accessibility manager that this folder "window" has disappeared and no @@ -626,18 +619,18 @@ public class Folder extends AbstractFloatingView implements DragSource, @Override public void onAnimationEnd(Animator animation) { closeComplete(true); - } - @Override - public void onAnimationStart(Animator animation) { - sendCustomAccessibilityEvent( - Folder.this, - AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, - getContext().getString(R.string.folder_closed)); + announceAccessibilityChanges(); } }); startAnimation(a); } + @Override + protected Pair<View, String> getAccessibilityTarget() { + return Pair.create(mContent, mIsOpen ? mContent.getAccessibilityDescription() + : getContext().getString(R.string.folder_closed)); + } + private void closeComplete(boolean wasAnimated) { // TODO: Clear all active animations. DragLayer parent = (DragLayer) getParent(); |