mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Merge "Refresh the all apps container search result when apps are installed" into ub-launcher3-calgary
This commit is contained in:
committed by
Android (Google) Code Review
commit
75df256cc1
@@ -45,6 +45,7 @@ public abstract class AllAppsSearchBarController
|
||||
protected AlphabeticalAppsList mApps;
|
||||
protected Callbacks mCb;
|
||||
protected ExtendedEditText mInput;
|
||||
private String mQuery;
|
||||
|
||||
protected DefaultAppSearchAlgorithm mSearchAlgorithm;
|
||||
protected InputMethodManager mInputMethodManager;
|
||||
@@ -90,16 +91,25 @@ public abstract class AllAppsSearchBarController
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(final Editable s) {
|
||||
String query = s.toString();
|
||||
if (query.isEmpty()) {
|
||||
mQuery = s.toString();
|
||||
if (mQuery.isEmpty()) {
|
||||
mSearchAlgorithm.cancel(true);
|
||||
mCb.clearSearchResult();
|
||||
} else {
|
||||
mSearchAlgorithm.cancel(false);
|
||||
mSearchAlgorithm.doSearch(query, mCb);
|
||||
mSearchAlgorithm.doSearch(mQuery, mCb);
|
||||
}
|
||||
}
|
||||
|
||||
protected void refreshSearchResult() {
|
||||
if (mQuery == null) {
|
||||
return;
|
||||
}
|
||||
// If play store continues auto updating an app, we want to show partial result.
|
||||
mSearchAlgorithm.cancel(false);
|
||||
mSearchAlgorithm.doSearch(mQuery, mCb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
// Skip if it's not the right action
|
||||
@@ -130,6 +140,7 @@ public abstract class AllAppsSearchBarController
|
||||
* Resets the search bar state.
|
||||
*/
|
||||
public void reset() {
|
||||
mQuery = null;
|
||||
unfocusSearchField();
|
||||
mCb.clearSearchResult();
|
||||
mInput.setText("");
|
||||
|
||||
Reference in New Issue
Block a user