Chromium Code Reviews| 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..459acc8837f1467f8c1fd4a269edd374b3830fe3 |
| --- /dev/null |
| +++ b/blimp/client/app/android/java/src/org/chromium/blimp/input/ImeEditText.java |
| @@ -0,0 +1,42 @@ |
| +// 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.app.AlertDialog; |
| +import android.content.Context; |
| +import android.util.AttributeSet; |
| +import android.view.KeyEvent; |
| +import android.widget.EditText; |
| + |
| +/** |
| + * A {@link EditText} that allows user to enter text into a web page. |
|
David Trainor- moved to gerrit
2016/08/22 21:25:24
This description seems a bit too specific, given t
shaktisahu
2016/08/23 17:35:14
:). Changed the description a bit. I think the cla
|
| + */ |
| +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(); |
|
David Trainor- moved to gerrit
2016/08/22 21:25:24
What's the current behavior with the back button?
shaktisahu
2016/08/23 17:35:14
Currently, we hide the IME and make the EditText i
David Trainor- moved to gerrit
2016/08/29 04:28:50
I guess what I'm asking is does back on the phone
shaktisahu
2016/08/29 18:58:47
Oh.. Without this code, the phone takes two back p
|
| + } |
| + return super.dispatchKeyEventPreIme(event); |
| + } |
| +} |