Search - add "live" search results

- now it is possible to have Search results directly when
you are typing (and not only when you press on the Search button
in the IME)
- implement onQueryTextChange(...)
- take care about re-runnin the saved query when the app is resumed

Change-Id: I021c8a9a95b50dce69ab6dace81eecb2fb188f18
This commit is contained in:
Fabrice Di Meglio
2014-04-16 16:54:56 -07:00
parent 6602d02f57
commit a32707664f
2 changed files with 13 additions and 1 deletions

View File

@@ -616,6 +616,10 @@ public class SettingsActivity extends Activity
registerReceiver(mBatteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
mDynamicIndexableContentMonitor.register(this);
if(!TextUtils.isEmpty(mSearchQuery)) {
onQueryTextSubmit(mSearchQuery);
}
}
@Override
@@ -1226,7 +1230,10 @@ public class SettingsActivity extends Activity
@Override
public boolean onQueryTextChange(String newText) {
mSearchQuery = newText;
return false;
if (TextUtils.isEmpty(newText) && mSearchResultsFragment == null) {
return false;
}
return mSearchResultsFragment.onQueryTextChange(newText);
}
@Override