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:
@@ -616,6 +616,10 @@ public class SettingsActivity extends Activity
|
|||||||
registerReceiver(mBatteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
registerReceiver(mBatteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||||
|
|
||||||
mDynamicIndexableContentMonitor.register(this);
|
mDynamicIndexableContentMonitor.register(this);
|
||||||
|
|
||||||
|
if(!TextUtils.isEmpty(mSearchQuery)) {
|
||||||
|
onQueryTextSubmit(mSearchQuery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1226,7 +1230,10 @@ public class SettingsActivity extends Activity
|
|||||||
@Override
|
@Override
|
||||||
public boolean onQueryTextChange(String newText) {
|
public boolean onQueryTextChange(String newText) {
|
||||||
mSearchQuery = newText;
|
mSearchQuery = newText;
|
||||||
return false;
|
if (TextUtils.isEmpty(newText) && mSearchResultsFragment == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return mSearchResultsFragment.onQueryTextChange(newText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -151,6 +151,11 @@ public class SearchResultsSummary extends Fragment {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean onQueryTextChange(String query) {
|
||||||
|
updateSearchResults(query);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean onClose() {
|
public boolean onClose() {
|
||||||
clearResults();
|
clearResults();
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user