diff options
author | Vadim Tryshev <vadimt@google.com> | 2018-05-16 11:26:17 -0700 |
---|---|---|
committer | Vadim Tryshev <vadimt@google.com> | 2018-05-16 12:00:33 -0700 |
commit | 3f51631b806fb81e2b76a626edcb78f1b46118d1 (patch) | |
tree | 5a47e387b68e890f13a1147799430e0140f945d8 /quickstep | |
parent | d9a1337b40fcb1041bba48cd59d7f358f5b7895f (diff) | |
download | android_packages_apps_Trebuchet-3f51631b806fb81e2b76a626edcb78f1b46118d1.tar.gz android_packages_apps_Trebuchet-3f51631b806fb81e2b76a626edcb78f1b46118d1.tar.bz2 android_packages_apps_Trebuchet-3f51631b806fb81e2b76a626edcb78f1b46118d1.zip |
Adding Clear All to accessibility chevron on Recents
For motivation, see email thread "Tweaks to for the reverted order of
accessibility swiping"
This doesn't add the action to the fallback Recents, so it will require
more work.
Bug: 79165501
Test: Manual
Change-Id: I99d608ccc13cc1742dc4d427e763125788e8edd2
Diffstat (limited to 'quickstep')
-rw-r--r-- | quickstep/src/com/android/quickstep/views/ShelfScrimView.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java index 69b77b453..24afd4868 100644 --- a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java +++ b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java @@ -28,6 +28,9 @@ import android.graphics.Paint; import android.graphics.Path; import android.graphics.Path.Direction; import android.graphics.Path.Op; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; import android.util.AttributeSet; import com.android.launcher3.DeviceProfile; @@ -48,6 +51,7 @@ public class ShelfScrimView extends ScrimView { private static final int THRESHOLD_ALPHA_DARK = 102; private static final int THRESHOLD_ALPHA_LIGHT = 46; private static final int THRESHOLD_ALPHA_SUPER_LIGHT = 128; + private static final int CLEAR_ALL_TASKS = R.string.recents_clear_all; // In transposed layout, we simply draw a flat color. private boolean mDrawingFlatColor; @@ -213,4 +217,43 @@ public class ShelfScrimView extends ScrimView { mRadius, mRadius, mPaint); return minTop - mDragHandleSize - top; } + + @NonNull + @Override + protected AccessibilityHelper createAccessibilityHelper() { + return new ShelfScrimAccessibilityHelper(); + } + + protected class ShelfScrimAccessibilityHelper extends AccessibilityHelper { + @Override + protected void onPopulateNodeForVirtualView(int virtualViewId, + AccessibilityNodeInfoCompat node) { + super.onPopulateNodeForVirtualView(virtualViewId, node); + + if (mLauncher.isInState(OVERVIEW)) { + final RecentsView overviewPanel = mLauncher.getOverviewPanel(); + if (overviewPanel.getChildCount() != 0) { + node.addAction( + new AccessibilityNodeInfoCompat.AccessibilityActionCompat( + CLEAR_ALL_TASKS, + getContext().getText(CLEAR_ALL_TASKS))); + } + } + } + + @Override + protected boolean onPerformActionForVirtualView( + int virtualViewId, int action, Bundle arguments) { + if (super.onPerformActionForVirtualView(virtualViewId, action, arguments)) return true; + + if (action == CLEAR_ALL_TASKS) { + if (mLauncher.isInState(OVERVIEW)) { + mLauncher.<RecentsView>getOverviewPanel().dismissAllTasks(); + } + return true; + } + + return false; + } + } } |