[automerger] Adding Clear All to accessibility chevron on Recents am: 3f51631b80
Change-Id: I189940125220121306ff63fe15d1f7dae7d3568d
This commit is contained in:
commit
7fb181e1c1
2 files changed
+54
-2
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,7 @@ import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
|
||||
@@ -113,12 +114,17 @@ public class ScrimView extends View implements Insettable, OnChangeListener,
|
||||
.getDimensionPixelSize(R.dimen.vertical_drag_handle_size);
|
||||
mDragHandleBounds = new Rect(0, 0, mDragHandleSize, mDragHandleSize);
|
||||
|
||||
mAccessibilityHelper = new AccessibilityHelper();
|
||||
mAccessibilityHelper = createAccessibilityHelper();
|
||||
ViewCompat.setAccessibilityDelegate(this, mAccessibilityHelper);
|
||||
|
||||
mAM = (AccessibilityManager) context.getSystemService(ACCESSIBILITY_SERVICE);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
protected AccessibilityHelper createAccessibilityHelper() {
|
||||
return new AccessibilityHelper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInsets(Rect insets) {
|
||||
updateDragHandleBounds();
|
||||
@@ -190,6 +196,9 @@ public class ScrimView extends View implements Insettable, OnChangeListener,
|
||||
if (mCurrentFlatColor != 0) {
|
||||
canvas.drawColor(mCurrentFlatColor);
|
||||
}
|
||||
if (mDragHandle != null) {
|
||||
mDragHandle.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -323,7 +332,7 @@ public class ScrimView extends View implements Insettable, OnChangeListener,
|
||||
: IMPORTANT_FOR_ACCESSIBILITY_AUTO);
|
||||
}
|
||||
|
||||
private class AccessibilityHelper extends ExploreByTouchHelper {
|
||||
protected class AccessibilityHelper extends ExploreByTouchHelper {
|
||||
|
||||
private static final int DRAG_HANDLE_ID = 1;
|
||||
|
||||
|
||||
Reference in new issue
Block a user