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

anndroid: bind "LongPress" to mouse double click

Change-Id: Iba56deccf3c342ac82ca6cf78e09caf323f4a14d
üst 67c9a6dc
...@@ -229,8 +229,13 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation ...@@ -229,8 +229,13 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation
if (mTileProvider == null) { if (mTileProvider == null) {
return; return;
} }
LibreOfficeMainActivity.mAppContext.showSoftKeyboard(); if (touchType.equals("LongPress")) {
mTileProvider.mouseButtonDown(mDocumentTouchCoordinate); LibreOfficeMainActivity.mAppContext.hideSoftKeyboard();
mTileProvider.mouseButtonDown(mDocumentTouchCoordinate, 2);
} else { // "SingleTap"
LibreOfficeMainActivity.mAppContext.showSoftKeyboard();
mTileProvider.mouseButtonDown(mDocumentTouchCoordinate, 1);
}
} }
private void createThumbnail(final ThumbnailCreator.ThumbnailCreationTask task) { private void createThumbnail(final ThumbnailCreator.ThumbnailCreationTask task) {
......
...@@ -323,21 +323,21 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback ...@@ -323,21 +323,21 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
mOffice.postKeyEvent(Office.KEY_RELEASE, getCharCode(keyEvent), getKeyCode(keyEvent)); mOffice.postKeyEvent(Office.KEY_RELEASE, getCharCode(keyEvent), getKeyCode(keyEvent));
} }
private void mouseButton(int type, PointF inDocument) { private void mouseButton(int type, PointF inDocument, int numberOfClicks) {
int x = (int) pixelToTwip(inDocument.x, mDPI); int x = (int) pixelToTwip(inDocument.x, mDPI);
int y = (int) pixelToTwip(inDocument.y, mDPI); int y = (int) pixelToTwip(inDocument.y, mDPI);
mDocument.postMouseEvent(type, x, y, 1); mDocument.postMouseEvent(type, x, y, numberOfClicks);
} }
@Override @Override
public void mouseButtonDown(PointF inDocument) { public void mouseButtonDown(PointF documentCoordinate, int numberOfClicks) {
mouseButton(Document.MOUSE_BUTTON_DOWN, inDocument); mouseButton(Document.MOUSE_BUTTON_DOWN, documentCoordinate, numberOfClicks);
} }
@Override @Override
public void mouseButtonUp(PointF inDocument) { public void mouseButtonUp(PointF documentCoordinate, int numberOfClicks) {
mouseButton(Document.MOUSE_BUTTON_UP, inDocument); mouseButton(Document.MOUSE_BUTTON_UP, documentCoordinate, numberOfClicks);
} }
@Override @Override
......
...@@ -103,12 +103,12 @@ public class MockTileProvider implements TileProvider { ...@@ -103,12 +103,12 @@ public class MockTileProvider implements TileProvider {
} }
@Override @Override
public void mouseButtonDown(PointF inDocument) { public void mouseButtonDown(PointF documentCoordinate, int numberOfClicks) {
} }
@Override @Override
public void mouseButtonUp(PointF inDocument) { public void mouseButtonUp(PointF documentCoordinate, int numberOfClicks) {
} }
......
...@@ -31,12 +31,14 @@ public interface TileProvider { ...@@ -31,12 +31,14 @@ public interface TileProvider {
/** /**
* Change the document part to the one specified by the partIndex input parameter. * Change the document part to the one specified by the partIndex input parameter.
*
* @param partIndex - part index to change to * @param partIndex - part index to change to
*/ */
void changePart(int partIndex); void changePart(int partIndex);
/** /**
* Get the current document part number. * Get the current document part number.
*
* @return * @return
*/ */
int getCurrentPartNumber(); int getCurrentPartNumber();
...@@ -68,27 +70,33 @@ public interface TileProvider { ...@@ -68,27 +70,33 @@ public interface TileProvider {
/** /**
* Trigger a key press. * Trigger a key press.
*
* @param keyEvent - contains information about key event * @param keyEvent - contains information about key event
*/ */
void keyPress(KeyEvent keyEvent); void keyPress(KeyEvent keyEvent);
/** /**
* Trigger a key release. * Trigger a key release.
*
* @param keyEvent - contains information about key event * @param keyEvent - contains information about key event
*/ */
void keyRelease(KeyEvent keyEvent); void keyRelease(KeyEvent keyEvent);
/** /**
* Trigger a mouse button down event. * Trigger a mouse button down event.
*
* @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered * @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered
* @param numberOfClicks - number of clicks (1 - single click, 2 - double click)
*/ */
void mouseButtonDown(PointF documentCoordinate); void mouseButtonDown(PointF documentCoordinate, int numberOfClicks);
/** /**
* Trigger a mouse button up event. * Trigger a mouse button up event.
*
* @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered * @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered
* @param numberOfClicks - number of clicks (1 - single click, 2 - double click)
*/ */
void mouseButtonUp(PointF documentCoordinate); void mouseButtonUp(PointF documentCoordinate, int numberOfClicks);
/** /**
* Callback to retrieve invalidation calls * Callback to retrieve invalidation calls
...@@ -96,6 +104,7 @@ public interface TileProvider { ...@@ -96,6 +104,7 @@ public interface TileProvider {
public interface TileInvalidationCallback { public interface TileInvalidationCallback {
/** /**
* Invoked when a region is invalidated. * Invoked when a region is invalidated.
*
* @param rect area in pixels which was invalidated and needs to be redrawn * @param rect area in pixels which was invalidated and needs to be redrawn
*/ */
void invalidate(RectF rect); void invalidate(RectF rect);
......
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