Loading quickstep/src/com/android/quickstep/views/ClearAllButton.java +4 −9 Original line number Diff line number Diff line Loading @@ -16,13 +16,11 @@ package com.android.quickstep.views; import static android.view.accessibility.AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS; import android.content.Context; import android.graphics.Rect; import android.os.Bundle; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.Button; public class ClearAllButton extends Button { Loading @@ -37,12 +35,9 @@ public class ClearAllButton extends Button { } @Override public boolean performAccessibilityAction(int action, Bundle arguments) { final boolean res = super.performAccessibilityAction(action, arguments); if (action == ACTION_ACCESSIBILITY_FOCUS) { mRecentsView.revealClearAllButton(); } return res; public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); info.setParent(mRecentsView); // Pretend we are a part of the task carousel. } @Override Loading quickstep/src/com/android/quickstep/views/RecentsView.java +42 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } } Loading Loading @@ -1285,8 +1292,31 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl scrollTo(mIsRtl ? 0 : computeMaxScrollX(), 0); } @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)); } Loading @@ -1296,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, Loading @@ -1307,7 +1344,10 @@ 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) { 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); Loading quickstep/src/com/android/quickstep/views/RecentsViewContainer.java +5 −0 Original line number Diff line number Diff line Loading @@ -124,4 +124,9 @@ public class RecentsViewContainer extends InsettableFrameLayout { return mRecentsView.requestFocus(direction, previouslyFocusedRect) || super.requestFocus(direction, previouslyFocusedRect); } @Override public void addChildrenForAccessibility(ArrayList<View> outChildren) { outChildren.add(mRecentsView); } } No newline at end of file Loading
quickstep/src/com/android/quickstep/views/ClearAllButton.java +4 −9 Original line number Diff line number Diff line Loading @@ -16,13 +16,11 @@ package com.android.quickstep.views; import static android.view.accessibility.AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS; import android.content.Context; import android.graphics.Rect; import android.os.Bundle; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.Button; public class ClearAllButton extends Button { Loading @@ -37,12 +35,9 @@ public class ClearAllButton extends Button { } @Override public boolean performAccessibilityAction(int action, Bundle arguments) { final boolean res = super.performAccessibilityAction(action, arguments); if (action == ACTION_ACCESSIBILITY_FOCUS) { mRecentsView.revealClearAllButton(); } return res; public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); info.setParent(mRecentsView); // Pretend we are a part of the task carousel. } @Override Loading
quickstep/src/com/android/quickstep/views/RecentsView.java +42 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } } Loading Loading @@ -1285,8 +1292,31 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl scrollTo(mIsRtl ? 0 : computeMaxScrollX(), 0); } @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)); } Loading @@ -1296,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, Loading @@ -1307,7 +1344,10 @@ 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) { 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); Loading
quickstep/src/com/android/quickstep/views/RecentsViewContainer.java +5 −0 Original line number Diff line number Diff line Loading @@ -124,4 +124,9 @@ public class RecentsViewContainer extends InsettableFrameLayout { return mRecentsView.requestFocus(direction, previouslyFocusedRect) || super.requestFocus(direction, previouslyFocusedRect); } @Override public void addChildrenForAccessibility(ArrayList<View> outChildren) { outChildren.add(mRecentsView); } } No newline at end of file