mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-18 02:08:20 +00:00
Support A11y contextual button
Also migrate to only using sysui state flags for ime/switcher visibility instead of 2 separate methods. Bug: 180046394 Test: Tested w/ 1 a11y service, then 2 services for long click. Tested with IME switcher enabled and then also suggested rotation button. A11y takes precedence over IME switcher, but rotation button takes precedence over a11y as is in phone mode today. Change-Id: I9289165c8ca98d7ee432bd7145122d6a519600f6
This commit is contained in:
@@ -44,7 +44,9 @@ public class TaskbarNavButtonController {
|
||||
BUTTON_BACK,
|
||||
BUTTON_HOME,
|
||||
BUTTON_RECENTS,
|
||||
BUTTON_IME_SWITCH
|
||||
BUTTON_IME_SWITCH,
|
||||
BUTTON_A11Y,
|
||||
BUTTON_A11Y_LONG_CLICK
|
||||
})
|
||||
|
||||
public @interface TaskbarButton {}
|
||||
@@ -53,6 +55,8 @@ public class TaskbarNavButtonController {
|
||||
static final int BUTTON_HOME = BUTTON_BACK << 1;
|
||||
static final int BUTTON_RECENTS = BUTTON_HOME << 1;
|
||||
static final int BUTTON_IME_SWITCH = BUTTON_RECENTS << 1;
|
||||
static final int BUTTON_A11Y = BUTTON_IME_SWITCH << 1;
|
||||
static final int BUTTON_A11Y_LONG_CLICK = BUTTON_A11Y << 1;
|
||||
|
||||
private final TouchInteractionService mService;
|
||||
|
||||
@@ -74,6 +78,12 @@ public class TaskbarNavButtonController {
|
||||
case BUTTON_IME_SWITCH:
|
||||
showIMESwitcher();
|
||||
break;
|
||||
case BUTTON_A11Y:
|
||||
notifyImeClick(false /* longClick */);
|
||||
break;
|
||||
case BUTTON_A11Y_LONG_CLICK:
|
||||
notifyImeClick(true /* longClick */);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,4 +107,13 @@ public class TaskbarNavButtonController {
|
||||
.showInputMethodPickerFromSystem(true /* showAuxiliarySubtypes */,
|
||||
DEFAULT_DISPLAY);
|
||||
}
|
||||
|
||||
private void notifyImeClick(boolean longClick) {
|
||||
SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.getNoCreate();
|
||||
if (longClick) {
|
||||
systemUiProxy.notifyAccessibilityButtonLongClicked();
|
||||
} else {
|
||||
systemUiProxy.notifyAccessibilityButtonClicked(mService.getDisplayId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user