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

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

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 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
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);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698