From e32c17580e5ca3d985204495640c9096f1bde856 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Mon, 27 Jul 2015 17:48:02 -0700 Subject: Don't use screenshot if structure is disabled (2/2) Bug: 22674955 Change-Id: I78208a4c746e3a501fe264918607ef94f64a8034 --- src/com/android/settings/applications/ManageAssist.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/com/android') diff --git a/src/com/android/settings/applications/ManageAssist.java b/src/com/android/settings/applications/ManageAssist.java index de69bb6..f1d70ee 100644 --- a/src/com/android/settings/applications/ManageAssist.java +++ b/src/com/android/settings/applications/ManageAssist.java @@ -20,6 +20,7 @@ import android.app.AlertDialog; import android.content.ComponentName; import android.content.DialogInterface; import android.os.Bundle; +import android.os.Handler; import android.preference.Preference; import android.preference.SwitchPreference; import android.provider.Settings; @@ -45,6 +46,7 @@ public class ManageAssist extends SettingsPreferenceFragment private SwitchPreference mContextPref; private SwitchPreference mScreenshotPref; private VoiceInputListPreference mVoiceInputPref; + private Handler mHandler = new Handler(); @Override public void onCreate(Bundle icicle) { @@ -78,6 +80,7 @@ public class ManageAssist extends SettingsPreferenceFragment if (preference == mContextPref) { Settings.Secure.putInt(getContentResolver(), Settings.Secure.ASSIST_STRUCTURE_ENABLED, (boolean) newValue ? 1 : 0); + postUpdateUi(); return true; } if (preference == mScreenshotPref) { @@ -102,6 +105,15 @@ public class ManageAssist extends SettingsPreferenceFragment return false; } + private void postUpdateUi() { + mHandler.post(new Runnable() { + @Override + public void run() { + updateUi(); + } + }); + } + private void updateUi() { mDefaultAssitPref.refreshAssistApps(); mVoiceInputPref.refreshVoiceInputs(); @@ -122,6 +134,11 @@ public class ManageAssist extends SettingsPreferenceFragment getPreferenceScreen().addPreference(mVoiceInputPref); mVoiceInputPref.setAssistRestrict(currentAssist); } + + mScreenshotPref.setEnabled(mContextPref.isChecked()); + if (!mContextPref.isChecked()) { + mScreenshotPref.setChecked(false); + } } private boolean isCurrentAssistVoiceService() { -- cgit v1.1