Merge "Adjust edit shortcuts page to display button & gesture" into main
This commit is contained in:
@@ -20,6 +20,7 @@ import static android.app.Activity.RESULT_CANCELED;
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE;
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS;
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED;
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_GESTURE_TARGETS;
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_MAGNIFICATION_TWO_FINGER_TRIPLE_TAP_ENABLED;
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_QS_TARGETS;
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE;
|
||||
@@ -93,7 +94,8 @@ public class EditShortcutsPreferenceFragment extends DashboardFragment {
|
||||
Settings.Secure.getUriFor(ACCESSIBILITY_BUTTON_MODE);
|
||||
private static final Uri BUTTON_SHORTCUT_SETTING =
|
||||
Settings.Secure.getUriFor(ACCESSIBILITY_BUTTON_TARGETS);
|
||||
|
||||
private static final Uri GESTURE_SHORTCUT_SETTING =
|
||||
Settings.Secure.getUriFor(ACCESSIBILITY_GESTURE_TARGETS);
|
||||
private static final Uri TRIPLE_TAP_SHORTCUT_SETTING =
|
||||
Settings.Secure.getUriFor(ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED);
|
||||
private static final Uri TWO_FINGERS_DOUBLE_TAP_SHORTCUT_SETTING =
|
||||
@@ -107,6 +109,7 @@ public class EditShortcutsPreferenceFragment extends DashboardFragment {
|
||||
VOLUME_KEYS_SHORTCUT_SETTING,
|
||||
BUTTON_SHORTCUT_MODE_SETTING,
|
||||
BUTTON_SHORTCUT_SETTING,
|
||||
GESTURE_SHORTCUT_SETTING,
|
||||
TRIPLE_TAP_SHORTCUT_SETTING,
|
||||
TWO_FINGERS_DOUBLE_TAP_SHORTCUT_SETTING,
|
||||
QUICK_SETTINGS_SHORTCUT_SETTING,
|
||||
@@ -173,6 +176,8 @@ public class EditShortcutsPreferenceFragment extends DashboardFragment {
|
||||
} else if (BUTTON_SHORTCUT_MODE_SETTING.equals(uri)
|
||||
|| BUTTON_SHORTCUT_SETTING.equals(uri)) {
|
||||
refreshSoftwareShortcutControllers();
|
||||
} else if (GESTURE_SHORTCUT_SETTING.equals(uri)) {
|
||||
refreshPreferenceController(GestureShortcutOptionController.class);
|
||||
} else if (TRIPLE_TAP_SHORTCUT_SETTING.equals(uri)) {
|
||||
refreshPreferenceController(TripleTapShortcutOptionController.class);
|
||||
} else if (TWO_FINGERS_DOUBLE_TAP_SHORTCUT_SETTING.equals(uri)) {
|
||||
|
||||
@@ -50,7 +50,14 @@ public class FloatingButtonShortcutOptionController
|
||||
|
||||
@Override
|
||||
protected boolean isShortcutAvailable() {
|
||||
return AccessibilityUtil.isFloatingMenuEnabled(mContext);
|
||||
if (android.provider.Flags.a11yStandaloneGestureEnabled()) {
|
||||
// FAB should be available when in gesture navigation mode,
|
||||
// or if we're in the FAB button mode while in navbar navigation mode.
|
||||
return AccessibilityUtil.isGestureNavigateEnabled(mContext)
|
||||
|| AccessibilityUtil.isFloatingMenuEnabled(mContext);
|
||||
} else {
|
||||
return AccessibilityUtil.isFloatingMenuEnabled(mContext);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.accessibility.shortcuts;
|
||||
|
||||
import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.GESTURE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.SpannableStringBuilder;
|
||||
|
||||
@@ -51,11 +53,22 @@ public class GestureShortcutOptionController extends SoftwareShortcutOptionPrefe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getShortcutType() {
|
||||
return android.provider.Flags.a11yStandaloneGestureEnabled()
|
||||
? GESTURE : super.getShortcutType();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isShortcutAvailable() {
|
||||
return !isInSetupWizard()
|
||||
&& !AccessibilityUtil.isFloatingMenuEnabled(mContext)
|
||||
&& AccessibilityUtil.isGestureNavigateEnabled(mContext);
|
||||
if (android.provider.Flags.a11yStandaloneGestureEnabled()) {
|
||||
return !isInSetupWizard()
|
||||
&& AccessibilityUtil.isGestureNavigateEnabled(mContext);
|
||||
} else {
|
||||
return !isInSetupWizard()
|
||||
&& AccessibilityUtil.isGestureNavigateEnabled(mContext)
|
||||
&& !AccessibilityUtil.isFloatingMenuEnabled(mContext);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,9 +81,8 @@ public class GestureShortcutOptionController extends SoftwareShortcutOptionPrefe
|
||||
|
||||
final SpannableStringBuilder sb = new SpannableStringBuilder();
|
||||
sb.append(instruction);
|
||||
if (!isInSetupWizard()) {
|
||||
sb.append("\n\n");
|
||||
sb.append(getCustomizeAccessibilityButtonLink());
|
||||
if (!isInSetupWizard() && !android.provider.Flags.a11yStandaloneGestureEnabled()) {
|
||||
sb.append("\n\n").append(getCustomizeAccessibilityButtonLink());
|
||||
}
|
||||
|
||||
return sb;
|
||||
|
||||
Reference in New Issue
Block a user