Bug 1010268 - Don't adjust default panel check for "Add panel" item. r=liuche, a=lsblakk
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Fri, 16 May 2014 09:50:30 +0100
changeset 192317 e1174b7947c9
parent 192316 d5fb33c4194e
child 192318 18d40554e01f
push id3567
push userryanvm@gmail.com
push date2014-05-20 15:05 +0000
Treeherderresults
reviewersliuche, lsblakk
bugs1010268
milestone30.0
Bug 1010268 - Don't adjust default panel check for "Add panel" item. r=liuche, a=lsblakk
mobile/android/base/preferences/PanelsPreferenceCategory.java
--- a/mobile/android/base/preferences/PanelsPreferenceCategory.java
+++ b/mobile/android/base/preferences/PanelsPreferenceCategory.java
@@ -68,24 +68,17 @@ public class PanelsPreferenceCategory ex
         };
         mLoadTask.execute();
     }
 
     /**
      * Reload the Home Panels list from HomeConfig.
      */
     public void refresh() {
-        // Clear all the existing home panels, but leave the
-        // first item (Add panels).
-        int prefCount = getPreferenceCount();
-        while (prefCount > 1) {
-            removePreference(getPreference(1));
-            prefCount--;
-        }
-
+        removeAll();
         loadHomeConfig();
     }
 
     private void displayHomeConfig(HomeConfig.State configState) {
         for (PanelConfig panelConfig : configState) {
             final boolean isRemovable = panelConfig.isDynamic();
 
             // Create and add the pref.
@@ -107,18 +100,17 @@ public class PanelsPreferenceCategory ex
         final String defaultPanelId = mConfigEditor.getDefaultPanelId();
         if (defaultPanelId == null) {
             mDefaultReference = null;
             return;
         }
 
         final int prefCount = getPreferenceCount();
 
-        // First preference (index 0) is Preference to add panels.
-        for (int i = 1; i < prefCount; i++) {
+        for (int i = 0; i < prefCount; i++) {
             final PanelsPreference pref = (PanelsPreference) getPreference(i);
 
             if (defaultPanelId.equals(pref.getKey())) {
                 super.setDefault(pref);
                 break;
             }
         }
     }