Clean up search fragment loader lifecycle.

- Programatically create SearchView to make it always expand across
  entire action bar.
- Store current query text during screen rotation
- Restart loader when query text changes

Bug: 33354491
Test: RunSettingsRoboTests
Change-Id: I63838a38514569aac60c5d67ac52ac06a7acd5a3
This commit is contained in:
Fan Zhang
2016-12-05 16:21:44 -08:00
parent 2425a528ad
commit 413eaa4070
9 changed files with 210 additions and 98 deletions

View File

@@ -16,7 +16,7 @@
package com.android.settings.search2;
import android.app.Activity;
import android.widget.SearchView;
import android.content.Context;
import android.view.Menu;
/**
@@ -31,8 +31,14 @@ public interface SearchFeatureProvider {
/**
* Inserts the Menu items into Settings activity.
*
* @param menu Items will be inserted into this menu.
* @param activity The activity that precedes SearchActivity.
*/
void setUpSearchMenu(Menu menu, Activity activity);
/**
* Returns a new loader to search in index database.
*/
DatabaseResultLoader getDatabaseSearchLoader(Context context, String query);
}