Refactoring to ExtendedEditText.
This commit is contained in:
1 parent
81056da1de
commit
97b0d08d92
6 files changed
+30
-55
No files matched your search
@@ -25,6 +25,7 @@ import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.TextView;
|
||||
import com.android.launcher3.ExtendedEditText;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
@@ -54,7 +55,8 @@ final class DefaultAppSearchController extends AllAppsSearchBarController
|
||||
@Thunk View mSearchBarContainerView;
|
||||
private View mSearchButtonView;
|
||||
private View mDismissSearchButtonView;
|
||||
@Thunk AllAppsSearchEditView mSearchBarEditView;
|
||||
@Thunk
|
||||
ExtendedEditText mSearchBarEditView;
|
||||
@Thunk AllAppsRecyclerView mAppsRecyclerView;
|
||||
@Thunk Runnable mFocusRecyclerViewRunnable = new Runnable() {
|
||||
@Override
|
||||
@@ -82,21 +84,23 @@ final class DefaultAppSearchController extends AllAppsSearchBarController
|
||||
mSearchBarContainerView = mSearchView.findViewById(R.id.search_container);
|
||||
mDismissSearchButtonView = mSearchBarContainerView.findViewById(R.id.dismiss_search_button);
|
||||
mDismissSearchButtonView.setOnClickListener(this);
|
||||
mSearchBarEditView = (AllAppsSearchEditView)
|
||||
mSearchBarEditView = (ExtendedEditText)
|
||||
mSearchBarContainerView.findViewById(R.id.search_box_input);
|
||||
mSearchBarEditView.addTextChangedListener(this);
|
||||
mSearchBarEditView.setOnEditorActionListener(this);
|
||||
mSearchBarEditView.setOnBackKeyListener(
|
||||
new AllAppsSearchEditView.OnBackKeyListener() {
|
||||
new ExtendedEditText.OnBackKeyListener() {
|
||||
@Override
|
||||
public void onBackKey() {
|
||||
public boolean onBackKey() {
|
||||
// Only hide the search field if there is no query, or if there
|
||||
// are no filtered results
|
||||
String query = Utilities.trim(
|
||||
mSearchBarEditView.getEditableText().toString());
|
||||
if (query.isEmpty() || mApps.hasNoFilteredResults()) {
|
||||
hideSearchField(true, mFocusRecyclerViewRunnable);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return mSearchView;
|
||||
|
||||
Reference in new issue
Block a user