summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-01-15 15:14:46 +0900
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-01-16 13:18:30 +0100
commitef73f53c85e9282b1609198d0fe84c47592367cd (patch)
treef6f9ea562a9e113c1b36531c36e4132d44a8fbc4 /android
parenta3efafeda5de111fafea822a1f61712721f98d19 (diff)
android: show software keyboard on main view in main thread
Change-Id: I2df86c2837fc6469384df5626a2d54856e96f8e7
Diffstat (limited to 'android')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java18
-rw-r--r--android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java9
2 files changed, 18 insertions, 9 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
index b83422c066a5..a40d78ceb9cd 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -2,6 +2,7 @@ package org.libreoffice;
import android.app.Activity;
import android.app.AlertDialog;
+import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
@@ -12,6 +13,7 @@ import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.RelativeLayout;
@@ -189,6 +191,22 @@ public class LibreOfficeMainActivity extends LOAbout {
return mDocumentPartViewListAdapter;
}
+ public void showSoftKeyboard() {
+ Log.i(LOGTAG, "SoftKeyboard show request..");
+
+ LOKitShell.getMainHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ LayerView layerView = (LayerView) findViewById(R.id.layer_view);
+
+ if (layerView.requestFocus()) {
+ InputMethodManager inputMethodManager = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+ inputMethodManager.showSoftInput(layerView, InputMethodManager.SHOW_FORCED);
+ }
+ }
+ });
+ }
+
public void showProgressSpinner() {
findViewById(R.id.loadingPanel).setVisibility(View.VISIBLE);
}
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java
index 0d2b0676e94c..6c71eeb54d99 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java
@@ -351,15 +351,6 @@ public class LayerView extends FrameLayout {
}
}
- public void showSoftKeyboard() {
- View view = mSurfaceView != null ? mSurfaceView : mTextureView;
-
- if (view.requestFocus()) {
- InputMethodManager inputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
- inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
- }
- }
-
private class SurfaceTextureListener implements TextureView.SurfaceTextureListener {
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
// We don't do this for surfaceCreated above because it is always followed by a surfaceChanged,