Bug 917350 - Move loader init() implementation to SearchLoader. r=margaret, a=lsblakk
authorLucas Rocha <lucasr@mozilla.com>
Wed, 16 Oct 2013 10:30:39 +0100
changeset 160774 d0abcb6e1fffb511c2161af3bfb8f13601b2008c
parent 160773 1e866af000e82df91090a175b40f041c0ae79261
child 160775 225a25c01d0950c55abcb1cea67dc5dfe5dad366
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret, lsblakk
bugs917350
milestone26.0a2
Bug 917350 - Move loader init() implementation to SearchLoader. r=margaret, a=lsblakk
mobile/android/base/home/BrowserSearch.java
mobile/android/base/home/SearchLoader.java
--- a/mobile/android/base/home/BrowserSearch.java
+++ b/mobile/android/base/home/BrowserSearch.java
@@ -309,17 +309,17 @@ public class BrowserSearch extends HomeF
                     setSearchEngines(message);
                 }
             });
         }
     }
 
     @Override
     protected void load() {
-        getLoaderManager().initLoader(LOADER_ID_SEARCH, null, mCursorLoaderCallbacks);
+        SearchLoader.init(getLoaderManager(), LOADER_ID_SEARCH, mCursorLoaderCallbacks, mSearchTerm, false);
     }
 
     private void handleAutocomplete(String searchTerm, Cursor c) {
         if (TextUtils.isEmpty(mSearchTerm) || c == null || mAutocompleteHandler == null) {
             return;
         }
 
         // Avoid searching the path if we don't have to. Currently just
--- a/mobile/android/base/home/SearchLoader.java
+++ b/mobile/android/base/home/SearchLoader.java
@@ -41,16 +41,22 @@ class SearchLoader {
     private static Bundle createArgs(String searchTerm, boolean performEmptySearch) {
         Bundle args = new Bundle();
         args.putString(SearchLoader.KEY_SEARCH_TERM, searchTerm);
         args.putBoolean(SearchLoader.KEY_PERFORM_EMPTY_SEARCH, performEmptySearch);
 
         return args;
     }
 
+    public static void init(LoaderManager manager, int loaderId,
+                               LoaderCallbacks<Cursor> callbacks, String searchTerm, boolean performEmptySearch) {
+        Bundle args = createArgs(searchTerm, performEmptySearch);
+        manager.initLoader(loaderId, args, callbacks);
+    }
+
     public static void restart(LoaderManager manager, int loaderId,
                                LoaderCallbacks<Cursor> callbacks, String searchTerm) {
         restart(manager, loaderId, callbacks, searchTerm, true);
     }
 
     public static void restart(LoaderManager manager, int loaderId,
                                LoaderCallbacks<Cursor> callbacks, String searchTerm, boolean performEmptySearch) {
         Bundle args = createArgs(searchTerm, performEmptySearch);