Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a07c90b6 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Revert "Hide keyboard on touching type spinner and show it after selection changed"

This reverts commit ce0413b7.

Bug 25322155
Bug 27536072

Change-Id: I1667cdf9932381458f7168237d6f2b902063ee3f
parent 5e481e74
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -29,12 +29,10 @@ import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
@@ -140,18 +138,6 @@ public abstract class LabeledEditorView extends LinearLayout implements Editor,
        mLabel.setId(View.NO_ID);
        mLabel.setOnItemSelectedListener(mSpinnerListener);
        ViewSelectedFilter.suppressViewSelectedEvent(mLabel);
        mLabel.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (v == mLabel) {
                    final InputMethodManager inputMethodManager = (InputMethodManager)
                            getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
                    inputMethodManager.hideSoftInputFromWindow(
                            mLabel.getWindowToken(), /* flags */ 0);
                }
                return false;
            }
        });

        mDelete = (ImageView) findViewById(R.id.delete_button);
        mDeleteContainer = findViewById(R.id.delete_button_container);
+7 −15
Original line number Diff line number Diff line
@@ -125,7 +125,13 @@ public class TextFieldsEditorView extends LabeledEditorView {
        final View editor = mFields.getChildAt(0);

        // Show the soft-keyboard.
        showSoftKeyboard(editor);
        InputMethodManager imm =
                (InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        if (imm != null) {
            if (!imm.showSoftInput(editor, InputMethodManager.SHOW_IMPLICIT)) {
                Log.w(TAG, "Failed to show soft input method.");
            }
        }
    }

    @Override
@@ -174,26 +180,12 @@ public class TextFieldsEditorView extends LabeledEditorView {
                }
                if (editText.hasFocus()) {
                    anyFieldHasFocus = true;
                    showSoftKeyboard(editText);
                    break;
                }
            }
            if (!anyFieldHasFocus && firstField != null) {
                firstField.requestFocus();
                showSoftKeyboard(firstField);
            }
        }
            }

    /**
     * Show soft keyboard for the currently focused view.
     */
    private void showSoftKeyboard(View v) {
        final InputMethodManager inputMethodManager = (InputMethodManager)
                getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        if (inputMethodManager != null &&
                !inputMethodManager.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT)) {
            Log.w(TAG, "Failed to show soft input method.");
        }
    }