Revert "Hide keyboard on touching type spinner and show it after selection changed"
This reverts commit ce0413b7c8fc85a782c611c5b0b4fce1d6f40256.
Bug 25322155
Bug 27536072
Change-Id: I1667cdf9932381458f7168237d6f2b902063ee3f
diff --git a/src/com/android/contacts/editor/LabeledEditorView.java b/src/com/android/contacts/editor/LabeledEditorView.java
index 7be748e..63d75d8 100644
--- a/src/com/android/contacts/editor/LabeledEditorView.java
+++ b/src/com/android/contacts/editor/LabeledEditorView.java
@@ -29,12 +29,10 @@
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 @@
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);
diff --git a/src/com/android/contacts/editor/TextFieldsEditorView.java b/src/com/android/contacts/editor/TextFieldsEditorView.java
index 3086526..4096b19 100644
--- a/src/com/android/contacts/editor/TextFieldsEditorView.java
+++ b/src/com/android/contacts/editor/TextFieldsEditorView.java
@@ -125,7 +125,13 @@
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,29 +180,15 @@
}
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.");
- }
- }
-
public void setValue(int field, String value) {
mFieldEditTexts[field].setText(value);
}