Merge "Revising the function name related to user shortcut type." into rvc-dev am: eb04ef4f75 am: 4c7a690479 am: be6265865c am: 53bf408b10 am: 4ef910ce6c

Change-Id: I87157d34786e5ff5fe5d1442ddfb9ac284ffa931
This commit is contained in:
PETER LIANG
2020-04-15 23:55:30 +00:00
committed by Automerger Merge Worker
4 changed files with 51 additions and 51 deletions

View File

@@ -197,7 +197,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putInt(EXTRA_SHORTCUT_TYPE, mUserShortcutTypeCache);
outState.putInt(EXTRA_SHORTCUT_TYPE, mUserShortcutTypesCache);
super.onSaveInstanceState(outState);
}
@@ -286,7 +286,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
}
private void updateAlertDialogCheckState() {
if (mUserShortcutTypeCache != UserShortcutType.EMPTY) {
if (mUserShortcutTypesCache != UserShortcutType.EMPTY) {
updateCheckStatus(mSoftwareTypeCheckBox, UserShortcutType.SOFTWARE);
updateCheckStatus(mHardwareTypeCheckBox, UserShortcutType.HARDWARE);
updateCheckStatus(mTripleTapTypeCheckBox, UserShortcutType.TRIPLETAP);
@@ -294,32 +294,32 @@ public class ToggleScreenMagnificationPreferenceFragment extends
}
private void updateCheckStatus(CheckBox checkBox, @UserShortcutType int type) {
checkBox.setChecked((mUserShortcutTypeCache & type) == type);
checkBox.setChecked((mUserShortcutTypesCache & type) == type);
}
private void updateUserShortcutType(boolean saveChanges) {
mUserShortcutTypeCache = UserShortcutType.EMPTY;
mUserShortcutTypesCache = UserShortcutType.EMPTY;
if (mSoftwareTypeCheckBox.isChecked()) {
mUserShortcutTypeCache |= UserShortcutType.SOFTWARE;
mUserShortcutTypesCache |= UserShortcutType.SOFTWARE;
}
if (mHardwareTypeCheckBox.isChecked()) {
mUserShortcutTypeCache |= UserShortcutType.HARDWARE;
mUserShortcutTypesCache |= UserShortcutType.HARDWARE;
}
if (mTripleTapTypeCheckBox.isChecked()) {
mUserShortcutTypeCache |= UserShortcutType.TRIPLETAP;
mUserShortcutTypesCache |= UserShortcutType.TRIPLETAP;
}
if (saveChanges) {
final boolean isChanged = (mUserShortcutTypeCache != UserShortcutType.EMPTY);
final boolean isChanged = (mUserShortcutTypesCache != UserShortcutType.EMPTY);
if (isChanged) {
setUserShortcutType(getPrefContext(), mUserShortcutTypeCache);
setUserShortcutType(getPrefContext(), mUserShortcutTypesCache);
}
mUserShortcutType = mUserShortcutTypeCache;
mUserShortcutType = mUserShortcutTypesCache;
}
}
private void setUserShortcutType(Context context, int type) {
Set<String> info = SharedPreferenceUtils.getUserShortcutType(context);
Set<String> info = SharedPreferenceUtils.getUserShortcutTypes(context);
if (info.isEmpty()) {
info = new HashSet<>();
} else {
@@ -340,7 +340,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
return context.getText(R.string.switch_off_text);
}
final int shortcutType = getUserShortcutType(context, UserShortcutType.EMPTY);
final int shortcutType = getUserShortcutTypes(context, UserShortcutType.EMPTY);
int resId = R.string.accessibility_shortcut_edit_summary_software;
if (AccessibilityUtil.isGestureNavigateEnabled(context)) {
resId = AccessibilityUtil.isTouchExploreEnabled(context)
@@ -374,8 +374,8 @@ public class ToggleScreenMagnificationPreferenceFragment extends
}
@Override
protected int getUserShortcutType(Context context, @UserShortcutType int defaultValue) {
final Set<String> info = SharedPreferenceUtils.getUserShortcutType(context);
protected int getUserShortcutTypes(Context context, @UserShortcutType int defaultValue) {
final Set<String> info = SharedPreferenceUtils.getUserShortcutTypes(context);
final Set<String> filtered = info.stream().filter(
str -> str.contains(MAGNIFICATION_CONTROLLER_NAME)).collect(
Collectors.toSet());
@@ -451,7 +451,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
@Override
public void onToggleClicked(ShortcutPreference preference) {
final int shortcutTypes = getUserShortcutType(getPrefContext(), UserShortcutType.SOFTWARE);
final int shortcutTypes = getUserShortcutTypes(getPrefContext(), UserShortcutType.SOFTWARE);
if (preference.isChecked()) {
optInAllMagnificationValuesToSettings(getPrefContext(), shortcutTypes);
} else {
@@ -463,8 +463,8 @@ public class ToggleScreenMagnificationPreferenceFragment extends
@Override
public void onSettingsClicked(ShortcutPreference preference) {
// Do not restore shortcut in shortcut chooser dialog when shortcutPreference is turned off.
mUserShortcutTypeCache = mShortcutPreference.isChecked()
? getUserShortcutType(getPrefContext(), UserShortcutType.SOFTWARE)
mUserShortcutTypesCache = mShortcutPreference.isChecked()
? getUserShortcutTypes(getPrefContext(), UserShortcutType.SOFTWARE)
: UserShortcutType.EMPTY;
showDialog(DialogEnums.MAGNIFICATION_EDIT_SHORTCUT);
}
@@ -476,7 +476,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
setUserShortcutType(getPrefContext(), mUserShortcutType);
} else {
// Get the user shortcut type from shared_prefs if cannot get from settings provider.
mUserShortcutType = getUserShortcutType(getPrefContext(), UserShortcutType.SOFTWARE);
mUserShortcutType = getUserShortcutTypes(getPrefContext(), UserShortcutType.SOFTWARE);
}
}
@@ -492,7 +492,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
}
private void updateShortcutPreference() {
final int shortcutTypes = getUserShortcutType(getPrefContext(), UserShortcutType.SOFTWARE);
final int shortcutTypes = getUserShortcutTypes(getPrefContext(), UserShortcutType.SOFTWARE);
mShortcutPreference.setChecked(
hasMagnificationValuesInSettings(getPrefContext(), shortcutTypes));
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));