mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Making clear-all action accessible on a fallback Overview.
Bug: 72222505 Test: Manual Change-Id: I063081b4fa009882e50852e107490fddae0f86b7
This commit is contained in:
@@ -20,8 +20,10 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.quickstep.RecentsActivity;
|
||||
import com.android.quickstep.util.LayoutUtils;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
@@ -71,4 +73,21 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity> {
|
||||
// Just use the activity task size for multi-window as well.
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTaskAccessibilityActionsExtra(AccessibilityNodeInfo info) {
|
||||
info.addAction(
|
||||
new AccessibilityNodeInfo.AccessibilityAction(
|
||||
R.string.recents_clear_all,
|
||||
getContext().getText(R.string.recents_clear_all)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performTaskAccessibilityActionExtra(int action) {
|
||||
if (action == R.string.recents_clear_all) {
|
||||
dismissAllTasks();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewDebug;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
|
||||
import com.android.launcher3.BaseActivity;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
@@ -1321,4 +1322,11 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
||||
protected boolean isPageOrderFlipped() {
|
||||
return FLIP_RECENTS;
|
||||
}
|
||||
|
||||
public void addTaskAccessibilityActionsExtra(AccessibilityNodeInfo info) {
|
||||
}
|
||||
|
||||
public boolean performTaskAccessibilityActionExtra(int action) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.quickstep.views;
|
||||
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
|
||||
import static com.android.quickstep.views.TaskThumbnailView.DIM_ALPHA_MULTIPLIER;
|
||||
|
||||
import android.animation.Animator;
|
||||
@@ -116,7 +117,7 @@ public class TaskView extends FrameLayout implements TaskCallbacks, PageCallback
|
||||
}
|
||||
launchTask(true /* animate */);
|
||||
BaseActivity.fromContext(context).getUserEventDispatcher().logTaskLaunchOrDismiss(
|
||||
Touch.TAP, Direction.NONE, ((RecentsView) getParent()).indexOfChild(this),
|
||||
Touch.TAP, Direction.NONE, getRecentsView().indexOfChild(this),
|
||||
TaskUtils.getComponentKeyForTask(getTask().key));
|
||||
});
|
||||
setOutlineProvider(new TaskOutlineProvider(getResources()));
|
||||
@@ -318,12 +319,14 @@ public class TaskView extends FrameLayout implements TaskCallbacks, PageCallback
|
||||
context.getText(menuOption.labelResId)));
|
||||
}
|
||||
}
|
||||
|
||||
getRecentsView().addTaskAccessibilityActionsExtra(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performAccessibilityAction(int action, Bundle arguments) {
|
||||
if (action == R.string.accessibility_close_task) {
|
||||
((RecentsView) getParent()).dismissTask(this, true /*animateTaskView*/,
|
||||
getRecentsView().dismissTask(this, true /*animateTaskView*/,
|
||||
true /*removeTask*/);
|
||||
return true;
|
||||
}
|
||||
@@ -339,9 +342,15 @@ public class TaskView extends FrameLayout implements TaskCallbacks, PageCallback
|
||||
}
|
||||
}
|
||||
|
||||
if (getRecentsView().performTaskAccessibilityActionExtra(action)) return true;
|
||||
|
||||
return super.performAccessibilityAction(action, arguments);
|
||||
}
|
||||
|
||||
private RecentsView getRecentsView() {
|
||||
return (RecentsView) getParent();
|
||||
}
|
||||
|
||||
public void notifyTaskLaunchFailed(String tag) {
|
||||
String msg = "Failed to launch task";
|
||||
if (mTask != null) {
|
||||
|
||||
Reference in New Issue
Block a user