Merge "Revert "Add the settings content observer for shortcut preference."" into rvc-dev am: 9ae5b47aee
am: 546c130e8d
am: f37eaffefc
am: aaf5e96718
Change-Id: I24e5a98e21353250b54e56ef3fe4dd62928b3b5e
This commit is contained in:
@@ -30,7 +30,6 @@ import android.content.pm.ResolveInfo;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
@@ -97,7 +96,6 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
private int mUserShortcutTypes = UserShortcutType.EMPTY;
|
private int mUserShortcutTypes = UserShortcutType.EMPTY;
|
||||||
private CheckBox mSoftwareTypeCheckBox;
|
private CheckBox mSoftwareTypeCheckBox;
|
||||||
private CheckBox mHardwareTypeCheckBox;
|
private CheckBox mHardwareTypeCheckBox;
|
||||||
private SettingsContentObserver mSettingsContentObserver;
|
|
||||||
|
|
||||||
// For html description of accessibility service, must follow the rule, such as
|
// For html description of accessibility service, must follow the rule, such as
|
||||||
// <img src="R.drawable.fileName"/>, a11y settings will get the resources successfully.
|
// <img src="R.drawable.fileName"/>, a11y settings will get the resources successfully.
|
||||||
@@ -135,17 +133,6 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
removeDialog(DialogEnums.EDIT_SHORTCUT);
|
removeDialog(DialogEnums.EDIT_SHORTCUT);
|
||||||
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
||||||
};
|
};
|
||||||
|
|
||||||
final List<String> shortcutFeatureKeys = new ArrayList<>();
|
|
||||||
shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
|
|
||||||
shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
|
|
||||||
mSettingsContentObserver = new SettingsContentObserver(new Handler(), shortcutFeatureKeys) {
|
|
||||||
@Override
|
|
||||||
public void onChange(boolean selfChange, Uri uri) {
|
|
||||||
updateShortcutPreferenceData();
|
|
||||||
updateShortcutPreference();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return super.onCreateView(inflater, container, savedInstanceState);
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +229,6 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
final AccessibilityManager am = getPrefContext().getSystemService(
|
final AccessibilityManager am = getPrefContext().getSystemService(
|
||||||
AccessibilityManager.class);
|
AccessibilityManager.class);
|
||||||
am.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
am.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||||
mSettingsContentObserver.register(getContentResolver());
|
|
||||||
updateShortcutPreferenceData();
|
updateShortcutPreferenceData();
|
||||||
updateShortcutPreference();
|
updateShortcutPreference();
|
||||||
}
|
}
|
||||||
@@ -252,7 +238,6 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
final AccessibilityManager am = getPrefContext().getSystemService(
|
final AccessibilityManager am = getPrefContext().getSystemService(
|
||||||
AccessibilityManager.class);
|
AccessibilityManager.class);
|
||||||
am.removeTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
am.removeTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||||
mSettingsContentObserver.unregister(getContentResolver());
|
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -633,7 +618,7 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
getShortcutTypeSummary(getPrefContext()));
|
getShortcutTypeSummary(getPrefContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateShortcutPreferenceData() {
|
private void updateShortcutPreferenceData() {
|
||||||
if (mComponentName == null) {
|
if (mComponentName == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -666,7 +651,7 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
mShortcutPreference.setTitle(title);
|
mShortcutPreference.setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateShortcutPreference() {
|
private void updateShortcutPreference() {
|
||||||
if (mComponentName == null) {
|
if (mComponentName == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -472,8 +472,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
showDialog(DialogEnums.MAGNIFICATION_EDIT_SHORTCUT);
|
showDialog(DialogEnums.MAGNIFICATION_EDIT_SHORTCUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void updateShortcutPreferenceData() {
|
||||||
protected void updateShortcutPreferenceData() {
|
|
||||||
// Get the user shortcut type from settings provider.
|
// Get the user shortcut type from settings provider.
|
||||||
mUserShortcutType = getUserShortcutTypeFromSettings(getPrefContext());
|
mUserShortcutType = getUserShortcutTypeFromSettings(getPrefContext());
|
||||||
if (mUserShortcutType != UserShortcutType.EMPTY) {
|
if (mUserShortcutType != UserShortcutType.EMPTY) {
|
||||||
@@ -495,8 +494,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
mShortcutPreference.setTitle(title);
|
mShortcutPreference.setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void updateShortcutPreference() {
|
||||||
protected void updateShortcutPreference() {
|
|
||||||
final int shortcutTypes = getUserShortcutTypes(getPrefContext(), UserShortcutType.SOFTWARE);
|
final int shortcutTypes = getUserShortcutTypes(getPrefContext(), UserShortcutType.SOFTWARE);
|
||||||
mShortcutPreference.setChecked(
|
mShortcutPreference.setChecked(
|
||||||
hasMagnificationValuesInSettings(getPrefContext(), shortcutTypes));
|
hasMagnificationValuesInSettings(getPrefContext(), shortcutTypes));
|
||||||
|
Reference in New Issue
Block a user