Loading src/com/android/launcher3/ExtendedEditText.java +30 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.content.Context; import android.util.AttributeSet; import android.view.DragEvent; import android.view.KeyEvent; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; Loading @@ -27,6 +28,8 @@ import android.widget.EditText; */ public class ExtendedEditText extends EditText { private boolean mShowImeAfterFirstLayout; /** * Implemented by listeners of the back key. */ Loading @@ -37,11 +40,11 @@ public class ExtendedEditText extends EditText { private OnBackKeyListener mBackKeyListener; public ExtendedEditText(Context context) { super(context); this(context, null, 0); } public ExtendedEditText(Context context, AttributeSet attrs) { super(context, attrs); this(context, attrs, 0); } public ExtendedEditText(Context context, AttributeSet attrs, int defStyleAttr) { Loading Loading @@ -69,4 +72,29 @@ public class ExtendedEditText extends EditText { // We don't want this view to interfere with Launcher own drag and drop. return false; } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if (mShowImeAfterFirstLayout) { // soft input only shows one frame after the layout of the EditText happens, post(new Runnable() { @Override public void run() { showSoftInput(); mShowImeAfterFirstLayout = false; } }); } } public void showKeyboard() { mShowImeAfterFirstLayout = !showSoftInput(); } private boolean showSoftInput() { return requestFocus() && ((InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE)) .showSoftInput(this, InputMethodManager.SHOW_FORCED); } } src/com/android/launcher3/Launcher.java +1 −1 Original line number Diff line number Diff line Loading @@ -951,7 +951,7 @@ public class Launcher extends Activity // view after launching an app, as they may be depending on the UI to be static to // switch to another app, otherwise, if it was showAppsView(false /* animated */, !launchedFromApp /* updatePredictedApps */, false /* focusSearchBar */); mAppsView.shouldRestoreImeState() /* focusSearchBar */); } else if (mOnResumeState == State.WIDGETS) { showWidgetsView(false, false); } Loading src/com/android/launcher3/allapps/AllAppsContainerView.java +5 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.text.Selection; import android.text.Spannable; import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.method.TextKeyListener; import android.util.AttributeSet; import android.view.KeyEvent; Loading Loading @@ -52,7 +53,6 @@ import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.folder.Folder; import com.android.launcher3.graphics.TintedDrawableSpan; import com.android.launcher3.keyboard.FocusedItemDecorator; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.ComponentKey; Loading Loading @@ -708,4 +708,8 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc public void fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent) { targetParent.containerType = mAppsRecyclerView.getContainerType(v); } public boolean shouldRestoreImeState() { return !TextUtils.isEmpty(mSearchInput.getText()); } } src/com/android/launcher3/allapps/AllAppsSearchBarController.java +1 −2 Original line number Diff line number Diff line Loading @@ -163,8 +163,7 @@ public abstract class AllAppsSearchBarController * Focuses the search field to handle key events. */ public void focusSearchField() { mInput.requestFocus(); mInputMethodManager.showSoftInput(mInput, InputMethodManager.SHOW_IMPLICIT); mInput.showKeyboard(); } /** Loading Loading
src/com/android/launcher3/ExtendedEditText.java +30 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.content.Context; import android.util.AttributeSet; import android.view.DragEvent; import android.view.KeyEvent; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; Loading @@ -27,6 +28,8 @@ import android.widget.EditText; */ public class ExtendedEditText extends EditText { private boolean mShowImeAfterFirstLayout; /** * Implemented by listeners of the back key. */ Loading @@ -37,11 +40,11 @@ public class ExtendedEditText extends EditText { private OnBackKeyListener mBackKeyListener; public ExtendedEditText(Context context) { super(context); this(context, null, 0); } public ExtendedEditText(Context context, AttributeSet attrs) { super(context, attrs); this(context, attrs, 0); } public ExtendedEditText(Context context, AttributeSet attrs, int defStyleAttr) { Loading Loading @@ -69,4 +72,29 @@ public class ExtendedEditText extends EditText { // We don't want this view to interfere with Launcher own drag and drop. return false; } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if (mShowImeAfterFirstLayout) { // soft input only shows one frame after the layout of the EditText happens, post(new Runnable() { @Override public void run() { showSoftInput(); mShowImeAfterFirstLayout = false; } }); } } public void showKeyboard() { mShowImeAfterFirstLayout = !showSoftInput(); } private boolean showSoftInput() { return requestFocus() && ((InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE)) .showSoftInput(this, InputMethodManager.SHOW_FORCED); } }
src/com/android/launcher3/Launcher.java +1 −1 Original line number Diff line number Diff line Loading @@ -951,7 +951,7 @@ public class Launcher extends Activity // view after launching an app, as they may be depending on the UI to be static to // switch to another app, otherwise, if it was showAppsView(false /* animated */, !launchedFromApp /* updatePredictedApps */, false /* focusSearchBar */); mAppsView.shouldRestoreImeState() /* focusSearchBar */); } else if (mOnResumeState == State.WIDGETS) { showWidgetsView(false, false); } Loading
src/com/android/launcher3/allapps/AllAppsContainerView.java +5 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.text.Selection; import android.text.Spannable; import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.method.TextKeyListener; import android.util.AttributeSet; import android.view.KeyEvent; Loading Loading @@ -52,7 +53,6 @@ import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.folder.Folder; import com.android.launcher3.graphics.TintedDrawableSpan; import com.android.launcher3.keyboard.FocusedItemDecorator; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.ComponentKey; Loading Loading @@ -708,4 +708,8 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc public void fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent) { targetParent.containerType = mAppsRecyclerView.getContainerType(v); } public boolean shouldRestoreImeState() { return !TextUtils.isEmpty(mSearchInput.getText()); } }
src/com/android/launcher3/allapps/AllAppsSearchBarController.java +1 −2 Original line number Diff line number Diff line Loading @@ -163,8 +163,7 @@ public abstract class AllAppsSearchBarController * Focuses the search field to handle key events. */ public void focusSearchField() { mInput.requestFocus(); mInputMethodManager.showSoftInput(mInput, InputMethodManager.SHOW_IMPLICIT); mInput.showKeyboard(); } /** Loading