diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-04-08 13:17:00 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-04-13 09:07:01 +0200 |
commit | 5707813c075cdbccaf74dbdcb623dcf0149d5d1d (patch) | |
tree | fad607af61f2b92cbb38e8f6cea92f3c2b15ae84 /android | |
parent | 4fb38c6f6668badcea8c12d574e97bfc4faed671 (diff) |
android: rename TextCursorLayer{View} -> DocumentOverlay{View}
Change-Id: I53a55e2d30c298e7c34f18b7713de91f3c77d5f2
Diffstat (limited to 'android')
-rw-r--r-- | android/README | 6 | ||||
-rw-r--r-- | android/experimental/LOAndroid3/res/layout/text_selection_handles.xml | 2 | ||||
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java | 62 | ||||
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java | 10 | ||||
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/DocumentOverlay.java (renamed from android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java) | 15 | ||||
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/DocumentOverlayView.java (renamed from android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java) | 18 |
6 files changed, 55 insertions, 58 deletions
diff --git a/android/README b/android/README index 08379007d50e..0989cf68c325 100644 --- a/android/README +++ b/android/README @@ -144,9 +144,9 @@ Overlay Overlay elements like cursor and selections aren't drawn by the LO core, instead the core only provides data (cursor position, selection rectangles) and the app needs to draw them. -TextCursorView (org.libreoffice.overlay.TextCursorView) and TextCursorLayer -(org.libreoffice.overlay.TextCursorLayer) are the classes that provide the overlay over the -document, where selections and the cursor is drawn. +DocumentOverlay (org.libreoffice.overlay.DocumentOverlay) and DocumentOverlayView +(org.libreoffice.overlay.DocumentOverlayView) are the classes that provide the overlay over +the document, where selections and the cursor is drawn. Emulator and debugging notes **************************** diff --git a/android/experimental/LOAndroid3/res/layout/text_selection_handles.xml b/android/experimental/LOAndroid3/res/layout/text_selection_handles.xml index b75ffd9e22ec..0be954d0de0b 100644 --- a/android/experimental/LOAndroid3/res/layout/text_selection_handles.xml +++ b/android/experimental/LOAndroid3/res/layout/text_selection_handles.xml @@ -6,7 +6,7 @@ <merge xmlns:android="http://schemas.android.com/apk/res/android" xmlns:gecko="http://schemas.android.com/apk/res-auto"> - <org.libreoffice.overlay.TextCursorView + <org.libreoffice.overlay.DocumentOverlayView android:id="@+id/text_cursor_view" android:layout_width="fill_parent" android:layout_height="fill_parent"/> diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java index a49b32dad974..7aeb573015f7 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java @@ -6,7 +6,7 @@ import android.net.Uri; import org.libreoffice.canvas.SelectionHandle; import org.libreoffice.kit.Document; -import org.libreoffice.overlay.TextCursorLayer; +import org.libreoffice.overlay.DocumentOverlay; import java.util.ArrayList; import java.util.Collections; @@ -17,11 +17,11 @@ import java.util.List; */ public class InvalidationHandler implements Document.MessageCallback { private static String LOGTAG = InvalidationHandler.class.getSimpleName(); - private final TextCursorLayer mTextCursorLayer; + private final DocumentOverlay mDocumentOverlay; private OverlayState mState; public InvalidationHandler(LibreOfficeMainActivity mainActivity) { - mTextCursorLayer = mainActivity.getTextCursorLayer(); + mDocumentOverlay = mainActivity.getDocumentOverlay(); mState = OverlayState.NONE; } @@ -147,8 +147,8 @@ public class InvalidationHandler implements Document.MessageCallback { private synchronized void invalidateCursor(String payload) { RectF cursorRectangle = convertPayloadToRectangle(payload); if (cursorRectangle != null) { - mTextCursorLayer.positionCursor(cursorRectangle); - mTextCursorLayer.positionHandle(SelectionHandle.HandleType.MIDDLE, cursorRectangle); + mDocumentOverlay.positionCursor(cursorRectangle); + mDocumentOverlay.positionHandle(SelectionHandle.HandleType.MIDDLE, cursorRectangle); if (mState == OverlayState.TRANSITION || mState == OverlayState.CURSOR) { changeStateTo(OverlayState.CURSOR); @@ -164,7 +164,7 @@ public class InvalidationHandler implements Document.MessageCallback { private synchronized void textSelectionStart(String payload) { RectF selectionRect = convertPayloadToRectangle(payload); if (selectionRect != null) { - mTextCursorLayer.positionHandle(SelectionHandle.HandleType.START, selectionRect); + mDocumentOverlay.positionHandle(SelectionHandle.HandleType.START, selectionRect); } } @@ -176,7 +176,7 @@ public class InvalidationHandler implements Document.MessageCallback { private synchronized void textSelectionEnd(String payload) { RectF selectionRect = convertPayloadToRectangle(payload); if (selectionRect != null) { - mTextCursorLayer.positionHandle(SelectionHandle.HandleType.END, selectionRect); + mDocumentOverlay.positionHandle(SelectionHandle.HandleType.END, selectionRect); } } @@ -190,14 +190,14 @@ public class InvalidationHandler implements Document.MessageCallback { if (mState == OverlayState.SELECTION) { changeStateTo(OverlayState.TRANSITION); } - mTextCursorLayer.changeSelections(Collections.EMPTY_LIST); + mDocumentOverlay.changeSelections(Collections.EMPTY_LIST); } else { List<RectF> rectangles = convertPayloadToRectangles(payload); if (mState != OverlayState.SELECTION) { changeStateTo(OverlayState.TRANSITION); } changeStateTo(OverlayState.SELECTION); - mTextCursorLayer.changeSelections(rectangles); + mDocumentOverlay.changeSelections(rectangles); } } @@ -208,13 +208,13 @@ public class InvalidationHandler implements Document.MessageCallback { */ private synchronized void cursorVisibility(String payload) { if (payload.equals("true")) { - mTextCursorLayer.showCursor(); + mDocumentOverlay.showCursor(); if (mState != OverlayState.SELECTION) { - mTextCursorLayer.showHandle(SelectionHandle.HandleType.MIDDLE); + mDocumentOverlay.showHandle(SelectionHandle.HandleType.MIDDLE); } } else if (payload.equals("false")) { - mTextCursorLayer.hideCursor(); - mTextCursorLayer.hideHandle(SelectionHandle.HandleType.MIDDLE); + mDocumentOverlay.hideCursor(); + mDocumentOverlay.hideHandle(SelectionHandle.HandleType.MIDDLE); } } @@ -230,7 +230,7 @@ public class InvalidationHandler implements Document.MessageCallback { } } else { RectF rectangle = convertPayloadToRectangle(payload); - mTextCursorLayer.changeGraphicSelection(rectangle); + mDocumentOverlay.changeGraphicSelection(rectangle); if (mState != OverlayState.GRAPHIC_SELECTION) { changeStateTo(OverlayState.TRANSITION); } @@ -293,12 +293,12 @@ public class InvalidationHandler implements Document.MessageCallback { } // Just hide everything - mTextCursorLayer.hideHandle(SelectionHandle.HandleType.START); - mTextCursorLayer.hideHandle(SelectionHandle.HandleType.END); - mTextCursorLayer.hideHandle(SelectionHandle.HandleType.MIDDLE); - mTextCursorLayer.hideSelections(); - mTextCursorLayer.hideCursor(); - mTextCursorLayer.hideGraphicSelection(); + mDocumentOverlay.hideHandle(SelectionHandle.HandleType.START); + mDocumentOverlay.hideHandle(SelectionHandle.HandleType.END); + mDocumentOverlay.hideHandle(SelectionHandle.HandleType.MIDDLE); + mDocumentOverlay.hideSelections(); + mDocumentOverlay.hideCursor(); + mDocumentOverlay.hideGraphicSelection(); LibreOfficeMainActivity.mAppContext.hideSoftKeyboard(); } @@ -306,9 +306,9 @@ public class InvalidationHandler implements Document.MessageCallback { * Handle a transition to OverlayState.SELECTION state. */ private void handleSelectionState(OverlayState previous) { - mTextCursorLayer.showHandle(SelectionHandle.HandleType.START); - mTextCursorLayer.showHandle(SelectionHandle.HandleType.END); - mTextCursorLayer.showSelections(); + mDocumentOverlay.showHandle(SelectionHandle.HandleType.START); + mDocumentOverlay.showHandle(SelectionHandle.HandleType.END); + mDocumentOverlay.showSelections(); } /** @@ -317,8 +317,8 @@ public class InvalidationHandler implements Document.MessageCallback { private void handleCursorState(OverlayState previous) { LibreOfficeMainActivity.mAppContext.showSoftKeyboard(); if (previous == OverlayState.TRANSITION) { - mTextCursorLayer.showHandle(SelectionHandle.HandleType.MIDDLE); - mTextCursorLayer.showCursor(); + mDocumentOverlay.showHandle(SelectionHandle.HandleType.MIDDLE); + mDocumentOverlay.showCursor(); } } @@ -327,13 +327,13 @@ public class InvalidationHandler implements Document.MessageCallback { */ private void handleTransitionState(OverlayState previous) { if (previous == OverlayState.SELECTION) { - mTextCursorLayer.hideHandle(SelectionHandle.HandleType.START); - mTextCursorLayer.hideHandle(SelectionHandle.HandleType.END); - mTextCursorLayer.hideSelections(); + mDocumentOverlay.hideHandle(SelectionHandle.HandleType.START); + mDocumentOverlay.hideHandle(SelectionHandle.HandleType.END); + mDocumentOverlay.hideSelections(); } else if (previous == OverlayState.CURSOR) { - mTextCursorLayer.hideHandle(SelectionHandle.HandleType.MIDDLE); + mDocumentOverlay.hideHandle(SelectionHandle.HandleType.MIDDLE); } else if (previous == OverlayState.GRAPHIC_SELECTION) { - mTextCursorLayer.hideGraphicSelection(); + mDocumentOverlay.hideGraphicSelection(); } } @@ -341,7 +341,7 @@ public class InvalidationHandler implements Document.MessageCallback { * Handle a transition to OverlayState.GRAPHIC_SELECTION state. */ private void handleGraphicSelectionState(OverlayState previous) { - mTextCursorLayer.showGraphicSelection(); + mDocumentOverlay.showGraphicSelection(); LibreOfficeMainActivity.mAppContext.hideSoftKeyboard(); } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java index c83197705536..61ec01453a1a 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -18,7 +18,7 @@ import android.widget.AdapterView; import android.widget.ListView; import android.widget.Toast; -import org.libreoffice.overlay.TextCursorLayer; +import org.libreoffice.overlay.DocumentOverlay; import org.mozilla.gecko.ZoomConstraints; import org.mozilla.gecko.gfx.GeckoLayerClient; import org.mozilla.gecko.gfx.LayerView; @@ -52,7 +52,7 @@ public class LibreOfficeMainActivity extends ActionBarActivity { private List<DocumentPartView> mDocumentPartView = new ArrayList<DocumentPartView>(); private DocumentPartViewListAdapter mDocumentPartViewListAdapter; private String mInputFile; - private TextCursorLayer mTextCursorLayer; + private DocumentOverlay mDocumentOverlay; private File mTempFile = null; private LOAbout mAbout; private ToolbarController mToolbarController; @@ -175,7 +175,7 @@ public class LibreOfficeMainActivity extends ActionBarActivity { mLayerClient.notifyReady(); // create TextCursorLayer - mTextCursorLayer = new TextCursorLayer(mAppContext, layerView); + mDocumentOverlay = new DocumentOverlay(mAppContext, layerView); } private boolean copyFileToTemp() { @@ -342,8 +342,8 @@ public class LibreOfficeMainActivity extends ActionBarActivity { alertDialog.show(); } - public TextCursorLayer getTextCursorLayer() { - return mTextCursorLayer; + public DocumentOverlay getDocumentOverlay() { + return mDocumentOverlay; } public ToolbarController getToolbarController() { diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/DocumentOverlay.java index 6624c66cb877..d28f33d306e7 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorLayer.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/DocumentOverlay.java @@ -22,19 +22,20 @@ import org.mozilla.gecko.util.FloatUtils; import java.util.List; /** - * The TextCursorLayer is a layer which is responsible for showing the cursor and - * controls its position, height and visibility. + * The DocumentOverlay is an overlay over the document. This class is responsible + * to setup the document overlay view, report visibility and position of its elements + * when they change and report any changes to the viewport. */ -public class TextCursorLayer extends Layer { - private static final String LOGTAG = TextCursorLayer.class.getSimpleName(); +public class DocumentOverlay extends Layer { + private static final String LOGTAG = DocumentOverlay.class.getSimpleName(); - private final TextCursorView mCursorView; + private final DocumentOverlayView mCursorView; private float mViewLeft; private float mViewTop; private float mViewZoom; - public TextCursorLayer(Activity context, LayerView layerView) { - mCursorView = (TextCursorView) context.findViewById(R.id.text_cursor_view); + public DocumentOverlay(Activity context, LayerView layerView) { + mCursorView = (DocumentOverlayView) context.findViewById(R.id.text_cursor_view); if (mCursorView == null) { Log.e(LOGTAG, "Failed to initialize TextCursorLayer - CursorView is null"); } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/DocumentOverlayView.java index ff11dc50cf48..7d72d3e7ef94 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/DocumentOverlayView.java @@ -9,20 +9,15 @@ package org.libreoffice.overlay; import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; 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 org.libreoffice.LOKitShell; -import org.libreoffice.R; import org.libreoffice.canvas.Cursor; import org.libreoffice.canvas.GraphicSelection; import org.libreoffice.canvas.SelectionHandle; @@ -37,10 +32,11 @@ import java.util.ArrayList; import java.util.List; /** - * Text cursor view responsible to show the cursor drawable on the screen. + * Document overlay view is responsible for showing the client drawn overlay + * elements like cursor, selection and graphic selection, and manipulate them. */ -public class TextCursorView extends View implements View.OnTouchListener { - private static final String LOGTAG = TextCursorView.class.getSimpleName(); +public class DocumentOverlayView extends View implements View.OnTouchListener { + private static final String LOGTAG = DocumentOverlayView.class.getSimpleName(); private static final int CURSOR_BLINK_TIME = 500; @@ -65,15 +61,15 @@ public class TextCursorView extends View implements View.OnTouchListener { private SelectionHandle mDragHandle = null; - public TextCursorView(Context context) { + public DocumentOverlayView(Context context) { super(context); } - public TextCursorView(Context context, AttributeSet attrs) { + public DocumentOverlayView(Context context, AttributeSet attrs) { super(context, attrs); } - public TextCursorView(Context context, AttributeSet attrs, int defStyleAttr) { + public DocumentOverlayView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } |