summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/preferences
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-05-24 15:32:59 -0700
committerJohn Reck <jreck@google.com>2011-05-24 15:52:27 -0700
commit92935a725584211fcd14a99ee4b64b1da25ea61b (patch)
tree3adad55443b87bdbcb893af9058361a52746321c /src/com/android/browser/preferences
parentaec5b0930dae41b4d1a0e844dc53c4dd6c66ff07 (diff)
downloadpackages_apps_Browser-92935a725584211fcd14a99ee4b64b1da25ea61b.zip
packages_apps_Browser-92935a725584211fcd14a99ee4b64b1da25ea61b.tar.gz
packages_apps_Browser-92935a725584211fcd14a99ee4b64b1da25ea61b.tar.bz2
Help dialog for useragent switcher lab
Change-Id: I1126f2dae652a36a133aa85a3a8aa823ab875b7b
Diffstat (limited to 'src/com/android/browser/preferences')
-rw-r--r--src/com/android/browser/preferences/LabPreferencesFragment.java31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/com/android/browser/preferences/LabPreferencesFragment.java b/src/com/android/browser/preferences/LabPreferencesFragment.java
index f99b96d..d9ef3df 100644
--- a/src/com/android/browser/preferences/LabPreferencesFragment.java
+++ b/src/com/android/browser/preferences/LabPreferencesFragment.java
@@ -22,11 +22,14 @@ import com.android.browser.PreferenceKeys;
import com.android.browser.R;
import com.android.browser.search.SearchEngine;
+import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceFragment;
+import android.view.LayoutInflater;
+import android.view.View;
public class LabPreferencesFragment extends PreferenceFragment
implements OnPreferenceChangeListener {
@@ -41,12 +44,16 @@ public class LabPreferencesFragment extends PreferenceFragment
// Load the XML preferences file
addPreferencesFromResource(R.xml.lab_preferences);
+ registerChangeListener(PreferenceKeys.PREF_ENABLE_QUICK_CONTROLS);
+ registerChangeListener(PreferenceKeys.PREF_ENABLE_USERAGENT_SWITCHER);
+ useInstantPref = findPreference(PreferenceKeys.PREF_USE_INSTANT_SEARCH);
+ }
- Preference e = findPreference(PreferenceKeys.PREF_ENABLE_QUICK_CONTROLS);
+ private void registerChangeListener(String key) {
+ Preference e = findPreference(key);
if (e != null) {
e.setOnPreferenceChangeListener(this);
}
- useInstantPref = findPreference(PreferenceKeys.PREF_USE_INSTANT_SEARCH);
}
@Override
@@ -68,9 +75,23 @@ public class LabPreferencesFragment extends PreferenceFragment
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
- // Attempt to restart
- startActivity(new Intent(BrowserActivity.ACTION_RESTART, null,
- getActivity(), BrowserActivity.class));
+ String key = preference.getKey();
+ if (PreferenceKeys.PREF_ENABLE_QUICK_CONTROLS.equals(key)) {
+ // Attempt to restart
+ startActivity(new Intent(BrowserActivity.ACTION_RESTART, null,
+ getActivity(), BrowserActivity.class));
+ }
+ if (PreferenceKeys.PREF_ENABLE_USERAGENT_SWITCHER.equals(key)) {
+ if ((Boolean)newValue) {
+ // Show the help
+ LayoutInflater inflater = LayoutInflater.from(getActivity());
+ View content = inflater.inflate(R.layout.help_dialog_useragent_switcher, null);
+ new AlertDialog.Builder(getActivity())
+ .setView(content)
+ .setNeutralButton(android.R.string.ok, null)
+ .show();
+ }
+ }
return true;
}
}