summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-05-24 15:53:07 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-05-24 15:53:07 -0700
commit45377778b556064718b61c9495ae5bdc900fd996 (patch)
tree4743c5e054de7c2a1a3d0e60cfbe876fa8ad0865 /src/com/android/browser
parentb0a86db3bfa39863977efd3bac5c9bf527d224aa (diff)
parent92935a725584211fcd14a99ee4b64b1da25ea61b (diff)
downloadpackages_apps_Browser-45377778b556064718b61c9495ae5bdc900fd996.zip
packages_apps_Browser-45377778b556064718b61c9495ae5bdc900fd996.tar.gz
packages_apps_Browser-45377778b556064718b61c9495ae5bdc900fd996.tar.bz2
Merge "Help dialog for useragent switcher lab"
Diffstat (limited to 'src/com/android/browser')
-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;
}
}