Merge "Refactored Screenshot preference to be dependent on context preference."

This commit is contained in:
TreeHugger Robot
2016-08-24 01:37:56 +00:00
committed by Android (Google) Code Review
2 changed files with 1 additions and 10 deletions

View File

@@ -33,6 +33,7 @@
<SwitchPreference <SwitchPreference
android:key="screenshot" android:key="screenshot"
android:dependency="context"
android:title="@string/assist_access_screenshot_title" android:title="@string/assist_access_screenshot_title"
android:summary="@string/assist_access_screenshot_summary"/> android:summary="@string/assist_access_screenshot_summary"/>

View File

@@ -84,7 +84,6 @@ public class ManageAssist extends SettingsPreferenceFragment
Settings.Secure.putInt(getContentResolver(), Settings.Secure.ASSIST_STRUCTURE_ENABLED, Settings.Secure.putInt(getContentResolver(), Settings.Secure.ASSIST_STRUCTURE_ENABLED,
(boolean) newValue ? 1 : 0); (boolean) newValue ? 1 : 0);
mHandler.post(() -> { mHandler.post(() -> {
guardScreenshotPref();
guardFlashPref(); guardFlashPref();
}); });
return true; return true;
@@ -116,14 +115,6 @@ public class ManageAssist extends SettingsPreferenceFragment
return false; return false;
} }
private void guardScreenshotPref() {
boolean isChecked = mContextPref.isChecked();
boolean screenshotPrefWasSet = Settings.Secure.getInt(
getContentResolver(), Settings.Secure.ASSIST_SCREENSHOT_ENABLED, 1) != 0;
mScreenshotPref.setEnabled(isChecked);
mScreenshotPref.setChecked(isChecked && screenshotPrefWasSet);
}
private void guardFlashPref() { private void guardFlashPref() {
ComponentName assistant = mDefaultAssitPref.getCurrentAssist(); ComponentName assistant = mDefaultAssitPref.getCurrentAssist();
@@ -163,7 +154,6 @@ public class ManageAssist extends SettingsPreferenceFragment
mVoiceInputPref.setAssistRestrict(currentAssist); mVoiceInputPref.setAssistRestrict(currentAssist);
} }
guardScreenshotPref();
guardFlashPref(); guardFlashPref();
} }