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
if (mTileProvider == null) {
return;
}
if (touchType.equals("LongPress")) {
LibreOfficeMainActivity.mAppContext.hideSoftKeyboard();
mTileProvider.mouseButtonDown(mDocumentTouchCoordinate, 2);
} else { // "SingleTap"
LibreOfficeMainActivity.mAppContext.showSoftKeyboard();
mTileProvider.mouseButtonDown(mDocumentTouchCoordinate);
mTileProvider.mouseButtonDown(mDocumentTouchCoordinate, 1);
}
}
private void createThumbnail(final ThumbnailCreator.ThumbnailCreationTask task) {
......
......@@ -323,21 +323,21 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
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 y = (int) pixelToTwip(inDocument.y, mDPI);
mDocument.postMouseEvent(type, x, y, 1);
mDocument.postMouseEvent(type, x, y, numberOfClicks);
}
@Override
public void mouseButtonDown(PointF inDocument) {
mouseButton(Document.MOUSE_BUTTON_DOWN, inDocument);
public void mouseButtonDown(PointF documentCoordinate, int numberOfClicks) {
mouseButton(Document.MOUSE_BUTTON_DOWN, documentCoordinate, numberOfClicks);
}
@Override
public void mouseButtonUp(PointF inDocument) {
mouseButton(Document.MOUSE_BUTTON_UP, inDocument);
public void mouseButtonUp(PointF documentCoordinate, int numberOfClicks) {
mouseButton(Document.MOUSE_BUTTON_UP, documentCoordinate, numberOfClicks);
}
@Override
......
......@@ -103,12 +103,12 @@ public class MockTileProvider implements TileProvider {
}
@Override
public void mouseButtonDown(PointF inDocument) {
public void mouseButtonDown(PointF documentCoordinate, int numberOfClicks) {
}
@Override
public void mouseButtonUp(PointF inDocument) {
public void mouseButtonUp(PointF documentCoordinate, int numberOfClicks) {
}
......
......@@ -31,12 +31,14 @@ public interface TileProvider {
/**
* Change the document part to the one specified by the partIndex input parameter.
*
* @param partIndex - part index to change to
*/
void changePart(int partIndex);
/**
* Get the current document part number.
*
* @return
*/
int getCurrentPartNumber();
......@@ -68,27 +70,33 @@ public interface TileProvider {
/**
* Trigger a key press.
*
* @param keyEvent - contains information about key event
*/
void keyPress(KeyEvent keyEvent);
/**
* Trigger a key release.
*
* @param keyEvent - contains information about key event
*/
void keyRelease(KeyEvent keyEvent);
/**
* Trigger a mouse button down event.
*
* @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.
*
* @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
......@@ -96,6 +104,7 @@ public interface TileProvider {
public interface TileInvalidationCallback {
/**
* Invoked when a region is invalidated.
*
* @param rect area in pixels which was invalidated and needs to be redrawn
*/
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