use of com.android.quickstep.TaskSystemShortcut in project Neo-Launcher by NeoApplications.
the class TaskView method performAccessibilityAction.
@Override
public boolean performAccessibilityAction(int action, Bundle arguments) {
if (action == R.string.accessibility_close_task) {
getRecentsView().dismissTask(this, true, /*animateTaskView*/
true);
return true;
}
if (action == R.string.accessibility_app_usage_settings) {
mDigitalWellBeingToast.openAppUsageSettings(this);
return true;
}
final List<TaskSystemShortcut> shortcuts = TaskOverlayFactory.INSTANCE.get(getContext()).getEnabledShortcuts(this);
final int count = shortcuts.size();
for (int i = 0; i < count; ++i) {
final TaskSystemShortcut menuOption = shortcuts.get(i);
if (menuOption.hasHandlerForAction(action)) {
OnClickListener onClickListener = menuOption.getOnClickListener(mActivity, this);
if (onClickListener != null) {
onClickListener.onClick(this);
}
return true;
}
}
return super.performAccessibilityAction(action, arguments);
}
use of com.android.quickstep.TaskSystemShortcut in project Neo-Launcher by NeoApplications.
the class TaskView method onInitializeAccessibilityNodeInfo.
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.string.accessibility_close_task, getContext().getText(R.string.accessibility_close_task)));
final Context context = getContext();
final List<TaskSystemShortcut> shortcuts = TaskOverlayFactory.INSTANCE.get(getContext()).getEnabledShortcuts(this);
final int count = shortcuts.size();
for (int i = 0; i < count; ++i) {
final TaskSystemShortcut menuOption = shortcuts.get(i);
OnClickListener onClickListener = menuOption.getOnClickListener(mActivity, this);
if (onClickListener != null) {
info.addAction(menuOption.createAccessibilityAction(context));
}
}
if (mDigitalWellBeingToast.hasLimit()) {
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.string.accessibility_app_usage_settings, getContext().getText(R.string.accessibility_app_usage_settings)));
}
final RecentsView recentsView = getRecentsView();
final AccessibilityNodeInfo.CollectionItemInfo itemInfo = AccessibilityNodeInfo.CollectionItemInfo.obtain(0, 1, recentsView.getChildCount() - recentsView.indexOfChild(this) - 1, 1, false);
info.setCollectionItemInfo(itemInfo);
}
use of com.android.quickstep.TaskSystemShortcut in project Neo-Launcher by NeoApplications.
the class TaskMenuView method addMenuOptions.
private void addMenuOptions(TaskView taskView) {
Drawable icon = taskView.getTask().icon.getConstantState().newDrawable();
mTaskIcon.setDrawable(icon);
mTaskIcon.setOnClickListener(v -> close(true));
mTaskName.setText(TaskUtils.getTitle(getContext(), taskView.getTask()));
mTaskName.setOnClickListener(v -> close(true));
// Set the icons to match scale by listening to each other's changes
mMenuIconDrawable = icon instanceof FastBitmapDrawable ? (FastBitmapDrawable) icon : null;
taskView.getIconView().addUpdateScaleListener(mTaskViewIconScaleListener);
mTaskIcon.addUpdateScaleListener(mMenuIconScaleListener);
// Move the icon and text up half an icon size to lay over the TaskView
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mTaskIcon.getLayoutParams();
params.topMargin = (int) -mThumbnailTopMargin;
mTaskIcon.setLayoutParams(params);
final BaseDraggingActivity activity = BaseDraggingActivity.fromContext(getContext());
final List<TaskSystemShortcut> shortcuts = TaskOverlayFactory.INSTANCE.get(getContext()).getEnabledShortcuts(taskView);
final int count = shortcuts.size();
for (int i = 0; i < count; ++i) {
final TaskSystemShortcut menuOption = shortcuts.get(i);
addMenuOption(menuOption, menuOption.getOnClickListener(activity, taskView));
}
}
Aggregations