summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-03-17 14:38:49 +0900
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-03-23 09:18:59 +0100
commitf0f0ce28b0d13647476dd725d70e54a6c3c1973a (patch)
tree7925ea2157b9f74260b6d71221cb68b7d5806803 /android
parenta212fc2c00fc0c7f348aa6908b113b8ff3adbe56 (diff)
android: add comment to many classes and methods
Change-Id: I49d9bd7c702c260ea66ef211edbaf5e106264bb6
Diffstat (limited to 'android')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java51
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java3
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java18
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java49
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java74
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java3
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java30
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java12
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java15
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/TileProviderFactory.java3
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/ToolbarController.java11
-rw-r--r--android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java23
-rw-r--r--android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelectionHandle.java3
-rw-r--r--android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/RenderControllerThread.java4
14 files changed, 294 insertions, 5 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
index d94c93a047f2..6bbe1108f413 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
@@ -29,6 +29,10 @@ public class InvalidationHandler implements Document.MessageCallback {
mState = OverlayState.NONE;
}
+ /**
+ * Sets the tile provider, without this the
+ * @param tileProvider
+ */
public void setTileProvider(TileProvider tileProvider) {
mTileProvider = tileProvider;
}
@@ -244,10 +248,19 @@ public class InvalidationHandler implements Document.MessageCallback {
}
}
+ /**
+ * Trigger a transition to a new overlay state.
+ * @param next - new state to transition to
+ */
public synchronized void changeStateTo(OverlayState next) {
changeState(mState, next);
}
+ /**
+ * Executes a transition from old overlay state to a new overlay state.
+ * @param previous - old state
+ * @param next - new state
+ */
private synchronized void changeState(OverlayState previous, OverlayState next) {
mState = next;
handleGeneralChangeState(previous, next);
@@ -270,6 +283,9 @@ public class InvalidationHandler implements Document.MessageCallback {
}
}
+ /**
+ * Handle a general transition - executed for all transitions.
+ */
private void handleGeneralChangeState(OverlayState previous, OverlayState next) {
if (previous == OverlayState.NONE) {
LOKitShell.getToolbarController().switchToEditMode();
@@ -278,6 +294,9 @@ public class InvalidationHandler implements Document.MessageCallback {
}
}
+ /**
+ * Handle a transition to OverlayState.NONE state.
+ */
private void handleNoneState(OverlayState previous) {
if (previous == OverlayState.NONE) {
return;
@@ -293,12 +312,18 @@ public class InvalidationHandler implements Document.MessageCallback {
LibreOfficeMainActivity.mAppContext.hideSoftKeyboard();
}
+ /**
+ * Handle a transition to OverlayState.SELECTION state.
+ */
private void handleSelectionState(OverlayState previous) {
mTextSelection.showHandle(TextSelectionHandle.HandleType.START);
mTextSelection.showHandle(TextSelectionHandle.HandleType.END);
mTextCursorLayer.showSelections();
}
+ /**
+ * Handle a transition to OverlayState.CURSOR state.
+ */
private void handleCursorState(OverlayState previous) {
LibreOfficeMainActivity.mAppContext.showSoftKeyboard();
if (previous == OverlayState.TRANSITION) {
@@ -307,6 +332,9 @@ public class InvalidationHandler implements Document.MessageCallback {
}
}
+ /**
+ * Handle a transition to OverlayState.TRANSITION state.
+ */
private void handleTransitionState(OverlayState previous) {
if (previous == OverlayState.SELECTION) {
mTextSelection.hideHandle(TextSelectionHandle.HandleType.START);
@@ -319,20 +347,43 @@ public class InvalidationHandler implements Document.MessageCallback {
}
}
+ /**
+ * Handle a transition to OverlayState.GRAPHIC_SELECTION state.
+ */
private void handleGraphicSelectionState(OverlayState previous) {
mTextCursorLayer.showGraphicSelection();
LibreOfficeMainActivity.mAppContext.hideSoftKeyboard();
}
+ /**
+ * The current state the overlay is in.
+ */
public OverlayState getCurrentState() {
return mState;
}
public enum OverlayState {
+ /**
+ * State where the overlay is empty
+ */
NONE,
+ /**
+ * In-between state where we need to transition to a new overlay state.
+ * In this state we properly disable the older state and wait to transition
+ * to a new state triggered by an invalidation.
+ */
TRANSITION,
+ /**
+ * State where we operate with the cursor.
+ */
CURSOR,
+ /**
+ * State where we operate the graphic selection.
+ */
GRAPHIC_SELECTION,
+ /**
+ * State where we operate the text selection.
+ */
SELECTION
}
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java
index c163337e79e2..12f2731e5389 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java
@@ -18,6 +18,9 @@ import org.mozilla.gecko.gfx.ComposedTileLayer;
import org.mozilla.gecko.gfx.IntSize;
import org.mozilla.gecko.gfx.SubTile;
+/**
+ * Events and data that is queued and processed by LOKitThread.
+ */
public class LOEvent implements Comparable<LOEvent> {
public static final int SIZE_CHANGED = 1;
public static final int CHANGE_PART = 2;
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java
index be202c67a68e..6e82692972ea 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java
@@ -14,6 +14,9 @@ import android.view.inputmethod.InputConnection;
import org.mozilla.gecko.gfx.InputConnectionHandler;
+/**
+ * Implementation of InputConnectionHandler.When a key event happens it is directed to this class which is then directed further to LOKitThread.
+ */
public class LOKitInputConnectionHandler implements InputConnectionHandler {
private static String LOGTAG = LOKitInputConnectionHandler.class.getSimpleName();
@@ -22,29 +25,44 @@ public class LOKitInputConnectionHandler implements InputConnectionHandler {
return null;
}
+ /**
+ * When key pre-Ime happens.
+ */
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
LOKitShell.sendKeyEvent(event);
return false;
}
+ /**
+ * When key down event happens.
+ */
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
LOKitShell.sendKeyEvent(event);
return false;
}
+ /**
+ * When key long press event happens.
+ */
@Override
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
return false;
}
+ /**
+ * When key multiple event happens. Key multiple event is triggered when non-ascii characters are entered on soft keyboard
+ */
@Override
public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
LOKitShell.sendKeyEvent(event);
return false;
}
+ /**
+ * When key up event happens.
+ */
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
LOKitShell.sendKeyEvent(event);
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index 12e48999e1b1..7cc4b6e1ef6f 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
@@ -16,6 +16,10 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
+/**
+ * Thread that communicates with LibreOffice through LibreOfficeKit JNI interface. The thread
+ * consumes events from other threads (maininly the UI thread) and acts accordingly.
+ */
public class LOKitThread extends Thread {
private static final String LOGTAG = LOKitThread.class.getSimpleName();
@@ -32,6 +36,9 @@ public class LOKitThread extends Thread {
TileProviderFactory.initialize();
}
+ /**
+ * Starting point of the thread. Processes events that gather in the queue.
+ */
@Override
public void run() {
while (true) {
@@ -45,7 +52,9 @@ public class LOKitThread extends Thread {
}
}
- /* Viewport changed, recheck if tiles need to be added / removed */
+ /**
+ * Viewport changed, Recheck if tiles need to be added / removed.
+ */
private void tileReevaluationRequest(ComposedTileLayer composedTileLayer) {
if (mTileProvider == null) {
return;
@@ -74,7 +83,9 @@ public class LOKitThread extends Thread {
mLayerClient.forceRender();
}
- /* Invalidate tiles that intersect the input rect */
+ /**
+ * Invalidate tiles that intersect the input rect.
+ */
private void tileInvalidation(RectF rect) {
if (mLayerClient == null || mTileProvider == null) {
return;
@@ -113,6 +124,9 @@ public class LOKitThread extends Thread {
mLayerClient.forceRender();
}
+ /**
+ * Reposition the view (zoom and position) when the document is firstly shown. This is document type dependent.
+ */
private void zoomAndRepositionTheDocument() {
if (mTileProvider.isSpreadsheet()) {
// Don't do anything for spreadsheets - show at 100%
@@ -139,6 +153,9 @@ public class LOKitThread extends Thread {
redraw();
}
+ /**
+ * Change part of the document.
+ */
private void changePart(int partIndex) {
LOKitShell.showProgressSpinner();
mTileProvider.changePart(partIndex);
@@ -148,6 +165,10 @@ public class LOKitThread extends Thread {
LOKitShell.hideProgressSpinner();
}
+ /**
+ * Handle load document event.
+ * @param filename - filename where the document is located
+ */
private void loadDocument(String filename) {
if (mApplication == null) {
mApplication = LibreOfficeMainActivity.mAppContext;
@@ -168,6 +189,9 @@ public class LOKitThread extends Thread {
}
}
+ /**
+ * Close the currently loaded document.
+ */
public void closeDocument() {
if (mTileProvider != null) {
mTileProvider.close();
@@ -175,6 +199,9 @@ public class LOKitThread extends Thread {
}
}
+ /**
+ * Process the input event.
+ */
private void processEvent(LOEvent event) {
switch (event.mType) {
case LOEvent.LOAD:
@@ -222,6 +249,9 @@ public class LOKitThread extends Thread {
}
}
+ /**
+ * Request a change of the handle position.
+ */
private void changeHandlePosition(TextSelectionHandle.HandleType handleType, PointF documentCoordinate) {
if (handleType == TextSelectionHandle.HandleType.MIDDLE) {
mTileProvider.setTextSelectionReset(documentCoordinate);
@@ -245,10 +275,16 @@ public class LOKitThread extends Thread {
mTileProvider.sendKeyEvent(keyEvent);
}
+ /**
+ * Process swipe left event.
+ */
private void onSwipeLeft() {
mTileProvider.onSwipeLeft();
}
+ /**
+ * Process swipe right event.
+ */
private void onSwipeRight() {
mTileProvider.onSwipeRight();
}
@@ -276,15 +312,24 @@ public class LOKitThread extends Thread {
}
}
+ /**
+ * Create thumbnail for the requested document task.
+ */
private void createThumbnail(final ThumbnailCreator.ThumbnailCreationTask task) {
final Bitmap bitmap = task.getThumbnail(mTileProvider);
task.applyBitmap(bitmap);
}
+ /**
+ * Queue an event.
+ */
public void queueEvent(LOEvent event) {
mEventQueue.add(event);
}
+ /**
+ * Clear all events in the queue (used when document is closed).
+ */
public void clearQueue() {
mEventQueue.clear();
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
index 1eb5dcf94098..45603d742f59 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
@@ -48,6 +48,12 @@ public class LOKitTileProvider implements TileProvider {
private long objectCreationTime = System.currentTimeMillis();
+ /**
+ * Initialize LOKit and load the document.
+ * @param layerClient - layerclient implementation
+ * @param messageCallback - callback for messages retrieved from LOKit
+ * @param input - input path of the document
+ */
public LOKitTileProvider(GeckoLayerClient layerClient, Document.MessageCallback messageCallback, String input) {
mLayerClient = layerClient;
mMessageCallback = messageCallback;
@@ -89,7 +95,10 @@ public class LOKitTileProvider implements TileProvider {
}
}
- public void postLoad() {
+ /**
+ * Triggered after the document is loaded.
+ */
+ private void postLoad() {
mDocument.setMessageCallback(mMessageCallback);
int parts = mDocument.getParts();
@@ -151,11 +160,18 @@ public class LOKitTileProvider implements TileProvider {
return (input / dpi) * 1440.0f;
}
+
+ /**
+ * @see TileProvider#getPartsCount()
+ */
@Override
public int getPartsCount() {
return mDocument.getParts();
}
+ /**
+ * @see TileProvider#onSwipeLeft()
+ */
@Override
public void onSwipeLeft() {
if (mDocument.getDocumentType() == Document.DOCTYPE_PRESENTATION &&
@@ -164,6 +180,9 @@ public class LOKitTileProvider implements TileProvider {
}
}
+ /**
+ * @see TileProvider#onSwipeRight()
+ */
@Override
public void onSwipeRight() {
if (mDocument.getDocumentType() == Document.DOCTYPE_PRESENTATION &&
@@ -213,21 +232,33 @@ public class LOKitTileProvider implements TileProvider {
return true;
}
+ /**
+ * @see TileProvider#getPageWidth()
+ */
@Override
public int getPageWidth() {
return (int) twipToPixel(mWidthTwip, mDPI);
}
+ /**
+ * @see TileProvider#getPageHeight()
+ */
@Override
public int getPageHeight() {
return (int) twipToPixel(mHeightTwip, mDPI);
}
+ /**
+ * @see TileProvider#isReady()
+ */
@Override
public boolean isReady() {
return mIsReady;
}
+ /**
+ * @see TileProvider#createTile(float, float, org.mozilla.gecko.gfx.IntSize, float)
+ */
@Override
public CairoImage createTile(float x, float y, IntSize tileSize, float zoom) {
ByteBuffer buffer = DirectBufferAllocator.guardedAllocate(tileSize.width * tileSize.height * 4);
@@ -239,6 +270,9 @@ public class LOKitTileProvider implements TileProvider {
return image;
}
+ /**
+ * @see TileProvider#rerenderTile(org.mozilla.gecko.gfx.CairoImage, float, float, org.mozilla.gecko.gfx.IntSize, float)
+ */
@Override
public void rerenderTile(CairoImage image, float x, float y, IntSize tileSize, float zoom) {
if (mDocument != null && image.getBuffer() != null) {
@@ -260,6 +294,9 @@ public class LOKitTileProvider implements TileProvider {
}
}
+ /**
+ * @see TileProvider#thumbnail(int)
+ */
@Override
public Bitmap thumbnail(int size) {
int widthPixel = getPageWidth();
@@ -289,6 +326,9 @@ public class LOKitTileProvider implements TileProvider {
return bitmap;
}
+ /**
+ * @see TileProvider#close()
+ */
@Override
public void close() {
Log.i(LOGTAG, "Document destroyed: " + mInputFile);
@@ -298,11 +338,17 @@ public class LOKitTileProvider implements TileProvider {
}
}
+ /**
+ * @see TileProvider#isTextDocument()
+ */
@Override
public boolean isTextDocument() {
return mDocument != null && mDocument.getDocumentType() == Document.DOCTYPE_TEXT;
}
+ /**
+ * @see TileProvider#isSpreadsheet()
+ */
@Override
public boolean isSpreadsheet() {
return mDocument != null && mDocument.getDocumentType() == Document.DOCTYPE_SPREADSHEET;
@@ -335,6 +381,9 @@ public class LOKitTileProvider implements TileProvider {
return 0;
}
+ /**
+ * @see TileProvider#sendKeyEvent(android.view.KeyEvent)
+ */
@Override
public void sendKeyEvent(KeyEvent keyEvent) {
if (keyEvent.getAction() == KeyEvent.ACTION_MULTIPLE) {
@@ -357,11 +406,17 @@ public class LOKitTileProvider implements TileProvider {
mDocument.postMouseEvent(type, x, y, numberOfClicks);
}
+ /**
+ * @see TileProvider#mouseButtonDown(android.graphics.PointF, int)
+ */
@Override
public void mouseButtonDown(PointF documentCoordinate, int numberOfClicks) {
mouseButton(Document.MOUSE_BUTTON_DOWN, documentCoordinate, numberOfClicks);
}
+ /**
+ * @see TileProvider#mouseButtonUp(android.graphics.PointF, int)
+ */
@Override
public void mouseButtonUp(PointF documentCoordinate, int numberOfClicks) {
mouseButton(Document.MOUSE_BUTTON_UP, documentCoordinate, numberOfClicks);
@@ -378,16 +433,25 @@ public class LOKitTileProvider implements TileProvider {
mDocument.setTextSelection(type, x, y);
}
+ /**
+ * @see TileProvider#setTextSelectionStart(android.graphics.PointF)
+ */
@Override
public void setTextSelectionStart(PointF documentCoordinate) {
setTextSelection(Document.SET_TEXT_SELECTION_START, documentCoordinate);
}
+ /**
+ * @see TileProvider#setTextSelectionEnd(android.graphics.PointF)
+ */
@Override
public void setTextSelectionEnd(PointF documentCoordinate) {
setTextSelection(Document.SET_TEXT_SELECTION_END, documentCoordinate);
}
+ /**
+ * @see TileProvider#setTextSelectionReset(android.graphics.PointF)
+ */
@Override
public void setTextSelectionReset(PointF documentCoordinate) {
setTextSelection(Document.SET_TEXT_SELECTION_RESET, documentCoordinate);
@@ -399,6 +463,9 @@ public class LOKitTileProvider implements TileProvider {
super.finalize();
}
+ /**
+ * @see TileProvider#changePart(int)
+ */
@Override
public void changePart(int partIndex) {
if (mDocument == null)
@@ -408,6 +475,9 @@ public class LOKitTileProvider implements TileProvider {
resetDocumentSize();
}
+ /**
+ * @see TileProvider#getCurrentPartNumber()
+ */
@Override
public int getCurrentPartNumber() {
if (mDocument == null)
@@ -417,4 +487,4 @@ public class LOKitTileProvider implements TileProvider {
}
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
index 48f7850d409a..3c573019c825 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -34,6 +34,9 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
+/**
+ * Main activity of the LibreOffice App. It is started in the UI thread.
+ */
public class LibreOfficeMainActivity extends ActionBarActivity {
private static final String LOGTAG = "LibreOfficeMainActivity";
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java
index 5f303b6c2a04..8c044ed68c03 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java
@@ -38,6 +38,9 @@ public class TextCursorLayer extends Layer {
}
}
+ /**
+ * @see Layer#draw(org.mozilla.gecko.gfx.Layer.RenderContext)
+ */
@Override
public void draw(final RenderContext context) {
if (FloatUtils.fuzzyEquals(mViewLeft, context.viewport.left)
@@ -57,6 +60,9 @@ public class TextCursorLayer extends Layer {
});
}
+ /**
+ * Show the cursor at the defined cursor position on the overlay.
+ */
public void showCursor() {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
@@ -72,6 +78,9 @@ public class TextCursorLayer extends Layer {
});
}
+ /**
+ * Hide the cursor at the defined cursor position on the overlay.
+ */
public void hideCursor() {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
@@ -80,6 +89,9 @@ public class TextCursorLayer extends Layer {
});
}
+ /**
+ * Position the cursor to the input position on the overlay.
+ */
public void positionCursor(final RectF position) {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
@@ -88,6 +100,9 @@ public class TextCursorLayer extends Layer {
});
}
+ /**
+ * Show selections on the overlay.
+ */
public void showSelections() {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
@@ -100,6 +115,9 @@ public class TextCursorLayer extends Layer {
});
}
+ /**
+ * Hide selections on the overlay.
+ */
public void hideSelections() {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
@@ -108,6 +126,9 @@ public class TextCursorLayer extends Layer {
});
}
+ /**
+ * Change the list of selections.
+ */
public void changeSelections(final List<RectF> selections) {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
@@ -116,6 +137,9 @@ public class TextCursorLayer extends Layer {
});
}
+ /**
+ * Show the graphic selection on the overlay.
+ */
public void showGraphicSelection() {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
@@ -124,6 +148,9 @@ public class TextCursorLayer extends Layer {
});
}
+ /**
+ * Hide the graphic selection on the overlay.
+ */
public void hideGraphicSelection() {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
@@ -132,6 +159,9 @@ public class TextCursorLayer extends Layer {
});
}
+ /**
+ * Change the graphic selection rectangle to the input rectangle.
+ */
public void changeGraphicSelection(final RectF rectangle) {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java
index 9cc31defebc8..bdd7cbcde6a3 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java
@@ -13,6 +13,9 @@ import android.graphics.RectF;
import org.mozilla.gecko.gfx.IntSize;
+/**
+ * Identifies the tile by its position (x and y coordinate on the document), zoom and tile size (currently static)
+ */
public class TileIdentifier {
public final int x;
public final int y;
@@ -26,10 +29,16 @@ public class TileIdentifier {
this.size = size;
}
+ /**
+ * Returns a rectangle of the tiles position in scaled coordinates.
+ */
public RectF getRectF() {
return new RectF(x, y, x + size.width, y + size.height);
}
+ /**
+ * Returns a rectangle of the tiles position in non-scaled coordinates (coordinates as the zoom would be 1).
+ */
public RectF getCSSRectF() {
float cssX = x / zoom;
float cssY = y / zoom;
@@ -38,6 +47,9 @@ public class TileIdentifier {
return new RectF(cssX, cssY, cssX + cssSizeW, cssY + cssSizeH);
}
+ /**
+ * Returns a integer rectangle of the tiles position in non-scaled and rounded coordinates (coordinates as the zoom would be 1).
+ */
public Rect getCSSRect() {
float cssX = x / zoom;
float cssY = y / zoom;
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
index 26eeb880059c..701806ecdb46 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
@@ -17,6 +17,9 @@ import android.view.KeyEvent;
import org.mozilla.gecko.gfx.CairoImage;
import org.mozilla.gecko.gfx.IntSize;
+/**
+ * Provides the tiles and other document information.
+ */
public interface TileProvider {
/**
* Returns the page width in pixels.
@@ -114,10 +117,22 @@ public interface TileProvider {
*/
void postUnoCommand(String command);
+ /**
+ * Send text selection start coordinate.
+ * @param documentCoordinate
+ */
void setTextSelectionStart(PointF documentCoordinate);
+ /**
+ * Send text selection end coordinate.
+ * @param documentCoordinate
+ */
void setTextSelectionEnd(PointF documentCoordinate);
+ /**
+ * Send text selection reset coordinate.
+ * @param documentCoordinate
+ */
void setTextSelectionReset(PointF documentCoordinate);
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProviderFactory.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProviderFactory.java
index 7835243598b4..6dff903a12d2 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProviderFactory.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProviderFactory.java
@@ -12,6 +12,9 @@ package org.libreoffice;
import org.libreoffice.kit.LibreOfficeKit;
import org.mozilla.gecko.gfx.GeckoLayerClient;
+/**
+ * Create a desired instance of TileProvider.
+ */
public class TileProviderFactory {
private static TileProviderID currentTileProvider = TileProviderID.LOKIT;
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/ToolbarController.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/ToolbarController.java
index 688436ca728c..504c2f3a1128 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/ToolbarController.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/ToolbarController.java
@@ -11,6 +11,9 @@ package org.libreoffice;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
+/**
+ * Controls the changes to the toolbar.
+ */
public class ToolbarController {
private final Toolbar mToolbar;
private final ActionBar mActionBar;
@@ -21,7 +24,11 @@ public class ToolbarController {
switchToViewMode();
}
+ /**
+ * Change the toolbar to edit mode.
+ */
void switchToEditMode() {
+ // Insure the change is done on UI thread
LOKitShell.getMainHandler().post(new Runnable() {
@Override
public void run() {
@@ -33,7 +40,11 @@ public class ToolbarController {
});
}
+ /**
+ * Change the toolbar to view mode.
+ */
void switchToViewMode() {
+ // Insure the change is done on UI thread
LOKitShell.getMainHandler().post(new Runnable() {
@Override
public void run() {
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 94f9b904794e..52aa5554fb4b 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java
@@ -18,6 +18,10 @@ import org.mozilla.gecko.util.FloatUtils;
import static org.mozilla.gecko.TextSelectionHandle.HandleType.MIDDLE;
import static org.mozilla.gecko.TextSelectionHandle.HandleType.START;
+/**
+ * TextSelection operates the text selection (start, middle and end) handles. It is a Layer implementation
+ * that intercepts viewport changes and repositions the text handles accordingly.
+ */
public class TextSelection extends Layer {
private static final String LOGTAG = "GeckoTextSelection";
@@ -40,9 +44,15 @@ public class TextSelection extends Layer {
}
}
+ /**
+ * Destroys created resources if any were created.
+ */
void destroy() {
}
+ /**
+ * Reposition the handles when draw happens.
+ */
@Override
public void draw(final RenderContext context) {
// cache the relevant values from the context and bail out if they are the same. we do this
@@ -66,6 +76,9 @@ public class TextSelection extends Layer {
});
}
+ /**
+ * Shows the requested handle.
+ */
public void showHandle(final TextSelectionHandle.HandleType handleType) {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
@@ -84,6 +97,9 @@ public class TextSelection extends Layer {
});
}
+ /**
+ * Get instance of the requested handle type..
+ */
private TextSelectionHandle getHandle(TextSelectionHandle.HandleType handleType) {
if (handleType == START) {
return mStartHandle;
@@ -94,6 +110,9 @@ public class TextSelection extends Layer {
}
}
+ /**
+ * Hides the requested handle.
+ */
public void hideHandle(final TextSelectionHandle.HandleType handleType) {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
@@ -103,7 +122,9 @@ public class TextSelection extends Layer {
});
}
-
+ /**
+ * Position the handle requested handle to the input rectangle (expressed in document coordinates)
+ */
public void positionHandle(final TextSelectionHandle.HandleType handleType, final RectF position) {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelectionHandle.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelectionHandle.java
index 1a7ac9791461..aa4bec6d3e80 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelectionHandle.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelectionHandle.java
@@ -21,6 +21,9 @@ import org.libreoffice.R;
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
import org.mozilla.gecko.gfx.LayerView;
+/**
+ * Custom image view used for showing the text selection handles.
+ */
public class TextSelectionHandle extends ImageView implements View.OnTouchListener {
private static final String LOGTAG = TextSelectionHandle.class.getSimpleName();
private long mLastTime = 0;
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/RenderControllerThread.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/RenderControllerThread.java
index dc211c4d40c7..06f82f158366 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/RenderControllerThread.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/RenderControllerThread.java
@@ -6,6 +6,10 @@ import java.util.concurrent.LinkedBlockingQueue;
import javax.microedition.khronos.opengles.GL10;
+/**
+ * Thread which controls the rendering to OpenGL context. Render commands are queued and
+ * processed and delegated by this thread.
+ */
public class RenderControllerThread extends Thread implements LayerView.Listener {
private LinkedBlockingQueue<RenderCommand> queue = new LinkedBlockingQueue<RenderCommand>();
private GLController controller;