Bug 917350 - Factor out method to create SearchLoader arguments. r=margaret, a=lsblakk
authorLucas Rocha <lucasr@mozilla.com>
Wed, 16 Oct 2013 10:30:39 +0100
changeset 155850 1e866af000e8
parent 155849 1cfa9e04efb7
child 155851 d0abcb6e1fff
push id4442
push userryanvm@gmail.com
push dateFri, 18 Oct 2013 21:58:35 +0000
treeherdermozilla-aurora@46a4d9b8aacd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret, lsblakk
bugs917350
milestone26.0a2
Bug 917350 - Factor out method to create SearchLoader arguments. r=margaret, a=lsblakk
mobile/android/base/home/SearchLoader.java
--- a/mobile/android/base/home/SearchLoader.java
+++ b/mobile/android/base/home/SearchLoader.java
@@ -33,27 +33,33 @@ class SearchLoader {
             final String searchTerm = args.getString(KEY_SEARCH_TERM);
             final boolean performEmptySearch = args.getBoolean(KEY_PERFORM_EMPTY_SEARCH, false);
             return new SearchCursorLoader(context, searchTerm, performEmptySearch);
         } else {
             return new SearchCursorLoader(context, "", false);
         }
     }
 
+    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 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 bundle = new Bundle();
-        bundle.putString(SearchLoader.KEY_SEARCH_TERM, searchTerm);
-        bundle.putBoolean(SearchLoader.KEY_PERFORM_EMPTY_SEARCH, performEmptySearch);
-        manager.restartLoader(loaderId, bundle, callbacks);
+        Bundle args = createArgs(searchTerm, performEmptySearch);
+        manager.restartLoader(loaderId, args, callbacks);
     }
 
     public static class SearchCursorLoader extends SimpleCursorLoader {
         // Max number of search results
         private static final int SEARCH_LIMIT = 100;
 
         // The target search term associated with the loader
         private final String mSearchTerm;