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

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

Issue 1824813002: Resize of blimpview on text input (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/client/app/android/java/src/org/chromium/blimp/input/WebInputBox.java
diff --git a/blimp/client/app/android/java/src/org/chromium/blimp/input/WebInputBox.java b/blimp/client/app/android/java/src/org/chromium/blimp/input/WebInputBox.java
index 9c50e8538e75709eb1b36b2031deaceffe4446c6..6cdc25f8f114d404aa1205d15b06a47fd5896e18 100644
--- a/blimp/client/app/android/java/src/org/chromium/blimp/input/WebInputBox.java
+++ b/blimp/client/app/android/java/src/org/chromium/blimp/input/WebInputBox.java
@@ -4,10 +4,12 @@
package org.chromium.blimp.input;
+import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
+import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
@@ -25,9 +27,11 @@ import org.chromium.ui.UiUtils;
public class WebInputBox extends EditText {
private static final String TAG = "WebInputBox";
private long mNativeWebInputBoxPtr;
+ private Context mContext;
public WebInputBox(Context context, AttributeSet attrs) {
super(context, attrs);
+ mContext = context;
setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_NEXT
@@ -67,6 +71,9 @@ public class WebInputBox extends EditText {
@Override
public boolean dispatchKeyEventPreIme(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
+ ((Activity) mContext)
+ .getWindow()
+ .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
setVisibility(View.GONE);
}
return super.dispatchKeyEventPreIme(event);
@@ -76,6 +83,10 @@ public class WebInputBox extends EditText {
* Brings up the IME along with the edit text above it.
*/
public void showIme() {
+ // TODO(shaktisahu): Find a better way to prevent resize (crbug/596653).
+ ((Activity) mContext)
+ .getWindow()
+ .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
setVisibility(View.VISIBLE);
requestFocus();
UiUtils.showKeyboard(this);
@@ -85,6 +96,9 @@ public class WebInputBox extends EditText {
* Hides the edit text along with the IME.
*/
private void hideIme() {
+ ((Activity) mContext)
+ .getWindow()
+ .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
setText("");
setVisibility(View.GONE);
UiUtils.hideKeyboard(this);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698