Bug 1224010 - Add UI Telemetry for setting a homepage. r=mfinkle,margaret, a=ritu
authorVarun Joshi <varunj.1011@gmail.com>
Fri, 27 Nov 2015 03:11:00 +0100
changeset 305670 a3d6c1d78c443d276869fbd2fc3921547632207a
parent 305669 c8917edc60508ce3854e2aaa585289dd06b43d07
child 305671 c38e578502c0f3c70d5ec7dbd4b01ec1e804c92f
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, margaret, ritu
bugs1224010
milestone44.0a2
Bug 1224010 - Add UI Telemetry for setting a homepage. r=mfinkle,margaret, a=ritu
mobile/android/base/preferences/GeckoPreferences.java
--- a/mobile/android/base/preferences/GeckoPreferences.java
+++ b/mobile/android/base/preferences/GeckoPreferences.java
@@ -904,23 +904,17 @@ OnSharedPreferenceChangeListener
                     if (!AppConstants.NIGHTLY_BUILD) {
                         preferences.removePreference(pref);
                         i--;
                         continue;
                     }
                 } else if (PREFS_HOMEPAGE.equals(key)) {
                     String setUrl = GeckoSharedPrefs.forProfile(getBaseContext()).getString(PREFS_HOMEPAGE, AboutPages.HOME);
                     setHomePageSummary(pref, setUrl);
-                    pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
-                        @Override
-                        public boolean onPreferenceChange(final Preference preference, final Object newValue) {
-                            setHomePageSummary(pref, String.valueOf(newValue));
-                            return true;
-                        }
-                    });
+                    pref.setOnPreferenceChangeListener(this);
                 } else if (PREFS_FAQ_LINK.equals(key)) {
                     // Format the FAQ link
                     final String VERSION = AppConstants.MOZ_APP_VERSION;
                     final String OS = AppConstants.OS_TARGET;
                     final String LOCALE = Locales.getLanguageTag(Locale.getDefault());
 
                     final String url = getResources().getString(R.string.faq_link, VERSION, OS, LOCALE);
                     ((LinkPreference) pref).setUrl(url);
@@ -1230,16 +1224,20 @@ OnSharedPreferenceChangeListener
         if (PREFS_MP_ENABLED.equals(prefName)) {
             showDialog((Boolean) newValue ? DIALOG_CREATE_MASTER_PASSWORD : DIALOG_REMOVE_MASTER_PASSWORD);
 
             // We don't want the "use master password" pref to change until the
             // user has gone through the dialog.
             return false;
         }
 
+        if (PREFS_HOMEPAGE.equals(prefName)) {
+            setHomePageSummary(preference, String.valueOf(newValue));
+        }
+
         if (PREFS_BROWSER_LOCALE.equals(prefName)) {
             // Even though this is a list preference, we don't want to handle it
             // below, so we return here.
             return onLocaleSelected(Locales.getLanguageTag(lastLocale), (String) newValue);
         }
 
         if (PREFS_MENU_CHAR_ENCODING.equals(prefName)) {
             setCharEncodingState(((String) newValue).equals("true"));