diff options
-rw-r--r-- | src/com/android/settings/applications/ManageAssist.java | 17 |
1 files changed, 17 insertions, 0 deletions
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() { |