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

Unified Diff: shell/android/apk/src/org/chromium/mojo/shell/Keyboard.java

Issue 856063002: Adding keyboard service. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix local variable Created 5 years, 11 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 | « shell/BUILD.gn ('k') | shell/android/keyboard_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/android/apk/src/org/chromium/mojo/shell/Keyboard.java
diff --git a/shell/android/apk/src/org/chromium/mojo/shell/Keyboard.java b/shell/android/apk/src/org/chromium/mojo/shell/Keyboard.java
new file mode 100644
index 0000000000000000000000000000000000000000..e13ddea57de86bc6f616e8a447ec7f0e7db84e49
--- /dev/null
+++ b/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);
+ }
+}
« no previous file with comments | « shell/BUILD.gn ('k') | shell/android/keyboard_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698