Kaydet (Commit) b7469087 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Miklos Vajna

android: add key_press event and send them to LOKitThread

Change-Id: I306fbe12e0a91e28bb2308074ded03b768173440
üst 56e7490e
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;
......
......@@ -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));
}
}
......@@ -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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment