Support accessibility shortcut secondary action (10/n)
Integrate with Talkback enabled and change the behavior as below: 1. Show 3-finger swipe up from bottom summary 2. Show 3-finger icons for edit shortcut dialog 3. Dismiss the running the edit shortcut dialog Bug: 142530063 Bug: 142531156 Bug: 147989432 Test: make RunSettingsRoboTests2 Change-Id: I2f34b8eebfdc5a385d72402e95a8b1d0bde4a428
This commit is contained in:
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
@@ -4818,13 +4818,13 @@
|
|||||||
<!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using the 3-button nav bar. [CHAR LIMIT=NONE] -->
|
<!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using the 3-button nav bar. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_tutorial_dialog_message_button">To turn this service on or off, tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> on the bottom of your screen.\n\nTo switch between services, touch & hold the accessibility button.</string>
|
<string name="accessibility_tutorial_dialog_message_button">To turn this service on or off, tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> on the bottom of your screen.\n\nTo switch between services, touch & hold the accessibility button.</string>
|
||||||
<!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is not enabled. [CHAR LIMIT=NONE] -->
|
<!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is not enabled. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_tutorial_dialog_message_gesture_without_talkback">To turn this service on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between services, swipe up with two fingers and hold.</string>
|
<string name="accessibility_tutorial_dialog_message_gesture">To turn this service on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between services, swipe up with two fingers and hold.</string>
|
||||||
<!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is enabled. [CHAR LIMIT=NONE] -->
|
<!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is enabled. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_tutorial_dialog_message_gesture_with_talkback">To turn this service on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between services, swipe up with three fingers and hold.</string>
|
<string name="accessibility_tutorial_dialog_message_gesture_talkback">To turn this service on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between services, swipe up with three fingers and hold.</string>
|
||||||
<!-- Message for the Accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is disabled. [CHAR LIMIT=NONE] -->
|
<!-- Message for the Accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is disabled. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_tutorial_dialog_message_gesture_settings_without_talkback">To turn an accessibility service on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between services, swipe up with two fingers and hold.</string>
|
<string name="accessibility_tutorial_dialog_message_gesture_settings">To turn an accessibility service on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between services, swipe up with two fingers and hold.</string>
|
||||||
<!-- Message for the Accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is enabled. [CHAR LIMIT=NONE] -->
|
<!-- Message for the Accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is enabled. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_tutorial_dialog_message_gesture_settings_with_talkback">To turn an accessibility service on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between services, swipe up with three fingers and hold.</string>
|
<string name="accessibility_tutorial_dialog_message_gesture_settings_talkback">To turn an accessibility service on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between services, swipe up with three fingers and hold.</string>
|
||||||
<!-- Button for the Accessibility tutorial dialog to dismiss the dialog when user clicks it. [CHAR LIMIT=10] -->
|
<!-- Button for the Accessibility tutorial dialog to dismiss the dialog when user clicks it. [CHAR LIMIT=10] -->
|
||||||
<string name="accessibility_tutorial_dialog_button">Got it</string>
|
<string name="accessibility_tutorial_dialog_button">Got it</string>
|
||||||
<!-- Title for accessibility shortcut preference for accessibility apps. [CHAR LIMIT=40] -->
|
<!-- Title for accessibility shortcut preference for accessibility apps. [CHAR LIMIT=40] -->
|
||||||
@@ -4839,12 +4839,16 @@
|
|||||||
<string name="accessibility_shortcut_edit_dialog_title_daltonizer">Shortcut to open Color correction</string>
|
<string name="accessibility_shortcut_edit_dialog_title_daltonizer">Shortcut to open Color correction</string>
|
||||||
<!-- Title for software shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
<!-- Title for software shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_edit_dialog_title_software">Accessibility Button</string>
|
<string name="accessibility_shortcut_edit_dialog_title_software">Accessibility Button</string>
|
||||||
<!-- Title for software shortcut in gesture mode in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
<!-- Title for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_edit_dialog_title_software_gesture">2-finger swipe up from bottom</string>
|
<string name="accessibility_shortcut_edit_dialog_title_software_gesture">2-finger swipe up from bottom</string>
|
||||||
|
<!-- Title for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_shortcut_edit_dialog_title_software_gesture_talkback">3-finger swipe up from bottom</string>
|
||||||
<!-- Summary for software shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
<!-- Summary for software shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_edit_dialog_summary_software">Tap the <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> button at the bottom of your screen</string>
|
<string name="accessibility_shortcut_edit_dialog_summary_software">Tap the <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> button at the bottom of your screen</string>
|
||||||
<!-- Summary for software shortcut in gesture mode in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
<!-- Summary for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture">Swipe up with 2 fingers from edge of screen</string>
|
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture">Swipe up with 2 fingers from edge of screen</string>
|
||||||
|
<!-- Summary for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture_talkback">Swipe up with 3 fingers from edge of screen</string>
|
||||||
<!-- Title for hardware shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
<!-- Title for hardware shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_shortcut_edit_dialog_title_hardware">Hold volume keys</string>
|
<string name="accessibility_shortcut_edit_dialog_title_hardware">Hold volume keys</string>
|
||||||
<!-- Summary for hardware shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
<!-- Summary for hardware shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
||||||
|
@@ -171,7 +171,7 @@ public class AccessibilityEditDialogUtils {
|
|||||||
|
|
||||||
private static void initMagnifyFullScreen(Context context, View view) {
|
private static void initMagnifyFullScreen(Context context, View view) {
|
||||||
final View dialogView = view.findViewById(R.id.magnify_full_screen);
|
final View dialogView = view.findViewById(R.id.magnify_full_screen);
|
||||||
final String title = context.getString(
|
final CharSequence title = context.getText(
|
||||||
R.string.accessibility_magnification_area_settings_full_screen);
|
R.string.accessibility_magnification_area_settings_full_screen);
|
||||||
// TODO(b/146019459): Use vector drawable instead of temporal png file to avoid distorted.
|
// TODO(b/146019459): Use vector drawable instead of temporal png file to avoid distorted.
|
||||||
setupShortcutWidget(dialogView, title, R.drawable.accessibility_magnification_full_screen);
|
setupShortcutWidget(dialogView, title, R.drawable.accessibility_magnification_full_screen);
|
||||||
@@ -179,7 +179,7 @@ public class AccessibilityEditDialogUtils {
|
|||||||
|
|
||||||
private static void initMagnifyWindowScreen(Context context, View view) {
|
private static void initMagnifyWindowScreen(Context context, View view) {
|
||||||
final View dialogView = view.findViewById(R.id.magnify_window_screen);
|
final View dialogView = view.findViewById(R.id.magnify_window_screen);
|
||||||
final String title = context.getString(
|
final CharSequence title = context.getText(
|
||||||
R.string.accessibility_magnification_area_settings_window_screen);
|
R.string.accessibility_magnification_area_settings_window_screen);
|
||||||
// TODO(b/146019459): Use vector drawable instead of temporal png file to avoid distorted.
|
// TODO(b/146019459): Use vector drawable instead of temporal png file to avoid distorted.
|
||||||
setupShortcutWidget(dialogView, title,
|
setupShortcutWidget(dialogView, title,
|
||||||
@@ -214,9 +214,9 @@ public class AccessibilityEditDialogUtils {
|
|||||||
|
|
||||||
private static void initHardwareShortcut(Context context, View view) {
|
private static void initHardwareShortcut(Context context, View view) {
|
||||||
final View dialogView = view.findViewById(R.id.hardware_shortcut);
|
final View dialogView = view.findViewById(R.id.hardware_shortcut);
|
||||||
final String title = context.getString(
|
final CharSequence title = context.getText(
|
||||||
R.string.accessibility_shortcut_edit_dialog_title_hardware);
|
R.string.accessibility_shortcut_edit_dialog_title_hardware);
|
||||||
final String summary = context.getString(
|
final CharSequence summary = context.getText(
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_hardware);
|
R.string.accessibility_shortcut_edit_dialog_summary_hardware);
|
||||||
setupShortcutWidget(dialogView, title, summary,
|
setupShortcutWidget(dialogView, title, summary,
|
||||||
R.drawable.accessibility_shortcut_type_hardware);
|
R.drawable.accessibility_shortcut_type_hardware);
|
||||||
@@ -225,9 +225,9 @@ public class AccessibilityEditDialogUtils {
|
|||||||
|
|
||||||
private static void initMagnifyShortcut(Context context, View view) {
|
private static void initMagnifyShortcut(Context context, View view) {
|
||||||
final View dialogView = view.findViewById(R.id.triple_tap_shortcut);
|
final View dialogView = view.findViewById(R.id.triple_tap_shortcut);
|
||||||
final String title = context.getString(
|
final CharSequence title = context.getText(
|
||||||
R.string.accessibility_shortcut_edit_dialog_title_triple_tap);
|
R.string.accessibility_shortcut_edit_dialog_title_triple_tap);
|
||||||
final String summary = context.getString(
|
final CharSequence summary = context.getText(
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_triple_tap);
|
R.string.accessibility_shortcut_edit_dialog_summary_triple_tap);
|
||||||
setupShortcutWidget(dialogView, title, summary,
|
setupShortcutWidget(dialogView, title, summary,
|
||||||
R.drawable.accessibility_shortcut_type_triple_tap);
|
R.drawable.accessibility_shortcut_type_triple_tap);
|
||||||
@@ -244,23 +244,34 @@ public class AccessibilityEditDialogUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static CharSequence retrieveTitle(Context context) {
|
private static CharSequence retrieveTitle(Context context) {
|
||||||
return context.getString(AccessibilityUtil.isGestureNavigateEnabled(context)
|
int resId = R.string.accessibility_shortcut_edit_dialog_title_software;
|
||||||
? R.string.accessibility_shortcut_edit_dialog_title_software_gesture
|
if (AccessibilityUtil.isGestureNavigateEnabled(context)) {
|
||||||
: R.string.accessibility_shortcut_edit_dialog_title_software);
|
resId = AccessibilityUtil.isTouchExploreEnabled(context)
|
||||||
|
? R.string.accessibility_shortcut_edit_dialog_title_software_gesture_talkback
|
||||||
|
: R.string.accessibility_shortcut_edit_dialog_title_software_gesture;
|
||||||
|
}
|
||||||
|
return context.getText(resId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CharSequence retrieveSummary(Context context, int lineHeight) {
|
private static CharSequence retrieveSummary(Context context, int lineHeight) {
|
||||||
return AccessibilityUtil.isGestureNavigateEnabled(context)
|
if (AccessibilityUtil.isGestureNavigateEnabled(context)) {
|
||||||
? context.getString(
|
final int resId = AccessibilityUtil.isTouchExploreEnabled(context)
|
||||||
R.string.accessibility_shortcut_edit_dialog_summary_software_gesture)
|
? R.string.accessibility_shortcut_edit_dialog_summary_software_gesture_talkback
|
||||||
: getSummaryStringWithIcon(context, lineHeight);
|
: R.string.accessibility_shortcut_edit_dialog_summary_software_gesture;
|
||||||
|
return context.getText(resId);
|
||||||
|
}
|
||||||
|
return getSummaryStringWithIcon(context, lineHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int retrieveImageResId(Context context) {
|
private static int retrieveImageResId(Context context) {
|
||||||
return AccessibilityUtil.isGestureNavigateEnabled(context)
|
|
||||||
? R.drawable.accessibility_shortcut_type_software_gesture
|
|
||||||
: R.drawable.accessibility_shortcut_type_software;
|
|
||||||
// TODO(b/142531156): Use vector drawable instead of temporal png file to avoid distorted.
|
// TODO(b/142531156): Use vector drawable instead of temporal png file to avoid distorted.
|
||||||
|
int resId = R.drawable.accessibility_shortcut_type_software;
|
||||||
|
if (AccessibilityUtil.isGestureNavigateEnabled(context)) {
|
||||||
|
resId = AccessibilityUtil.isTouchExploreEnabled(context)
|
||||||
|
? R.drawable.accessibility_shortcut_type_software_gesture_talkback
|
||||||
|
: R.drawable.accessibility_shortcut_type_software_gesture;
|
||||||
|
}
|
||||||
|
return resId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SpannableString getSummaryStringWithIcon(Context context, int lineHeight) {
|
private static SpannableString getSummaryStringWithIcon(Context context, int lineHeight) {
|
||||||
|
@@ -27,7 +27,6 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.TextureView;
|
import android.view.TextureView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.ColorInt;
|
import androidx.annotation.ColorInt;
|
||||||
@@ -117,13 +116,13 @@ public class AccessibilityGestureNavigationTutorial {
|
|||||||
R.id.gesture_tutorial_video);
|
R.id.gesture_tutorial_video);
|
||||||
final TextView gestureTutorialMessage = content.findViewById(
|
final TextView gestureTutorialMessage = content.findViewById(
|
||||||
R.id.gesture_tutorial_message);
|
R.id.gesture_tutorial_message);
|
||||||
VideoPlayer.create(context, isTouchExploreOn(context)
|
VideoPlayer.create(context, AccessibilityUtil.isTouchExploreEnabled(context)
|
||||||
? R.raw.illustration_accessibility_gesture_three_finger
|
? R.raw.illustration_accessibility_gesture_three_finger
|
||||||
: R.raw.illustration_accessibility_gesture_two_finger,
|
: R.raw.illustration_accessibility_gesture_two_finger,
|
||||||
gestureTutorialVideo);
|
gestureTutorialVideo);
|
||||||
gestureTutorialMessage.setText(isTouchExploreOn(context)
|
gestureTutorialMessage.setText(AccessibilityUtil.isTouchExploreEnabled(context)
|
||||||
? R.string.accessibility_tutorial_dialog_message_gesture_with_talkback
|
? R.string.accessibility_tutorial_dialog_message_gesture_talkback
|
||||||
: R.string.accessibility_tutorial_dialog_message_gesture_without_talkback);
|
: R.string.accessibility_tutorial_dialog_message_gesture);
|
||||||
break;
|
break;
|
||||||
case DialogType.GESTURE_NAVIGATION_SETTINGS:
|
case DialogType.GESTURE_NAVIGATION_SETTINGS:
|
||||||
content = inflater.inflate(
|
content = inflater.inflate(
|
||||||
@@ -132,14 +131,14 @@ public class AccessibilityGestureNavigationTutorial {
|
|||||||
R.id.gesture_tutorial_video);
|
R.id.gesture_tutorial_video);
|
||||||
final TextView gestureSettingsTutorialMessage = content.findViewById(
|
final TextView gestureSettingsTutorialMessage = content.findViewById(
|
||||||
R.id.gesture_tutorial_message);
|
R.id.gesture_tutorial_message);
|
||||||
VideoPlayer.create(context, isTouchExploreOn(context)
|
VideoPlayer.create(context, AccessibilityUtil.isTouchExploreEnabled(context)
|
||||||
? R.raw.illustration_accessibility_gesture_three_finger
|
? R.raw.illustration_accessibility_gesture_three_finger
|
||||||
: R.raw.illustration_accessibility_gesture_two_finger,
|
: R.raw.illustration_accessibility_gesture_two_finger,
|
||||||
gestureSettingsTutorialVideo);
|
gestureSettingsTutorialVideo);
|
||||||
gestureSettingsTutorialMessage.setText(isTouchExploreOn(context)
|
final int stringResId = AccessibilityUtil.isTouchExploreEnabled(context)
|
||||||
?
|
? R.string.accessibility_tutorial_dialog_message_gesture_settings_talkback
|
||||||
R.string.accessibility_tutorial_dialog_message_gesture_settings_with_talkback
|
: R.string.accessibility_tutorial_dialog_message_gesture_settings;
|
||||||
: R.string.accessibility_tutorial_dialog_message_gesture_settings_without_talkback);
|
gestureSettingsTutorialMessage.setText(stringResId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,9 +202,4 @@ public class AccessibilityGestureNavigationTutorial {
|
|||||||
typedArray.recycle();
|
typedArray.recycle();
|
||||||
return colorResId;
|
return colorResId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isTouchExploreOn(Context context) {
|
|
||||||
return ((AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE))
|
|
||||||
.isTouchExplorationEnabled();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ import android.content.Context;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
|
||||||
import androidx.annotation.IntDef;
|
import androidx.annotation.IntDef;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -139,6 +140,12 @@ final class AccessibilityUtil {
|
|||||||
== NAV_BAR_MODE_GESTURAL;
|
== NAV_BAR_MODE_GESTURAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Determines if a touch explore is being used. */
|
||||||
|
public static boolean isTouchExploreEnabled(Context context) {
|
||||||
|
final AccessibilityManager am = context.getSystemService(AccessibilityManager.class);
|
||||||
|
return am.isTouchExplorationEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the corresponding fragment type of a given accessibility service.
|
* Gets the corresponding fragment type of a given accessibility service.
|
||||||
*
|
*
|
||||||
|
@@ -35,10 +35,13 @@ import android.os.UserHandle;
|
|||||||
import android.os.storage.StorageManager;
|
import android.os.storage.StorageManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
import android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
|
||||||
import androidx.preference.PreferenceCategory;
|
import androidx.preference.PreferenceCategory;
|
||||||
@@ -67,6 +70,7 @@ public class ToggleAccessibilityServicePreferenceFragment extends
|
|||||||
|
|
||||||
private static final String KEY_SHORTCUT_PREFERENCE = "shortcut_preference";
|
private static final String KEY_SHORTCUT_PREFERENCE = "shortcut_preference";
|
||||||
private static final String EXTRA_SHORTCUT_TYPE = "shortcut_type";
|
private static final String EXTRA_SHORTCUT_TYPE = "shortcut_type";
|
||||||
|
private TouchExplorationStateChangeListener mTouchExplorationStateChangeListener;
|
||||||
private int mUserShortcutType = UserShortcutType.DEFAULT;
|
private int mUserShortcutType = UserShortcutType.DEFAULT;
|
||||||
// Used to restore the edit dialog status.
|
// Used to restore the edit dialog status.
|
||||||
private int mUserShortcutTypeCache = UserShortcutType.DEFAULT;
|
private int mUserShortcutTypeCache = UserShortcutType.DEFAULT;
|
||||||
@@ -114,6 +118,16 @@ public class ToggleAccessibilityServicePreferenceFragment extends
|
|||||||
mLockPatternUtils = new LockPatternUtils(getActivity());
|
mLockPatternUtils = new LockPatternUtils(getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
mTouchExplorationStateChangeListener = isTouchExplorationEnabled -> {
|
||||||
|
removeDialog(DialogType.EDIT_SHORTCUT);
|
||||||
|
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
||||||
|
};
|
||||||
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
// Restore the user shortcut type.
|
// Restore the user shortcut type.
|
||||||
@@ -122,6 +136,7 @@ public class ToggleAccessibilityServicePreferenceFragment extends
|
|||||||
UserShortcutType.DEFAULT);
|
UserShortcutType.DEFAULT);
|
||||||
}
|
}
|
||||||
initShortcutPreference();
|
initShortcutPreference();
|
||||||
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +149,12 @@ public class ToggleAccessibilityServicePreferenceFragment extends
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
mSettingsContentObserver.register(getContentResolver());
|
mSettingsContentObserver.register(getContentResolver());
|
||||||
|
final AccessibilityManager am = getPrefContext().getSystemService(
|
||||||
|
AccessibilityManager.class);
|
||||||
|
am.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||||
|
|
||||||
updateSwitchBarToggleSwitch();
|
updateSwitchBarToggleSwitch();
|
||||||
updateShortcutPreferenceData();
|
updateShortcutPreferenceData();
|
||||||
updateShortcutPreference();
|
updateShortcutPreference();
|
||||||
@@ -143,6 +163,10 @@ public class ToggleAccessibilityServicePreferenceFragment extends
|
|||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
mSettingsContentObserver.unregister(getContentResolver());
|
mSettingsContentObserver.unregister(getContentResolver());
|
||||||
|
final AccessibilityManager am = getPrefContext().getSystemService(
|
||||||
|
AccessibilityManager.class);
|
||||||
|
am.removeTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||||
|
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,10 +308,13 @@ public class ToggleAccessibilityServicePreferenceFragment extends
|
|||||||
|
|
||||||
private String getShortcutTypeSummary(Context context) {
|
private String getShortcutTypeSummary(Context context) {
|
||||||
final int shortcutType = getUserShortcutType(context, UserShortcutType.SOFTWARE);
|
final int shortcutType = getUserShortcutType(context, UserShortcutType.SOFTWARE);
|
||||||
final CharSequence softwareTitle =
|
int resId = R.string.accessibility_shortcut_edit_dialog_title_software;
|
||||||
context.getText(AccessibilityUtil.isGestureNavigateEnabled(context)
|
if (AccessibilityUtil.isGestureNavigateEnabled(context)) {
|
||||||
? R.string.accessibility_shortcut_edit_dialog_title_software_gesture
|
resId = AccessibilityUtil.isTouchExploreEnabled(context)
|
||||||
: R.string.accessibility_shortcut_edit_dialog_title_software);
|
? R.string.accessibility_shortcut_edit_dialog_title_software_gesture_talkback
|
||||||
|
: R.string.accessibility_shortcut_edit_dialog_title_software_gesture;
|
||||||
|
}
|
||||||
|
final CharSequence softwareTitle = context.getText(resId);
|
||||||
|
|
||||||
List<CharSequence> list = new ArrayList<>();
|
List<CharSequence> list = new ArrayList<>();
|
||||||
if ((shortcutType & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE) {
|
if ((shortcutType & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE) {
|
||||||
|
@@ -31,6 +31,8 @@ import android.text.TextUtils;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
import android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
|
|
||||||
@@ -64,6 +66,7 @@ public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePrefere
|
|||||||
private static final int DIALOG_ID_EDIT_SHORTCUT = 1;
|
private static final int DIALOG_ID_EDIT_SHORTCUT = 1;
|
||||||
private static final String EXTRA_SHORTCUT_TYPE = "shortcut_type";
|
private static final String EXTRA_SHORTCUT_TYPE = "shortcut_type";
|
||||||
private final Handler mHandler = new Handler();
|
private final Handler mHandler = new Handler();
|
||||||
|
private TouchExplorationStateChangeListener mTouchExplorationStateChangeListener;
|
||||||
private SettingsContentObserver mSettingsContentObserver;
|
private SettingsContentObserver mSettingsContentObserver;
|
||||||
private int mUserShortcutType = UserShortcutType.DEFAULT;
|
private int mUserShortcutType = UserShortcutType.DEFAULT;
|
||||||
// Used to restore the edit dialog status.
|
// Used to restore the edit dialog status.
|
||||||
@@ -71,18 +74,6 @@ public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePrefere
|
|||||||
private CheckBox mSoftwareTypeCheckBox;
|
private CheckBox mSoftwareTypeCheckBox;
|
||||||
private CheckBox mHardwareTypeCheckBox;
|
private CheckBox mHardwareTypeCheckBox;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
mSettingsContentObserver.register(getContentResolver());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop() {
|
|
||||||
mSettingsContentObserver.unregister(getContentResolver());
|
|
||||||
super.onStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return SettingsEnums.ACCESSIBILITY_COLOR_INVERSION_SETTINGS;
|
return SettingsEnums.ACCESSIBILITY_COLOR_INVERSION_SETTINGS;
|
||||||
@@ -143,6 +134,11 @@ public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePrefere
|
|||||||
== State.ON);
|
== State.ON);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mTouchExplorationStateChangeListener = isTouchExplorationEnabled -> {
|
||||||
|
removeDialog(DIALOG_ID_EDIT_SHORTCUT);
|
||||||
|
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
||||||
|
};
|
||||||
return super.onCreateView(inflater, container, savedInstanceState);
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,14 +170,30 @@ public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePrefere
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
mSettingsContentObserver.register(getContentResolver());
|
||||||
|
final AccessibilityManager am = getPrefContext().getSystemService(
|
||||||
|
AccessibilityManager.class);
|
||||||
|
am.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||||
|
|
||||||
updateShortcutPreferenceData();
|
updateShortcutPreferenceData();
|
||||||
updateShortcutPreference();
|
updateShortcutPreference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
mSettingsContentObserver.unregister(getContentResolver());
|
||||||
|
final AccessibilityManager am = getPrefContext().getSystemService(
|
||||||
|
AccessibilityManager.class);
|
||||||
|
am.removeTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||||
|
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(int dialogId) {
|
public Dialog onCreateDialog(int dialogId) {
|
||||||
if (dialogId == DIALOG_ID_EDIT_SHORTCUT) {
|
if (dialogId == DIALOG_ID_EDIT_SHORTCUT) {
|
||||||
final CharSequence dialogTitle = getActivity().getString(
|
final CharSequence dialogTitle = getActivity().getText(
|
||||||
R.string.accessibility_shortcut_edit_dialog_title_daltonizer);
|
R.string.accessibility_shortcut_edit_dialog_title_daltonizer);
|
||||||
final AlertDialog dialog = AccessibilityEditDialogUtils.showEditShortcutDialog(
|
final AlertDialog dialog = AccessibilityEditDialogUtils.showEditShortcutDialog(
|
||||||
getActivity(),
|
getActivity(),
|
||||||
@@ -257,10 +269,13 @@ public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePrefere
|
|||||||
|
|
||||||
private String getShortcutTypeSummary(Context context) {
|
private String getShortcutTypeSummary(Context context) {
|
||||||
final int shortcutType = getUserShortcutType(context, UserShortcutType.SOFTWARE);
|
final int shortcutType = getUserShortcutType(context, UserShortcutType.SOFTWARE);
|
||||||
final CharSequence softwareTitle =
|
int resId = R.string.accessibility_shortcut_edit_dialog_title_software;
|
||||||
context.getText(AccessibilityUtil.isGestureNavigateEnabled(context)
|
if (AccessibilityUtil.isGestureNavigateEnabled(context)) {
|
||||||
? R.string.accessibility_shortcut_edit_dialog_title_software_gesture
|
resId = AccessibilityUtil.isTouchExploreEnabled(context)
|
||||||
: R.string.accessibility_shortcut_edit_dialog_title_software);
|
? R.string.accessibility_shortcut_edit_dialog_title_software_gesture_talkback
|
||||||
|
: R.string.accessibility_shortcut_edit_dialog_title_software_gesture;
|
||||||
|
}
|
||||||
|
final CharSequence softwareTitle = context.getText(resId);
|
||||||
|
|
||||||
List<CharSequence> list = new ArrayList<>();
|
List<CharSequence> list = new ArrayList<>();
|
||||||
if ((shortcutType & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE) {
|
if ((shortcutType & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE) {
|
||||||
|
@@ -32,6 +32,8 @@ import android.text.TextUtils;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
import android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
|
|
||||||
@@ -67,6 +69,7 @@ public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePrefe
|
|||||||
private static final int DIALOG_ID_EDIT_SHORTCUT = 1;
|
private static final int DIALOG_ID_EDIT_SHORTCUT = 1;
|
||||||
private static final List<AbstractPreferenceController> sControllers = new ArrayList<>();
|
private static final List<AbstractPreferenceController> sControllers = new ArrayList<>();
|
||||||
private final Handler mHandler = new Handler();
|
private final Handler mHandler = new Handler();
|
||||||
|
private TouchExplorationStateChangeListener mTouchExplorationStateChangeListener;
|
||||||
private SettingsContentObserver mSettingsContentObserver;
|
private SettingsContentObserver mSettingsContentObserver;
|
||||||
private int mUserShortcutType = UserShortcutType.DEFAULT;
|
private int mUserShortcutType = UserShortcutType.DEFAULT;
|
||||||
// Used to restore the edit dialog status.
|
// Used to restore the edit dialog status.
|
||||||
@@ -109,6 +112,11 @@ public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePrefe
|
|||||||
== State.ON);
|
== State.ON);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mTouchExplorationStateChangeListener = isTouchExplorationEnabled -> {
|
||||||
|
removeDialog(DIALOG_ID_EDIT_SHORTCUT);
|
||||||
|
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
||||||
|
};
|
||||||
return super.onCreateView(inflater, container, savedInstanceState);
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,6 +148,12 @@ public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePrefe
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
mSettingsContentObserver.register(getContentResolver());
|
||||||
|
final AccessibilityManager am = getPrefContext().getSystemService(
|
||||||
|
AccessibilityManager.class);
|
||||||
|
am.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||||
|
|
||||||
for (AbstractPreferenceController controller :
|
for (AbstractPreferenceController controller :
|
||||||
buildPreferenceControllers(getPrefContext(), getSettingsLifecycle())) {
|
buildPreferenceControllers(getPrefContext(), getSettingsLifecycle())) {
|
||||||
((DaltonizerRadioButtonPreferenceController) controller).setOnChangeListener(this);
|
((DaltonizerRadioButtonPreferenceController) controller).setOnChangeListener(this);
|
||||||
@@ -152,17 +166,23 @@ public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePrefe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
mSettingsContentObserver.unregister(getContentResolver());
|
||||||
|
final AccessibilityManager am = getPrefContext().getSystemService(
|
||||||
|
AccessibilityManager.class);
|
||||||
|
am.removeTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||||
|
|
||||||
for (AbstractPreferenceController controller :
|
for (AbstractPreferenceController controller :
|
||||||
buildPreferenceControllers(getPrefContext(), getSettingsLifecycle())) {
|
buildPreferenceControllers(getPrefContext(), getSettingsLifecycle())) {
|
||||||
((DaltonizerRadioButtonPreferenceController) controller).setOnChangeListener(null);
|
((DaltonizerRadioButtonPreferenceController) controller).setOnChangeListener(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(int dialogId) {
|
public Dialog onCreateDialog(int dialogId) {
|
||||||
if (dialogId == DIALOG_ID_EDIT_SHORTCUT) {
|
if (dialogId == DIALOG_ID_EDIT_SHORTCUT) {
|
||||||
final CharSequence dialogTitle = getActivity().getString(
|
final CharSequence dialogTitle = getActivity().getText(
|
||||||
R.string.accessibility_shortcut_edit_dialog_title_daltonizer);
|
R.string.accessibility_shortcut_edit_dialog_title_daltonizer);
|
||||||
final AlertDialog dialog = AccessibilityEditDialogUtils.showEditShortcutDialog(
|
final AlertDialog dialog = AccessibilityEditDialogUtils.showEditShortcutDialog(
|
||||||
getActivity(),
|
getActivity(),
|
||||||
@@ -238,10 +258,13 @@ public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePrefe
|
|||||||
|
|
||||||
private String getShortcutTypeSummary(Context context) {
|
private String getShortcutTypeSummary(Context context) {
|
||||||
final int shortcutType = getUserShortcutType(context, UserShortcutType.SOFTWARE);
|
final int shortcutType = getUserShortcutType(context, UserShortcutType.SOFTWARE);
|
||||||
final CharSequence softwareTitle =
|
int resId = R.string.accessibility_shortcut_edit_dialog_title_software;
|
||||||
context.getText(AccessibilityUtil.isGestureNavigateEnabled(context)
|
if (AccessibilityUtil.isGestureNavigateEnabled(context)) {
|
||||||
? R.string.accessibility_shortcut_edit_dialog_title_software_gesture
|
resId = AccessibilityUtil.isTouchExploreEnabled(context)
|
||||||
: R.string.accessibility_shortcut_edit_dialog_title_software);
|
? R.string.accessibility_shortcut_edit_dialog_title_software_gesture_talkback
|
||||||
|
: R.string.accessibility_shortcut_edit_dialog_title_software_gesture;
|
||||||
|
}
|
||||||
|
final CharSequence softwareTitle = context.getText(resId);
|
||||||
|
|
||||||
List<CharSequence> list = new ArrayList<>();
|
List<CharSequence> list = new ArrayList<>();
|
||||||
if ((shortcutType & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE) {
|
if ((shortcutType & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE) {
|
||||||
@@ -288,18 +311,6 @@ public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePrefe
|
|||||||
getShortcutTypeSummary(getPrefContext()));
|
getShortcutTypeSummary(getPrefContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
mSettingsContentObserver.register(getContentResolver());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop() {
|
|
||||||
mSettingsContentObserver.unregister(getContentResolver());
|
|
||||||
super.onStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return SettingsEnums.ACCESSIBILITY_TOGGLE_DALTONIZER;
|
return SettingsEnums.ACCESSIBILITY_TOGGLE_DALTONIZER;
|
||||||
|
@@ -33,8 +33,12 @@ import android.net.Uri;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||||
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
import android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.RelativeLayout.LayoutParams;
|
import android.widget.RelativeLayout.LayoutParams;
|
||||||
@@ -65,6 +69,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
private static final String SETTINGS_KEY = "screen_magnification_settings";
|
private static final String SETTINGS_KEY = "screen_magnification_settings";
|
||||||
private static final String EXTRA_SHORTCUT_TYPE = "shortcut_type";
|
private static final String EXTRA_SHORTCUT_TYPE = "shortcut_type";
|
||||||
private static final String KEY_SHORTCUT_PREFERENCE = "shortcut_preference";
|
private static final String KEY_SHORTCUT_PREFERENCE = "shortcut_preference";
|
||||||
|
private TouchExplorationStateChangeListener mTouchExplorationStateChangeListener;
|
||||||
private int mUserShortcutType = UserShortcutType.DEFAULT;
|
private int mUserShortcutType = UserShortcutType.DEFAULT;
|
||||||
// Used to restore the edit dialog status.
|
// Used to restore the edit dialog status.
|
||||||
private int mUserShortcutTypeCache = UserShortcutType.DEFAULT;
|
private int mUserShortcutTypeCache = UserShortcutType.DEFAULT;
|
||||||
@@ -164,6 +169,16 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
getActivity().setTitle(R.string.accessibility_screen_magnification_title);
|
getActivity().setTitle(R.string.accessibility_screen_magnification_title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
mTouchExplorationStateChangeListener = isTouchExplorationEnabled -> {
|
||||||
|
removeDialog(DialogType.EDIT_SHORTCUT);
|
||||||
|
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
||||||
|
};
|
||||||
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
final PreferenceScreen preferenceScreen = getPreferenceManager().getPreferenceScreen();
|
final PreferenceScreen preferenceScreen = getPreferenceManager().getPreferenceScreen();
|
||||||
@@ -174,6 +189,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
preferenceScreen.addPreference(mVideoPreference);
|
preferenceScreen.addPreference(mVideoPreference);
|
||||||
|
|
||||||
initShortcutPreference();
|
initShortcutPreference();
|
||||||
|
|
||||||
mSettingsPreference = new Preference(getPrefContext());
|
mSettingsPreference = new Preference(getPrefContext());
|
||||||
mSettingsPreference.setTitle(R.string.accessibility_magnification_service_settings_title);
|
mSettingsPreference.setTitle(R.string.accessibility_magnification_service_settings_title);
|
||||||
mSettingsPreference.setKey(SETTINGS_KEY);
|
mSettingsPreference.setKey(SETTINGS_KEY);
|
||||||
@@ -206,6 +222,10 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
final AccessibilityManager am = getPrefContext().getSystemService(
|
||||||
|
AccessibilityManager.class);
|
||||||
|
am.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||||
|
|
||||||
VideoView videoView = (VideoView) getView().findViewById(R.id.video);
|
VideoView videoView = (VideoView) getView().findViewById(R.id.video);
|
||||||
if (videoView != null) {
|
if (videoView != null) {
|
||||||
videoView.start();
|
videoView.start();
|
||||||
@@ -216,6 +236,15 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
updateShortcutPreference();
|
updateShortcutPreference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
final AccessibilityManager am = getPrefContext().getSystemService(
|
||||||
|
AccessibilityManager.class);
|
||||||
|
am.removeTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||||
|
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(int dialogId) {
|
public Dialog onCreateDialog(int dialogId) {
|
||||||
switch (dialogId) {
|
switch (dialogId) {
|
||||||
@@ -226,7 +255,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
return AccessibilityGestureNavigationTutorial
|
return AccessibilityGestureNavigationTutorial
|
||||||
.showAccessibilityButtonTutorialDialog(getActivity());
|
.showAccessibilityButtonTutorialDialog(getActivity());
|
||||||
case DialogType.EDIT_SHORTCUT:
|
case DialogType.EDIT_SHORTCUT:
|
||||||
final CharSequence dialogTitle = getActivity().getString(
|
final CharSequence dialogTitle = getActivity().getText(
|
||||||
R.string.accessibility_shortcut_edit_dialog_title_magnification);
|
R.string.accessibility_shortcut_edit_dialog_title_magnification);
|
||||||
final AlertDialog dialog =
|
final AlertDialog dialog =
|
||||||
AccessibilityEditDialogUtils.showMagnificationEditShortcutDialog(
|
AccessibilityEditDialogUtils.showMagnificationEditShortcutDialog(
|
||||||
@@ -323,10 +352,13 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
|
|
||||||
private String getShortcutTypeSummary(Context context) {
|
private String getShortcutTypeSummary(Context context) {
|
||||||
final int shortcutType = getUserShortcutType(context, UserShortcutType.DEFAULT);
|
final int shortcutType = getUserShortcutType(context, UserShortcutType.DEFAULT);
|
||||||
final CharSequence softwareTitle =
|
int resId = R.string.accessibility_shortcut_edit_dialog_title_software;
|
||||||
context.getText(AccessibilityUtil.isGestureNavigateEnabled(context)
|
if (AccessibilityUtil.isGestureNavigateEnabled(context)) {
|
||||||
? R.string.accessibility_shortcut_edit_dialog_title_software_gesture
|
resId = AccessibilityUtil.isTouchExploreEnabled(context)
|
||||||
: R.string.accessibility_shortcut_edit_dialog_title_software);
|
? R.string.accessibility_shortcut_edit_dialog_title_software_gesture_talkback
|
||||||
|
: R.string.accessibility_shortcut_edit_dialog_title_software_gesture;
|
||||||
|
}
|
||||||
|
final CharSequence softwareTitle = context.getText(resId);
|
||||||
|
|
||||||
List<CharSequence> list = new ArrayList<>();
|
List<CharSequence> list = new ArrayList<>();
|
||||||
if ((shortcutType & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE) {
|
if ((shortcutType & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE) {
|
||||||
|
Reference in New Issue
Block a user