summaryrefslogtreecommitdiff
path: root/android/experimental
diff options
context:
space:
mode:
Diffstat (limited to 'android/experimental')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CanvasElement.java12
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CommonCanvasElement.java9
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelection.java2
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionHandle.java2
4 files changed, 22 insertions, 3 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CanvasElement.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CanvasElement.java
index da3ff6eaaf27..322cb99066d2 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CanvasElement.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CanvasElement.java
@@ -17,12 +17,22 @@ import android.graphics.Canvas;
*/
public interface CanvasElement {
/**
- * Called when the element needs to be draw no the canvas.
+ * Called when the element needs to be draw no the canvas. This method
+ * should call onDraw when conditions to draw are satisfied.
+ *
* @param canvas - the canvas
*/
void draw(Canvas canvas);
/**
+ * Called inside draw if the element is visible. Override this method to
+ * draw the element on the canvas.
+ *
+ * @param canvas - the canvas
+ */
+ void onDraw(Canvas canvas);
+
+ /**
* Hit test - returns true if the object has been hit
* @param x - x coordinate of the
* @param y - y coordinate of the
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CommonCanvasElement.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CommonCanvasElement.java
index 45cbf10b0769..dd7316250ae4 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CommonCanvasElement.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CommonCanvasElement.java
@@ -1,5 +1,7 @@
package org.libreoffice.canvas;
+import android.graphics.Canvas;
+
/**
* Common implementation to canvas elements.
*/
@@ -16,4 +18,11 @@ public abstract class CommonCanvasElement implements CanvasElement {
public void setVisible(boolean visible) {
mVisible = visible;
}
+
+ @Override
+ public void draw(Canvas canvas) {
+ if (isVisible()) {
+ onDraw(canvas);
+ }
+ }
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelection.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelection.java
index cb5f9fefd14b..0cdd53bd1697 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelection.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelection.java
@@ -103,7 +103,7 @@ public class GraphicSelection extends CommonCanvasElement {
* @see org.libreoffice.canvas.CanvasElement#draw(android.graphics.Canvas)
*/
@Override
- public void draw(Canvas canvas) {
+ public void onDraw(Canvas canvas) {
canvas.drawRect(mDrawRectangle, mPaintStroke);
if (mType != DragType.NONE) {
canvas.drawRect(mDrawRectangle, mPaintFill);
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionHandle.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionHandle.java
index 4eebfe9352e3..b8b22fc4f30f 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionHandle.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionHandle.java
@@ -71,7 +71,7 @@ public class GraphicSelectionHandle extends CommonCanvasElement {
* @see org.libreoffice.canvas.CanvasElement#draw(android.graphics.Canvas)
*/
@Override
- public void draw(Canvas canvas) {
+ public void onDraw(Canvas canvas) {
if (mSelected) {
drawFilledCircle(canvas, mPosition.x, mPosition.y, mRadius, mStrokePaint, mSelectedFillPaint);
} else {