Removing menu and dialog for custom actions hanlding.

These do not work well with gesture-nav and can potentially
block the Launcher UI.

Instead exposing on custom actions with keyboard accelerator and
using thee internal arrowPopup for resize options
Fixing SecondoryDropTarget not sending appropriate stats log

Bug: 179854703
Test: Verified on device
Change-Id: I268690f8a937896e4350496128a38959003f8939
This commit is contained in:
Sunny Goyal
2021-02-16 10:45:06 -08:00
parent 2268d7a937
commit 384b578ab2
18 changed files with 342 additions and 289 deletions
@@ -18,9 +18,8 @@ package com.android.launcher3.accessibility;
import static com.android.launcher3.LauncherState.NORMAL;
import android.view.KeyEvent;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
@@ -31,7 +30,8 @@ import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.notification.NotificationMainView;
import com.android.launcher3.shortcuts.DeepShortcutView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Extension of {@link LauncherAccessibilityDelegate} with actions specific to shortcuts in
@@ -43,23 +43,23 @@ public class ShortcutMenuAccessibilityDelegate extends LauncherAccessibilityDele
public ShortcutMenuAccessibilityDelegate(Launcher launcher) {
super(launcher);
mActions.put(DISMISS_NOTIFICATION, new AccessibilityAction(DISMISS_NOTIFICATION,
launcher.getText(R.string.action_dismiss_notification)));
mActions.put(DISMISS_NOTIFICATION, new LauncherAction(DISMISS_NOTIFICATION,
R.string.action_dismiss_notification, KeyEvent.KEYCODE_X));
}
@Override
public void addSupportedActions(View host, AccessibilityNodeInfo info, boolean fromKeyboard) {
protected void getSupportedActions(View host, ItemInfo item, List<LauncherAction> out) {
if ((host.getParent() instanceof DeepShortcutView)) {
info.addAction(mActions.get(ADD_TO_WORKSPACE));
out.add(mActions.get(ADD_TO_WORKSPACE));
} else if (host instanceof NotificationMainView) {
if (((NotificationMainView) host).canChildBeDismissed()) {
info.addAction(mActions.get(DISMISS_NOTIFICATION));
out.add(mActions.get(DISMISS_NOTIFICATION));
}
}
}
@Override
public boolean performAction(View host, ItemInfo item, int action, boolean fromKeyboard) {
protected boolean performAction(View host, ItemInfo item, int action, boolean fromKeyboard) {
if (action == ADD_TO_WORKSPACE) {
if (!(host.getParent() instanceof DeepShortcutView)) {
return false;
@@ -73,9 +73,7 @@ public class ShortcutMenuAccessibilityDelegate extends LauncherAccessibilityDele
mLauncher.getModelWriter().addItemToDatabase(info,
LauncherSettings.Favorites.CONTAINER_DESKTOP,
screenId, coordinates[0], coordinates[1]);
ArrayList<ItemInfo> itemList = new ArrayList<>();
itemList.add(info);
mLauncher.bindItems(itemList, true);
mLauncher.bindItems(Collections.singletonList(info), true);
AbstractFloatingView.closeAllOpenViews(mLauncher);
announceConfirmation(R.string.item_added_to_workspace);
}