Loading src/com/android/launcher3/ExtendedEditText.java +6 −2 Original line number Diff line number Diff line Loading @@ -99,6 +99,10 @@ public class ExtendedEditText extends EditText { mShowImeAfterFirstLayout = !showSoftInput(); } public void hideKeyboard() { UiThreadHelper.hideKeyboardAsync(getContext(), getWindowToken()); } private boolean showSoftInput() { return requestFocus() && ((InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE)) Loading @@ -106,7 +110,7 @@ public class ExtendedEditText extends EditText { } public void dispatchBackKey() { UiThreadHelper.hideKeyboardAsync(getContext(), getWindowToken()); hideKeyboard(); if (mBackKeyListener != null) { mBackKeyListener.onBackKey(); } Loading Loading @@ -135,6 +139,6 @@ public class ExtendedEditText extends EditText { nextFocus.requestFocus(); } } UiThreadHelper.hideKeyboardAsync(getContext(), getWindowToken()); hideKeyboard(); } } src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java +12 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.view.KeyEvent; import android.view.View; import android.view.View.OnFocusChangeListener; import android.view.inputmethod.EditorInfo; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; Loading @@ -37,7 +39,8 @@ import java.util.ArrayList; * An interface to a search box that AllApps can command. */ public class AllAppsSearchBarController implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener { implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener, OnFocusChangeListener { protected Launcher mLauncher; protected Callbacks mCb; Loading @@ -62,6 +65,7 @@ public class AllAppsSearchBarController mInput.addTextChangedListener(this); mInput.setOnEditorActionListener(this); mInput.setOnBackKeyListener(this); mInput.setOnFocusChangeListener(this); mSearchAlgorithm = searchAlgorithm; } Loading Loading @@ -123,6 +127,13 @@ public class AllAppsSearchBarController return false; } @Override public void onFocusChange(View view, boolean hasFocus) { if (!hasFocus) { mInput.hideKeyboard(); } } /** * Resets the search bar state. */ Loading Loading
src/com/android/launcher3/ExtendedEditText.java +6 −2 Original line number Diff line number Diff line Loading @@ -99,6 +99,10 @@ public class ExtendedEditText extends EditText { mShowImeAfterFirstLayout = !showSoftInput(); } public void hideKeyboard() { UiThreadHelper.hideKeyboardAsync(getContext(), getWindowToken()); } private boolean showSoftInput() { return requestFocus() && ((InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE)) Loading @@ -106,7 +110,7 @@ public class ExtendedEditText extends EditText { } public void dispatchBackKey() { UiThreadHelper.hideKeyboardAsync(getContext(), getWindowToken()); hideKeyboard(); if (mBackKeyListener != null) { mBackKeyListener.onBackKey(); } Loading Loading @@ -135,6 +139,6 @@ public class ExtendedEditText extends EditText { nextFocus.requestFocus(); } } UiThreadHelper.hideKeyboardAsync(getContext(), getWindowToken()); hideKeyboard(); } }
src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java +12 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.view.KeyEvent; import android.view.View; import android.view.View.OnFocusChangeListener; import android.view.inputmethod.EditorInfo; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; Loading @@ -37,7 +39,8 @@ import java.util.ArrayList; * An interface to a search box that AllApps can command. */ public class AllAppsSearchBarController implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener { implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener, OnFocusChangeListener { protected Launcher mLauncher; protected Callbacks mCb; Loading @@ -62,6 +65,7 @@ public class AllAppsSearchBarController mInput.addTextChangedListener(this); mInput.setOnEditorActionListener(this); mInput.setOnBackKeyListener(this); mInput.setOnFocusChangeListener(this); mSearchAlgorithm = searchAlgorithm; } Loading Loading @@ -123,6 +127,13 @@ public class AllAppsSearchBarController return false; } @Override public void onFocusChange(View view, boolean hasFocus) { if (!hasFocus) { mInput.hideKeyboard(); } } /** * Resets the search bar state. */ Loading