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

android: add support for touch event to LOEvent

Change-Id: Ie4b3e48d3f06545ebfd8638cdb8e4664ad85f493
üst da39c5fd
package org.libreoffice;
import android.view.MotionEvent;
import org.mozilla.gecko.gfx.ComposedTileLayer;
import org.mozilla.gecko.gfx.IntSize;
import org.mozilla.gecko.gfx.SubTile;
......@@ -14,6 +16,7 @@ public class LOEvent implements Comparable<LOEvent> {
public static final int TILE_REQUEST = 7;
public static final int THUMBNAIL = 8;
public static final int TILE_RERENDER = 9;
public static final int TOUCH = 10;
public final int mType;
public int mPriority = 0;
......@@ -26,6 +29,8 @@ public class LOEvent implements Comparable<LOEvent> {
public ComposedTileLayer mComposedTileLayer;
public boolean mForceRedraw;
public SubTile mTile;
public String mTouchType;
public MotionEvent mMotionEvent;
public LOEvent(int type) {
mType = type;
......@@ -73,6 +78,13 @@ public class LOEvent implements Comparable<LOEvent> {
mTile = tile;
}
public LOEvent(int type, String touchType, MotionEvent motionEvent) {
mType = type;
mTypeString = "Touch";
mTouchType = touchType;
mMotionEvent = motionEvent;
}
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.MotionEvent;
public class LOKitShell {
......@@ -13,21 +14,11 @@ public class LOKitShell {
return metrics.density * 160;
}
public static void sendEvent(LOEvent event) {
if (LibreOfficeMainActivity.mAppContext != null && LibreOfficeMainActivity.mAppContext.getLOKitThread() != null) {
LibreOfficeMainActivity.mAppContext.getLOKitThread().queueEvent(event);
}
}
// Get a Handler for the main java thread
public static Handler getMainHandler() {
return LibreOfficeMainActivity.mAppContext.mMainHandler;
}
public static void queueRedraw() {
LOKitShell.sendEvent(LOEventFactory.redraw());
}
public static void showProgressSpinner() {
getMainHandler().post(new Runnable() {
@Override
......@@ -55,7 +46,19 @@ public class LOKitShell {
return metrics;
}
// EVENTS
public static void sendEvent(LOEvent event) {
if (LibreOfficeMainActivity.mAppContext != null && LibreOfficeMainActivity.mAppContext.getLOKitThread() != null) {
LibreOfficeMainActivity.mAppContext.getLOKitThread().queueEvent(event);
}
}
public static void sendThumbnailEvent(ThumbnailCreator.ThumbnailCreationTask task) {
LOKitShell.sendEvent(LOEventFactory.thumbnail(task));
LOKitShell.sendEvent(new LOEvent(LOEvent.THUMBNAIL, task));
}
public static void sentTouchEvent(String touchType, MotionEvent motionEvent) {
LOKitShell.sendEvent(new LOEvent(LOEvent.TOUCH, "SingleTap", motionEvent));
}
}
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