diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-16 17:44:27 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-01-16 13:18:32 +0100 |
commit | b7469087e107f1380e01f836d06d17e9bad12f63 (patch) | |
tree | 52debe45bda6a62239777215f0dd61aa9731f698 /android/experimental | |
parent | 56e7490ee611a746c1351d19c22a615cbf90afdf (diff) |
android: add key_press event and send them to LOKitThread
Change-Id: I306fbe12e0a91e28bb2308074ded03b768173440
Diffstat (limited to 'android/experimental')
3 files changed, 20 insertions, 0 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java index 7ec346bee8d1..809988d215d0 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java @@ -1,5 +1,6 @@ package org.libreoffice; +import android.view.KeyEvent; import android.view.MotionEvent; import org.mozilla.gecko.gfx.ComposedTileLayer; @@ -17,6 +18,7 @@ public class LOEvent implements Comparable<LOEvent> { public static final int THUMBNAIL = 8; public static final int TILE_RERENDER = 9; public static final int TOUCH = 10; + public static final int KEY_PRESS = 11; public final int mType; public int mPriority = 0; @@ -31,6 +33,7 @@ public class LOEvent implements Comparable<LOEvent> { public SubTile mTile; public String mTouchType; public MotionEvent mMotionEvent; + public KeyEvent mKeyEvent; public LOEvent(int type) { mType = type; @@ -85,6 +88,11 @@ public class LOEvent implements Comparable<LOEvent> { mMotionEvent = motionEvent; } + public LOEvent(int type, KeyEvent keyEvent) { + mType = type; + mKeyEvent = keyEvent; + } + public String getTypeString() { if (mTypeString == null) { return "Event type: " + mType; diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java index e89469013f7f..03b9aaf78020 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java @@ -3,6 +3,7 @@ package org.libreoffice; import android.os.Handler; import android.util.DisplayMetrics; +import android.view.KeyEvent; import android.view.MotionEvent; @@ -61,4 +62,8 @@ public class LOKitShell { public static void sentTouchEvent(String touchType, MotionEvent motionEvent) { LOKitShell.sendEvent(new LOEvent(LOEvent.TOUCH, "SingleTap", motionEvent)); } + + public static void sendKeyPressEvent(KeyEvent event) { + LOKitShell.sendEvent(new LOEvent(LOEvent.KEY_PRESS, event)); + } } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java index a40d78ceb9cd..b79217db0d5a 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -9,6 +9,7 @@ import android.os.Handler; import android.support.v4.widget.DrawerLayout; import android.util.DisplayMetrics; import android.util.Log; +import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; @@ -239,6 +240,12 @@ public class LibreOfficeMainActivity extends LOAbout { mDrawerLayout.closeDrawer(mDrawerList); } } + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + LOKitShell.sendKeyPressEvent(event); + return super.onKeyDown(keyCode, event); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |