Refactored Screenshot preference to be dependent on context preference.
Tests: Manual. Change-Id: I2fde1a67ade4bf89bf38b4eae0ca98074cca868c Fixes: 30681087
This commit is contained in:
@@ -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"/>
|
||||||
|
|
||||||
|
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user