Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2217)

Unified Diff: blimp/client/app/android/java/src/org/chromium/blimp/input/ImeEditText.java

Issue 2261853002: Changed Blimp IME to use PopUp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ime_popup
Patch Set: Used AlertDialog from support.v7 Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: blimp/client/app/android/java/src/org/chromium/blimp/input/ImeEditText.java
diff --git a/blimp/client/app/android/java/src/org/chromium/blimp/input/ImeEditText.java b/blimp/client/app/android/java/src/org/chromium/blimp/input/ImeEditText.java
new file mode 100644
index 0000000000000000000000000000000000000000..3aeb14d120ac08550458059cc86c97ea20947b94
--- /dev/null
+++ b/blimp/client/app/android/java/src/org/chromium/blimp/input/ImeEditText.java
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.blimp.input;
+
+import android.content.Context;
+import android.support.v7.app.AlertDialog;
+import android.util.AttributeSet;
+import android.view.KeyEvent;
+import android.widget.EditText;
+
+/**
+ * A {@link EditText} contained in a dialog which allows users to enter text.
+ * The dialog is dismissed on pressing back button.
+ */
+public class ImeEditText extends EditText {
+ // The alert dialog that contains this text box.
+ private AlertDialog mParentDialog;
+
+ public ImeEditText(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ /**
+ * Sets the parent view for this view.
+ * @param dialog The dialog containing this view.
+ */
+ public void initialize(AlertDialog dialog) {
+ mParentDialog = dialog;
+ }
+
+ /**
+ * Dismiss the text input dialog as soon as back button is pressed.
+ */
+ @Override
+ public boolean dispatchKeyEventPreIme(KeyEvent event) {
+ if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
+ mParentDialog.dismiss();
+ }
+ return super.dispatchKeyEventPreIme(event);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698