| Index: mojo/shell/android/apk/src/org/chromium/mojo/shell/Keyboard.java
|
| diff --git a/mojo/shell/android/apk/src/org/chromium/mojo/shell/Keyboard.java b/mojo/shell/android/apk/src/org/chromium/mojo/shell/Keyboard.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e13ddea57de86bc6f616e8a447ec7f0e7db84e49
|
| --- /dev/null
|
| +++ b/mojo/shell/android/apk/src/org/chromium/mojo/shell/Keyboard.java
|
| @@ -0,0 +1,35 @@
|
| +// Copyright 2014 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.mojo.shell;
|
| +
|
| +import android.app.Activity;
|
| +import android.content.Context;
|
| +import android.view.View;
|
| +import android.view.inputmethod.InputMethodManager;
|
| +
|
| +import org.chromium.base.CalledByNative;
|
| +import org.chromium.base.JNINamespace;
|
| +
|
| +/**
|
| + * Interaction with the keyboard.
|
| + */
|
| +@JNINamespace("mojo::shell")
|
| +public class Keyboard {
|
| + @CalledByNative
|
| + private static void showSoftKeyboard(Activity activity) {
|
| + View v = activity.getCurrentFocus();
|
| + InputMethodManager imm =
|
| + (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
| + imm.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT);
|
| + }
|
| +
|
| + @CalledByNative
|
| + private static void hideSoftKeyboard(Activity activity) {
|
| + View v = activity.getCurrentFocus();
|
| + InputMethodManager imm =
|
| + (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
| + imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0);
|
| + }
|
| +}
|
|
|