[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 3 commits - android/experimental
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Mon Mar 23 01:06:37 PDT 2015
android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementHandle.java | 69 -
android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java | 2
android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java | 4
android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java | 174 ----
android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java | 346 ---------
android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionCanvasElement.java | 75 ++
android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionHandleCanvasElement.java | 67 +
android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java | 175 ++++
android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java | 351 ++++++++++
9 files changed, 670 insertions(+), 593 deletions(-)
New commits:
commit 186245083bb87c611ffe2e5b51119bdfc9dce616
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 23 17:01:37 2015 +0900
android: reorganize (overlay, canvas packages), move classes
Added new packages:
* overlay - overlay elements like TextCursor*
* canvas - classes that its only purpose is to draw to canvas
Change-Id: I0dec06e76819231dacae26d24e43bb6315bba6e4
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
index 1e8c2d9..359f0ca 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
@@ -5,6 +5,7 @@ import android.graphics.RectF;
import android.net.Uri;
import org.libreoffice.kit.Document;
+import org.libreoffice.overlay.TextCursorLayer;
import org.mozilla.gecko.TextSelection;
import org.mozilla.gecko.TextSelectionHandle;
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
index 3c57301..c054143 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -8,7 +8,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
-import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
@@ -17,9 +16,8 @@ import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ListView;
-import android.widget.RelativeLayout;
-import android.widget.Toast;
+import org.libreoffice.overlay.TextCursorLayer;
import org.mozilla.gecko.TextSelection;
import org.mozilla.gecko.ZoomConstraints;
import org.mozilla.gecko.gfx.GeckoLayerClient;
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementGraphicSelection.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionCanvasElement.java
similarity index 74%
rename from android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementGraphicSelection.java
rename to android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionCanvasElement.java
index e4319fc..5adf8d3 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementGraphicSelection.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionCanvasElement.java
@@ -1,4 +1,12 @@
-package org.libreoffice;
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+package org.libreoffice.canvas;
import android.graphics.Canvas;
import android.graphics.Paint;
@@ -9,7 +17,7 @@ import android.graphics.RectF;
* This class is responsible to draw and reposition the selection
* rectangle.
*/
-public class DrawElementGraphicSelection {
+public class GraphicSelectionCanvasElement {
private final Paint mGraphicSelectionPaint;
public RectF mRectangle = new RectF();
public RectF mScaledRectangle = new RectF();
@@ -17,7 +25,7 @@ public class DrawElementGraphicSelection {
private DragType mType = DragType.NONE;
private PointF mStartDragPosition;
- public DrawElementGraphicSelection(Paint graphicSelectionPaint) {
+ public GraphicSelectionCanvasElement(Paint graphicSelectionPaint) {
mGraphicSelectionPaint = graphicSelectionPaint;
}
@@ -58,9 +66,10 @@ public class DrawElementGraphicSelection {
mDrawRectangle = mScaledRectangle;
}
- enum DragType {
+ public enum DragType {
NONE,
MOVE,
EXTEND
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementHandle.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionHandleCanvasElement.java
similarity index 91%
rename from android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementHandle.java
rename to android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionHandleCanvasElement.java
index 1912d01..64d369f 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementHandle.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionHandleCanvasElement.java
@@ -6,7 +6,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-package org.libreoffice;
+package org.libreoffice.canvas;
import android.graphics.Canvas;
import android.graphics.Color;
@@ -14,14 +14,12 @@ import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.RectF;
-import org.mozilla.gecko.gfx.RectUtils;
-
/**
* This class is responsible to draw the selection handles, track the handle
* position and perform a hit test to determine if the selection handle was
* touched.
*/
-public class DrawElementHandle {
+public class GraphicSelectionHandleCanvasElement {
public PointF mPosition = new PointF();
private float mRadius = 20.0f;
private Paint mGraphicHandleFillPaint = new Paint();
@@ -29,7 +27,7 @@ public class DrawElementHandle {
private Paint mGraphicHandleSelectedFillPaint = new Paint();
private RectF mHitRect = new RectF();
- public DrawElementHandle(Paint graphicSelectionPaint) {
+ public GraphicSelectionHandleCanvasElement(Paint graphicSelectionPaint) {
mGraphicSelectionPaint = graphicSelectionPaint;
mGraphicHandleFillPaint.setStyle(Paint.Style.FILL);
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java
similarity index 98%
rename from android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java
rename to android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java
index 8c044ed..dc7650b 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java
@@ -6,13 +6,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-package org.libreoffice;
+package org.libreoffice.overlay;
import android.app.Activity;
import android.graphics.RectF;
import android.util.Log;
-import android.view.View;
+import org.libreoffice.LOKitShell;
+import org.libreoffice.R;
import org.mozilla.gecko.gfx.Layer;
import org.mozilla.gecko.gfx.LayerView;
import org.mozilla.gecko.util.FloatUtils;
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
similarity index 86%
rename from android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java
rename to android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
index 320cffc..d952b80 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
@@ -6,21 +6,22 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-package org.libreoffice;
+package org.libreoffice.overlay;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
-import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
-import android.widget.RelativeLayout;
+import org.libreoffice.LOKitShell;
+import org.libreoffice.canvas.GraphicSelectionCanvasElement;
+import org.libreoffice.canvas.GraphicSelectionHandleCanvasElement;
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
import org.mozilla.gecko.gfx.LayerView;
import org.mozilla.gecko.gfx.RectUtils;
@@ -50,7 +51,7 @@ public class TextCursorView extends View implements View.OnTouchListener {
private Paint mGraphicSelectionPaint = new Paint();
- private DrawElementGraphicSelection mGraphicSelection;
+ private GraphicSelectionCanvasElement mGraphicSelection;
private PointF mTouchStart = new PointF();
private PointF mDeltaPoint = new PointF();
@@ -60,8 +61,8 @@ public class TextCursorView extends View implements View.OnTouchListener {
private LayerView mLayerView;
- private DrawElementHandle mHandles[] = new DrawElementHandle[8];
- private DrawElementHandle mDragHandle = null;
+ private GraphicSelectionHandleCanvasElement mHandles[] = new GraphicSelectionHandleCanvasElement[8];
+ private GraphicSelectionHandleCanvasElement mDragHandle = null;
public TextCursorView(Context context) {
super(context);
@@ -97,18 +98,18 @@ public class TextCursorView extends View implements View.OnTouchListener {
mGraphicSelectionPaint.setColor(Color.BLACK);
mGraphicSelectionPaint.setStrokeWidth(2);
- mGraphicSelection = new DrawElementGraphicSelection(mGraphicSelectionPaint);
+ mGraphicSelection = new GraphicSelectionCanvasElement(mGraphicSelectionPaint);
mGraphicSelectionVisible = false;
- mHandles[0] = new DrawElementHandle(mGraphicSelectionPaint);
- mHandles[1] = new DrawElementHandle(mGraphicSelectionPaint);
- mHandles[2] = new DrawElementHandle(mGraphicSelectionPaint);
- mHandles[3] = new DrawElementHandle(mGraphicSelectionPaint);
- mHandles[4] = new DrawElementHandle(mGraphicSelectionPaint);
- mHandles[5] = new DrawElementHandle(mGraphicSelectionPaint);
- mHandles[6] = new DrawElementHandle(mGraphicSelectionPaint);
- mHandles[7] = new DrawElementHandle(mGraphicSelectionPaint);
+ mHandles[0] = new GraphicSelectionHandleCanvasElement(mGraphicSelectionPaint);
+ mHandles[1] = new GraphicSelectionHandleCanvasElement(mGraphicSelectionPaint);
+ mHandles[2] = new GraphicSelectionHandleCanvasElement(mGraphicSelectionPaint);
+ mHandles[3] = new GraphicSelectionHandleCanvasElement(mGraphicSelectionPaint);
+ mHandles[4] = new GraphicSelectionHandleCanvasElement(mGraphicSelectionPaint);
+ mHandles[5] = new GraphicSelectionHandleCanvasElement(mGraphicSelectionPaint);
+ mHandles[6] = new GraphicSelectionHandleCanvasElement(mGraphicSelectionPaint);
+ mHandles[7] = new GraphicSelectionHandleCanvasElement(mGraphicSelectionPaint);
postDelayed(cursorAnimation, CURSOR_BLINK_TIME);
@@ -201,7 +202,7 @@ public class TextCursorView extends View implements View.OnTouchListener {
mGraphicSelection.draw(canvas);
if (mGraphicSelectionMove) {
- for (DrawElementHandle handle : mHandles) {
+ for (GraphicSelectionHandleCanvasElement handle : mHandles) {
if (mDragHandle == handle) {
handle.drawSelected(canvas);
} else {
@@ -209,7 +210,7 @@ public class TextCursorView extends View implements View.OnTouchListener {
}
}
} else {
- for (DrawElementHandle handle : mHandles) {
+ for (GraphicSelectionHandleCanvasElement handle : mHandles) {
handle.draw(canvas);
}
}
@@ -296,11 +297,11 @@ public class TextCursorView extends View implements View.OnTouchListener {
private boolean checkIfGraphicSelectionWasHit() {
// Check if handle was hit
mDragHandle = null;
- for (DrawElementHandle handle : mHandles) {
+ for (GraphicSelectionHandleCanvasElement handle : mHandles) {
if (handle.contains(mTouchStart.x, mTouchStart.y)) {
mDragHandle = handle;
mGraphicSelectionMove = true;
- mGraphicSelection.dragStart(DrawElementGraphicSelection.DragType.EXTEND, mTouchStart);
+ mGraphicSelection.dragStart(GraphicSelectionCanvasElement.DragType.EXTEND, mTouchStart);
sendGraphicSelectionStart(handle.mPosition);
return true;
}
@@ -308,7 +309,7 @@ public class TextCursorView extends View implements View.OnTouchListener {
// Check if inside graphic selection was hit
if (mGraphicSelection.contains(mTouchStart.x, mTouchStart.y)) {
mGraphicSelectionMove = true;
- mGraphicSelection.dragStart(DrawElementGraphicSelection.DragType.MOVE, mTouchStart);
+ mGraphicSelection.dragStart(GraphicSelectionCanvasElement.DragType.MOVE, mTouchStart);
sendGraphicSelectionStart(mTouchStart);
return true;
}
commit 19723443a44b625c0f378ae4fb42ae998bdb9fad
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 23 16:51:47 2015 +0900
android: extract drawing of selection into its own class
Change-Id: I8e94edeafbf5b7fd5f02a1429893c4b803c71afa
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementGraphicSelection.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementGraphicSelection.java
new file mode 100644
index 0000000..e4319fc
--- /dev/null
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementGraphicSelection.java
@@ -0,0 +1,66 @@
+package org.libreoffice;
+
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.PointF;
+import android.graphics.RectF;
+
+/**
+ * This class is responsible to draw and reposition the selection
+ * rectangle.
+ */
+public class DrawElementGraphicSelection {
+ private final Paint mGraphicSelectionPaint;
+ public RectF mRectangle = new RectF();
+ public RectF mScaledRectangle = new RectF();
+ private RectF mDrawRectangle = new RectF();
+ private DragType mType = DragType.NONE;
+ private PointF mStartDragPosition;
+
+ public DrawElementGraphicSelection(Paint graphicSelectionPaint) {
+ mGraphicSelectionPaint = graphicSelectionPaint;
+ }
+
+ public void reposition(RectF scaledRectangle) {
+ mScaledRectangle = scaledRectangle;
+ mDrawRectangle = scaledRectangle;
+ }
+
+ public boolean contains(float x, float y) {
+ return mScaledRectangle.contains(x, y);
+ }
+
+ public void draw(Canvas canvas) {
+ canvas.drawRect(mDrawRectangle, mGraphicSelectionPaint);
+ }
+
+ public void dragStart(DragType type, PointF position) {
+ mType = type;
+ mStartDragPosition = position;
+ }
+
+ public void dragging(PointF position) {
+ if (mType == DragType.MOVE) {
+
+ float deltaX = position.x - mStartDragPosition.x;
+ float deltaY = position.y - mStartDragPosition.y;
+
+ mDrawRectangle = new RectF(mScaledRectangle);
+ mDrawRectangle.offset(deltaX, deltaY);
+ } else if (mType == DragType.EXTEND) {
+ mDrawRectangle = new RectF(mScaledRectangle);
+ mDrawRectangle.union(position.x, position.y);
+ }
+ }
+
+ public void dragEnd() {
+ mType = DragType.NONE;
+ mDrawRectangle = mScaledRectangle;
+ }
+
+ enum DragType {
+ NONE,
+ MOVE,
+ EXTEND
+ }
+}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java
index 26eb215..320cffc 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java
@@ -48,14 +48,16 @@ public class TextCursorView extends View implements View.OnTouchListener {
private Paint mSelectionPaint = new Paint();
private boolean mSelectionsVisible;
- private RectF mGraphicSelection = new RectF();
- private RectF mGraphicScaledSelection = new RectF();
private Paint mGraphicSelectionPaint = new Paint();
- private boolean mGraphicSelectionVisible;
+ private DrawElementGraphicSelection mGraphicSelection;
+
private PointF mTouchStart = new PointF();
private PointF mDeltaPoint = new PointF();
+
+ private boolean mGraphicSelectionVisible;
private boolean mGraphicSelectionMove = false;
+
private LayerView mLayerView;
private DrawElementHandle mHandles[] = new DrawElementHandle[8];
@@ -94,6 +96,9 @@ public class TextCursorView extends View implements View.OnTouchListener {
mGraphicSelectionPaint.setStyle(Paint.Style.STROKE);
mGraphicSelectionPaint.setColor(Color.BLACK);
mGraphicSelectionPaint.setStrokeWidth(2);
+
+ mGraphicSelection = new DrawElementGraphicSelection(mGraphicSelectionPaint);
+
mGraphicSelectionVisible = false;
mHandles[0] = new DrawElementHandle(mGraphicSelectionPaint);
@@ -144,39 +149,43 @@ public class TextCursorView extends View implements View.OnTouchListener {
return;
}
- mGraphicSelection = rectangle;
+ mGraphicSelection.mRectangle = rectangle;
ImmutableViewportMetrics metrics = layerView.getViewportMetrics();
repositionWithViewport(metrics.viewportRectLeft, metrics.viewportRectTop, metrics.zoomFactor);
}
public void repositionWithViewport(float x, float y, float zoom) {
- mCursorScaledPosition = RectUtils.scale(mCursorPosition, zoom);
- mCursorScaledPosition.offset(-x, -y);
+ mCursorScaledPosition = convertPosition(mCursorPosition, x, y, zoom);
mCursorScaledPosition.right = mCursorScaledPosition.left + CURSOR_WIDTH;
mScaledSelections.clear();
for (RectF selection : mSelections) {
- RectF scaledSelection = RectUtils.scale(selection, zoom);
- scaledSelection.offset(-x, -y);
+ RectF scaledSelection = convertPosition(selection, x, y, zoom);
mScaledSelections.add(scaledSelection);
}
- mGraphicScaledSelection = RectUtils.scale(mGraphicSelection, zoom);
- mGraphicScaledSelection.offset(-x, -y);
+ RectF scaledGraphicSelection = convertPosition(mGraphicSelection.mRectangle, x, y, zoom);
+ mGraphicSelection.reposition(scaledGraphicSelection);
- mHandles[0].reposition(mGraphicScaledSelection.left, mGraphicScaledSelection.top);
- mHandles[1].reposition(mGraphicScaledSelection.centerX(), mGraphicScaledSelection.top);
- mHandles[2].reposition(mGraphicScaledSelection.right, mGraphicScaledSelection.top);
- mHandles[3].reposition(mGraphicScaledSelection.left, mGraphicScaledSelection.centerY());
- mHandles[4].reposition(mGraphicScaledSelection.right, mGraphicScaledSelection.centerY());
- mHandles[5].reposition(mGraphicScaledSelection.left, mGraphicScaledSelection.bottom);
- mHandles[6].reposition(mGraphicScaledSelection.centerX(), mGraphicScaledSelection.bottom);
- mHandles[7].reposition(mGraphicScaledSelection.right, mGraphicScaledSelection.bottom);
+ mHandles[0].reposition(scaledGraphicSelection.left, scaledGraphicSelection.top);
+ mHandles[1].reposition(scaledGraphicSelection.centerX(), scaledGraphicSelection.top);
+ mHandles[2].reposition(scaledGraphicSelection.right, scaledGraphicSelection.top);
+ mHandles[3].reposition(scaledGraphicSelection.left, scaledGraphicSelection.centerY());
+ mHandles[4].reposition(scaledGraphicSelection.right, scaledGraphicSelection.centerY());
+ mHandles[5].reposition(scaledGraphicSelection.left, scaledGraphicSelection.bottom);
+ mHandles[6].reposition(scaledGraphicSelection.centerX(), scaledGraphicSelection.bottom);
+ mHandles[7].reposition(scaledGraphicSelection.right, scaledGraphicSelection.bottom);
invalidate();
}
+ private RectF convertPosition(RectF cursorPosition, float x, float y, float zoom) {
+ RectF cursor = RectUtils.scale(cursorPosition, zoom);
+ cursor.offset(-x, -y);
+ return cursor;
+ }
+
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
@@ -189,6 +198,8 @@ public class TextCursorView extends View implements View.OnTouchListener {
}
}
if (mGraphicSelectionVisible) {
+ mGraphicSelection.draw(canvas);
+
if (mGraphicSelectionMove) {
for (DrawElementHandle handle : mHandles) {
if (mDragHandle == handle) {
@@ -197,20 +208,7 @@ public class TextCursorView extends View implements View.OnTouchListener {
handle.draw(canvas);
}
}
-
- RectF selectionRect = new RectF(mGraphicScaledSelection);
- if (mDragHandle != null) {
- PointF dragPosition = new PointF(mDragHandle.mPosition.x, mDragHandle.mPosition.y);
- dragPosition.offset(mDeltaPoint.x, mDeltaPoint.y);
- selectionRect.union(dragPosition.x, dragPosition.y);
- canvas.drawRect(selectionRect, mGraphicSelectionPaint);
- } else {
- selectionRect.offset(mDeltaPoint.x, mDeltaPoint.y);
- canvas.drawRect(selectionRect, mGraphicSelectionPaint);
- }
} else {
- canvas.drawRect(mGraphicScaledSelection, mGraphicSelectionPaint);
-
for (DrawElementHandle handle : mHandles) {
handle.draw(canvas);
}
@@ -286,6 +284,7 @@ public class TextCursorView extends View implements View.OnTouchListener {
if (mGraphicSelectionVisible && mGraphicSelectionMove) {
mDeltaPoint.x = event.getX() - mTouchStart.x;
mDeltaPoint.y = event.getY() - mTouchStart.y;
+ mGraphicSelection.dragging(new PointF(event.getX(), event.getY()));
invalidate();
return true;
}
@@ -301,13 +300,15 @@ public class TextCursorView extends View implements View.OnTouchListener {
if (handle.contains(mTouchStart.x, mTouchStart.y)) {
mDragHandle = handle;
mGraphicSelectionMove = true;
+ mGraphicSelection.dragStart(DrawElementGraphicSelection.DragType.EXTEND, mTouchStart);
sendGraphicSelectionStart(handle.mPosition);
return true;
}
}
// Check if inside graphic selection was hit
- if (mGraphicScaledSelection.contains(mTouchStart.x, mTouchStart.y)) {
+ if (mGraphicSelection.contains(mTouchStart.x, mTouchStart.y)) {
mGraphicSelectionMove = true;
+ mGraphicSelection.dragStart(DrawElementGraphicSelection.DragType.MOVE, mTouchStart);
sendGraphicSelectionStart(mTouchStart);
return true;
}
@@ -316,6 +317,7 @@ public class TextCursorView extends View implements View.OnTouchListener {
private boolean stopGraphicSelection() {
mGraphicSelectionMove = false;
+
PointF point = new PointF();
if (mDragHandle != null) {
point.x = mDragHandle.mPosition.x;
@@ -326,6 +328,8 @@ public class TextCursorView extends View implements View.OnTouchListener {
}
point.offset(mDeltaPoint.x, mDeltaPoint.y);
sendGraphicSelectionEnd(point);
+
+ mGraphicSelection.dragEnd();
invalidate();
return true;
}
commit a3d531598fb74cccae9e9e2cf20a02c6a17ecc30
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 23 16:06:38 2015 +0900
android: remove import android.util.Log from InvalidationHandler
Change-Id: Ie944ca77abf13c4ac2c3b9c492d56878bfffba55
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
index 805ed9c..1e8c2d9 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
@@ -3,7 +3,6 @@ package org.libreoffice;
import android.content.Intent;
import android.graphics.RectF;
import android.net.Uri;
-import android.util.Log;
import org.libreoffice.kit.Document;
import org.mozilla.gecko.TextSelection;
More information about the Libreoffice-commits
mailing list