android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
       |   10 +
 
android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CanvasElement.java
          |   23 ++++
 
android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CommonCanvasElement.java
    |   28 +++++
 
android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelection.java
       |   18 ++-
 
android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionHandle.java
 |    4 
 
android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java
       |   12 --
 
android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
        |   53 ++++------
 android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java  
             |    4 
 8 files changed, 103 insertions(+), 49 deletions(-)

New commits:
commit 4e24a2e79f7276d9b316cfe1c8d4edf9e85e3db7
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
Date:   Tue Mar 31 18:43:00 2015 +0900

    android: use onDraw for element drawing in CanvasElement interface
    
    Use onDraw to override the drawing to canvas. CommonCanvasElement
    uses the draw method to call onDraw depending on visibility.
    
    Change-Id: Id98991935168caab9d39665e72f33cfb3a91d8dc

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 da3ff6e..322cb99 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 45cbf10..dd73162 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 cb5f9fe..0cdd53b 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 4eebfe9..b8b22fc 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 {
commit 6c8dac3fe0da9ce48b17f50b346598062bf794b0
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
Date:   Tue Mar 31 18:36:49 2015 +0900

    android: use isVisible setVisible for GraphicSelection
    
    Change-Id: Ide9ad4b0e40482e5936e76ed0560b79769fc047d

diff --git 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
index bb6a93c..0eb97fa 100644
--- 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
+++ 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
@@ -50,7 +50,6 @@ public class TextCursorView extends View implements 
View.OnTouchListener {
 
     private GraphicSelection mGraphicSelection;
 
-    private boolean mGraphicSelectionVisible;
     private boolean mGraphicSelectionMove = false;
 
     private LayerView mLayerView;
@@ -84,8 +83,7 @@ public class TextCursorView extends View implements 
View.OnTouchListener {
             mSelectionsVisible = false;
 
             mGraphicSelection = new GraphicSelection();
-
-            mGraphicSelectionVisible = false;
+            mGraphicSelection.setVisible(false);
 
             postDelayed(cursorAnimation, CURSOR_BLINK_TIME);
 
@@ -170,6 +168,7 @@ public class TextCursorView extends View implements 
View.OnTouchListener {
     @Override
     protected void onDraw(Canvas canvas) {
         super.onDraw(canvas);
+
         if (mCursorVisible) {
             canvas.drawRect(mCursorScaledPosition, mCursorPaint);
         }
@@ -178,7 +177,7 @@ public class TextCursorView extends View implements 
View.OnTouchListener {
                 canvas.drawRect(selection, mSelectionPaint);
             }
         }
-        if (mGraphicSelectionVisible) {
+        if (mGraphicSelection.isVisible()) {
             mGraphicSelection.draw(canvas);
         }
     }
@@ -232,9 +231,9 @@ public class TextCursorView extends View implements 
View.OnTouchListener {
      * Show the graphic selection on the view.
      */
     public void showGraphicSelection() {
-        mGraphicSelectionVisible = true;
         mGraphicSelectionMove = false;
         mGraphicSelection.reset();
+        mGraphicSelection.setVisible(true);
         invalidate();
     }
 
@@ -242,7 +241,7 @@ public class TextCursorView extends View implements 
View.OnTouchListener {
      * Hide the graphic selection.
      */
     public void hideGraphicSelection() {
-        mGraphicSelectionVisible = false;
+        mGraphicSelection.setVisible(false);
         invalidate();
     }
 
@@ -253,7 +252,7 @@ public class TextCursorView extends View implements 
View.OnTouchListener {
     public boolean onTouch(View view, MotionEvent event) {
         switch (event.getActionMasked()) {
             case MotionEvent.ACTION_DOWN: {
-                if (mGraphicSelectionVisible) {
+                if (mGraphicSelection.isVisible()) {
                     // Check if inside graphic selection was hit
                     PointF startPosition = new PointF(event.getX(), 
event.getY());
                     if (mGraphicSelection.contains(startPosition.x, 
startPosition.y)) {
@@ -266,7 +265,7 @@ public class TextCursorView extends View implements 
View.OnTouchListener {
                 }
             }
             case MotionEvent.ACTION_UP: {
-                if (mGraphicSelectionVisible && mGraphicSelectionMove) {
+                if (mGraphicSelection.isVisible() && mGraphicSelectionMove) {
                     mGraphicSelectionMove = false;
                     mGraphicSelection.dragEnd(new PointF(event.getX(), 
event.getY()));
                     invalidate();
@@ -274,7 +273,7 @@ public class TextCursorView extends View implements 
View.OnTouchListener {
                 }
             }
             case MotionEvent.ACTION_MOVE: {
-                if (mGraphicSelectionVisible && mGraphicSelectionMove) {
+                if (mGraphicSelection.isVisible() && mGraphicSelectionMove) {
                     mGraphicSelection.dragging(new PointF(event.getX(), 
event.getY()));
                     invalidate();
                     return true;
commit e5ff0c14c34027be114985a8c69b86950c21c2cf
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
Date:   Tue Mar 31 18:32:32 2015 +0900

    android: isVisible, setVisible for CanvasElement + common impl.
    
    Change-Id: I10382cf00e4e5953d1ebae1b25f72d04a644cff1

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 094894b..da3ff6e 100644
--- 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CanvasElement.java
+++ 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CanvasElement.java
@@ -28,5 +28,16 @@ public interface CanvasElement {
      * @param y - y coordinate of the
      */
     boolean contains(float x, float y);
+
+    /**
+     * Return if element is visible.
+     */
+    boolean isVisible();
+
+    /**
+     * Set element visibility.
+     * @param visible - is element visible
+     */
+    void setVisible(boolean visible);
 }
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CommonCanvasElement.java
 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CommonCanvasElement.java
new file mode 100644
index 0000000..45cbf10
--- /dev/null
+++ 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CommonCanvasElement.java
@@ -0,0 +1,19 @@
+package org.libreoffice.canvas;
+
+/**
+ * Common implementation to canvas elements.
+ */
+public abstract class CommonCanvasElement implements CanvasElement {
+
+    private boolean mVisible = true;
+
+    @Override
+    public boolean isVisible() {
+        return mVisible;
+    }
+
+    @Override
+    public void setVisible(boolean visible) {
+        mVisible = visible;
+    }
+}
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 2ba05f3..cb5f9fe 100644
--- 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelection.java
+++ 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelection.java
@@ -23,7 +23,7 @@ import static 
org.libreoffice.canvas.GraphicSelectionHandle.HandlePosition;
  * This class is responsible to draw and reposition the selection
  * rectangle.
  */
-public class GraphicSelection implements CanvasElement {
+public class GraphicSelection extends CommonCanvasElement {
     private final Paint mPaintStroke;
     private final Paint mPaintFill;
     public RectF mRectangle = new RectF();
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 2c9f7ed..4eebfe9 100644
--- 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionHandle.java
+++ 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelectionHandle.java
@@ -19,7 +19,7 @@ import android.graphics.RectF;
  * position and perform a hit test to determine if the selection handle was
  * touched.
  */
-public class GraphicSelectionHandle implements CanvasElement {
+public class GraphicSelectionHandle extends CommonCanvasElement {
     /**
      * The factor used to inflate the hit area.
      */
commit dca9bd7561250c974c7fe3b3dd0fbcdd62b93d8c
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
Date:   Tue Mar 31 18:27:59 2015 +0900

    android: convertPosition -> convertToScreen
    
    Change-Id: I2c167173b0b7fb4debfef4455d3336e861a52f20

diff --git 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
index 319ea35..bb6a93c 100644
--- 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
+++ 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
@@ -139,25 +139,29 @@ public class TextCursorView extends View implements 
View.OnTouchListener {
     }
 
     public void repositionWithViewport(float x, float y, float zoom) {
-        mCursorScaledPosition = convertPosition(mCursorPosition, x, y, zoom);
+        mCursorScaledPosition = convertToScreen(mCursorPosition, x, y, zoom);
         mCursorScaledPosition.right = mCursorScaledPosition.left + 
CURSOR_WIDTH;
 
         mScaledSelections.clear();
         for (RectF selection : mSelections) {
-            RectF scaledSelection = convertPosition(selection, x, y, zoom);
+            RectF scaledSelection = convertToScreen(selection, x, y, zoom);
             mScaledSelections.add(scaledSelection);
         }
 
-        RectF scaledGraphicSelection = 
convertPosition(mGraphicSelection.mRectangle, x, y, zoom);
+        RectF scaledGraphicSelection = 
convertToScreen(mGraphicSelection.mRectangle, x, y, zoom);
         mGraphicSelection.reposition(scaledGraphicSelection);
 
         invalidate();
     }
 
-    private RectF convertPosition(RectF cursorPosition, float x, float y, 
float zoom) {
-        RectF cursor = RectUtils.scale(cursorPosition, zoom);
-        cursor.offset(-x, -y);
-        return cursor;
+    /**
+     * Convert the input rectangle from document to screen coordinates
+     * according to current viewport data (x, y, zoom).
+     */
+    private static RectF convertToScreen(RectF inputRect, float x, float y, 
float zoom) {
+        RectF rect = RectUtils.scale(inputRect, zoom);
+        rect.offset(-x, -y);
+        return rect;
     }
 
     /**
commit a2dfd85370b98edde0aeccfaeb20f727b64043c6
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
Date:   Tue Mar 31 18:25:51 2015 +0900

    android: single press on a selected shape triggers text edit
    
    Change-Id: If095bbaf5e4a0efec19f0170fd7c912c66b93669

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 fbccf1d..2ba05f3 100644
--- 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelection.java
+++ 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelection.java
@@ -34,6 +34,7 @@ public class GraphicSelection implements CanvasElement {
 
     private GraphicSelectionHandle mHandles[] = new GraphicSelectionHandle[8];
     private GraphicSelectionHandle mDragHandle = null;
+    private boolean mTriggerSinglePress = false;
 
     /**
      * Construct the graphic selection.
@@ -131,8 +132,8 @@ public class GraphicSelection implements CanvasElement {
             mType = DragType.MOVE;
             sendGraphicSelectionStart(position);
         }
-
         mStartDragPosition = position;
+        mTriggerSinglePress = true;
     }
 
     /**
@@ -149,6 +150,7 @@ public class GraphicSelection implements CanvasElement {
         } else if (mType == DragType.EXTEND) {
             adaptDrawRectangle(position.x, position.y);
         }
+        mTriggerSinglePress = false;
     }
 
     /**
@@ -172,6 +174,11 @@ public class GraphicSelection implements CanvasElement {
 
         sendGraphicSelectionEnd(point);
 
+        if (mTriggerSinglePress && mDragHandle == null) {
+            onSinglePress(point);
+            mTriggerSinglePress = false;
+        }
+
         mDrawRectangle = mScaledRectangle;
         mType = DragType.NONE;
     }
@@ -245,6 +252,11 @@ public class GraphicSelection implements CanvasElement {
         }
     }
 
+    private void onSinglePress(PointF screenPosition) {
+        sendGraphicSelection("LongPress", screenPosition);
+    }
+
+
     /**
      * Reset the selection.
      */
commit da0be0775676393ed0de2d4f4981f491d4ed92d4
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
Date:   Tue Mar 31 18:20:25 2015 +0900

    android: set layerView to TextCursorView{Layer} when available
    
    Change-Id: I3dbb7747ad6d5ce44ca286023e6c8fbc5a19a6b7

diff --git 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
index 9b14265..c3453bb 100644
--- 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -155,18 +155,19 @@ public class LibreOfficeMainActivity extends 
ActionBarActivity {
             sLOKitThread.clearQueue();
         }
 
-        mTextSelection = new TextSelection(mAppContext);
-        mTextCursorLayer = new TextCursorLayer(mAppContext);
-
         mLayerClient = new GeckoLayerClient(this);
         mLayerClient.setZoomConstraints(new ZoomConstraints(true));
         LayerView layerView = (LayerView) findViewById(R.id.layer_view);
-        // register TextSelection and TextCursorLayer in LayerView
         mLayerClient.setView(layerView);
-        layerView.addLayer(mTextSelection);
-        layerView.addLayer(mTextCursorLayer);
         layerView.setInputConnectionHandler(new LOKitInputConnectionHandler());
         mLayerClient.notifyReady();
+
+        // create and register TextSelection in LayerView
+        mTextSelection = new TextSelection(mAppContext);
+        layerView.addLayer(mTextSelection);
+
+        // create TextCursorLayer
+        mTextCursorLayer = new TextCursorLayer(mAppContext, layerView);
     }
 
     private boolean copyFileToTemp() {
diff --git 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java
 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java
index 2429ad3..9c4ab81 100644
--- 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java
+++ 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java
@@ -32,11 +32,13 @@ public class TextCursorLayer extends Layer {
     private float mViewTop;
     private float mViewZoom;
 
-    public TextCursorLayer(Activity context) {
+    public TextCursorLayer(Activity context, LayerView layerView) {
         mCursorView = (TextCursorView) 
context.findViewById(R.id.text_cursor_view);
         if (mCursorView == null) {
             Log.e(LOGTAG, "Failed to initialize TextCursorLayer - CursorView 
is null");
         }
+        layerView.addLayer(this);
+        mCursorView.initialize(layerView);
     }
 
     /**
diff --git 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
index af3237e..319ea35 100644
--- 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
+++ 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
@@ -57,25 +57,23 @@ public class TextCursorView extends View implements 
View.OnTouchListener {
 
     public TextCursorView(Context context) {
         super(context);
-        initialize();
     }
 
     public TextCursorView(Context context, AttributeSet attrs) {
         super(context, attrs);
-        initialize();
     }
 
     public TextCursorView(Context context, AttributeSet attrs, int 
defStyleAttr) {
         super(context, attrs, defStyleAttr);
-        initialize();
     }
 
     /**
      * Initialize the selection and cursor view.
      */
-    private void initialize() {
+    public void initialize(LayerView layerView) {
         if (!mInitialized) {
             setOnTouchListener(this);
+            mLayerView = layerView;
 
             mCursorPaint.setColor(Color.BLACK);
             mCursorPaint.setAlpha(0xFF);
@@ -100,15 +98,9 @@ public class TextCursorView extends View implements 
View.OnTouchListener {
      * @param position - new position of the cursor
      */
     public void changeCursorPosition(RectF position) {
-        LayerView layerView = LOKitShell.getLayerView();
-        if (layerView == null) {
-            Log.e(LOGTAG, "Can't position cursor because layerView is null");
-            return;
-        }
-
         mCursorPosition = position;
 
-        ImmutableViewportMetrics metrics = layerView.getViewportMetrics();
+        ImmutableViewportMetrics metrics = mLayerView.getViewportMetrics();
         repositionWithViewport(metrics.viewportRectLeft, 
metrics.viewportRectTop, metrics.zoomFactor);
     }
 
@@ -287,6 +279,10 @@ public class TextCursorView extends View implements 
View.OnTouchListener {
         }
         return false;
     }
+
+    public void setLayerView(LayerView layerView) {
+        this.mLayerView = layerView;
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 8fb01f318e2856bfca77c6bd9063a28afe35bfec
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
Date:   Tue Mar 31 15:40:03 2015 +0900

    android: register TextSelection & TextCursorLayer once at creation
    
    Change-Id: I33471dbcdd82b50919b6c6af741101b3d4ff71cf

diff --git 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
index c169d8e..9b14265 100644
--- 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -161,7 +161,10 @@ public class LibreOfficeMainActivity extends 
ActionBarActivity {
         mLayerClient = new GeckoLayerClient(this);
         mLayerClient.setZoomConstraints(new ZoomConstraints(true));
         LayerView layerView = (LayerView) findViewById(R.id.layer_view);
+        // register TextSelection and TextCursorLayer in LayerView
         mLayerClient.setView(layerView);
+        layerView.addLayer(mTextSelection);
+        layerView.addLayer(mTextCursorLayer);
         layerView.setInputConnectionHandler(new LOKitInputConnectionHandler());
         mLayerClient.notifyReady();
     }
diff --git 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java
 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java
index dc7650b..2429ad3 100644
--- 
a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java
+++ 
b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java
@@ -70,10 +70,6 @@ public class TextCursorLayer extends Layer {
                 mViewLeft = 0.0f;
                 mViewTop = 0.0f;
                 mViewZoom = 0.0f;
-                LayerView layerView = LOKitShell.getLayerView();
-                if (layerView != null) {
-                    layerView.addLayer(TextCursorLayer.this);
-                }
                 mCursorView.showCursor();
             }
         });
@@ -107,10 +103,6 @@ public class TextCursorLayer extends Layer {
     public void showSelections() {
         LOKitShell.getMainHandler().post(new Runnable() {
             public void run() {
-                LayerView layerView = LOKitShell.getLayerView();
-                if (layerView != null) {
-                    layerView.addLayer(TextCursorLayer.this);
-                }
                 mCursorView.showSelections();
             }
         });
diff --git 
a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java 
b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java
index 7a07742..359b7dd 100644
--- 
a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java
+++ 
b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java
@@ -94,10 +94,6 @@ public class TextSelection extends Layer {
                 mViewLeft = 0.0f;
                 mViewTop = 0.0f;
                 mViewZoom = 0.0f;
-                LayerView layerView = LOKitShell.getLayerView();
-                if (layerView != null) {
-                    layerView.addLayer(TextSelection.this);
-                }
             }
         });
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to