summaryrefslogtreecommitdiffstats
path: root/quickstep/src/com/android/quickstep/views/RecentsView.java
diff options
context:
space:
mode:
Diffstat (limited to 'quickstep/src/com/android/quickstep/views/RecentsView.java')
-rw-r--r--quickstep/src/com/android/quickstep/views/RecentsView.java57
1 files changed, 48 insertions, 9 deletions
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index dee15d0d7..d550edcd3 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -39,6 +39,7 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
+import android.os.Bundle;
import android.os.Handler;
import android.os.UserHandle;
import android.support.annotation.Nullable;
@@ -386,7 +387,13 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
private void updateClearAllButtonAlpha() {
if (mClearAllButton != null) {
final float alpha = calculateClearAllButtonAlpha();
- mIsClearAllButtonFullyRevealed = alpha == 1;
+ final boolean revealed = alpha == 1;
+ if (mIsClearAllButtonFullyRevealed != revealed) {
+ mIsClearAllButtonFullyRevealed = revealed;
+ mClearAllButton.setImportantForAccessibility(revealed ?
+ IMPORTANT_FOR_ACCESSIBILITY_YES :
+ IMPORTANT_FOR_ACCESSIBILITY_NO);
+ }
mClearAllButton.setAlpha(alpha * mContentAlpha);
}
}
@@ -507,6 +514,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
DeviceProfile dp = mActivity.getDeviceProfile();
getTaskSize(dp, mTempRect);
+ // Keep this logic in sync with ActivityControlHelper.getTranslationYForQuickScrub.
mTempRect.top -= mTaskTopMargin;
setPadding(mTempRect.left - mInsets.left, mTempRect.top - mInsets.top,
dp.availableWidthPx + mInsets.left - mTempRect.right,
@@ -1285,7 +1293,30 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
}
@Override
+ public boolean performAccessibilityAction(int action, Bundle arguments) {
+ if (getChildCount() > 0) {
+ switch (action) {
+ case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
+ if (!mIsClearAllButtonFullyRevealed && getCurrentPage() == getPageCount() - 1) {
+ revealClearAllButton();
+ return true;
+ }
+ }
+ case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
+ if (mIsClearAllButtonFullyRevealed) {
+ setCurrentPage(getChildCount() - 1);
+ return true;
+ }
+ }
+ break;
+ }
+ }
+ return super.performAccessibilityAction(action, arguments);
+ }
+
+ @Override
public void addChildrenForAccessibility(ArrayList<View> outChildren) {
+ outChildren.add(mClearAllButton);
for (int i = getChildCount() - 1; i >= 0; --i) {
outChildren.add(getChildAt(i));
}
@@ -1295,6 +1326,13 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
+ if (getChildCount() > 0) {
+ info.addAction(mIsClearAllButtonFullyRevealed ?
+ AccessibilityNodeInfo.ACTION_SCROLL_FORWARD :
+ AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
+ info.setScrollable(true);
+ }
+
final AccessibilityNodeInfo.CollectionInfo
collectionInfo = AccessibilityNodeInfo.CollectionInfo.obtain(
1, getChildCount(), false,
@@ -1306,11 +1344,15 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
- if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
- final int visiblePageNumber = getChildCount() - getCurrentPage() - 1;
- event.setFromIndex(visiblePageNumber);
- event.setToIndex(visiblePageNumber);
- event.setItemCount(getChildCount());
+ event.setScrollable(getPageCount() > 0);
+
+ if (!mIsClearAllButtonFullyRevealed
+ && event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
+ final int childCount = getChildCount();
+ final int[] visibleTasks = getVisibleChildrenRange();
+ event.setFromIndex(childCount - visibleTasks[1] - 1);
+ event.setToIndex(childCount - visibleTasks[0] - 1);
+ event.setItemCount(childCount);
}
}
@@ -1325,9 +1367,6 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
return true;
}
- public void addTaskAccessibilityActionsExtra(AccessibilityNodeInfo info) {
- }
-
public boolean performTaskAccessibilityActionExtra(int action) {
return false;
}