diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-04-14 18:07:07 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-04-14 18:07:55 +0900 |
commit | c92ceb544c0c48902b604eccd8748b139480fcca (patch) | |
tree | 6abdc0fbb7958b08e68c6381b9b69018542a4504 /android | |
parent | 98c9887e8dfe7ea8babd6d77fc81349e1739c0d5 (diff) |
android: add comments
Change-Id: I30f8180dd9cf9c94eedca61926ab706f241142df
Diffstat (limited to 'android')
11 files changed, 73 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 26ab856be1fd..bd4da2c44822 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java @@ -415,10 +415,16 @@ public class InvalidationHandler implements Document.MessageCallback { return mState; } + /** + * A key event happend (i.e. user started typing. + */ public void keyEvent() { mKeyEvent = true; } + /** + * The states the overlay. + */ public enum OverlayState { /** * State where the overlay is empty diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java index c4f628cdefa5..111ad109669d 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java @@ -12,6 +12,9 @@ import android.widget.TextView; import java.io.File; +/** + * The about dialog. + */ public class LOAbout { private static final String DEFAULT_DOC_PATH = "/assets/example.odt"; diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java index d9a20d8acf35..d76e6722cbac 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java @@ -21,7 +21,9 @@ import org.libreoffice.canvas.SelectionHandle; import org.mozilla.gecko.gfx.ComposedTileLayer; import org.mozilla.gecko.gfx.LayerView; - +/** + * Common static LOKit functions, functions to send events. + */ public class LOKitShell { private static final String LOGTAG = LOKitShell.class.getSimpleName(); diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java index 1a8c97012d2a..e0d40988dd6b 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -19,7 +19,6 @@ import android.widget.ListView; import android.widget.Toast; import org.libreoffice.overlay.DocumentOverlay; - import org.mozilla.gecko.ZoomConstraints; import org.mozilla.gecko.gfx.GeckoLayerClient; import org.mozilla.gecko.gfx.LayerView; @@ -178,8 +177,6 @@ public class LibreOfficeMainActivity extends ActionBarActivity { // create TextCursorLayer mDocumentOverlay = new DocumentOverlay(mAppContext, layerView); - - } private boolean copyFileToTemp() { diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/ThumbnailCreator.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/ThumbnailCreator.java index 142877b45abe..5532d7f90926 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/ThumbnailCreator.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/ThumbnailCreator.java @@ -16,6 +16,9 @@ import android.widget.ImageView; import java.lang.ref.WeakReference; +/** + * Create thumbnails for the parts of the document. + */ public class ThumbnailCreator { private static final String LOG_TAG = ThumbnailCreator.class.getSimpleName(); private static final int THUMBNAIL_SIZE = 256; diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CanvasElementImplRequirement.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CanvasElementImplRequirement.java index b9ad464321d8..26789e8d8916 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CanvasElementImplRequirement.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CanvasElementImplRequirement.java @@ -2,6 +2,10 @@ package org.libreoffice.canvas; import android.graphics.Canvas; +/** + * The interface defines a set of method that a typical CanvasElement + * implementation should implement. + */ interface CanvasElementImplRequirement { /** 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 5f037c0066a6..101afe4b70ac 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CommonCanvasElement.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/CommonCanvasElement.java @@ -9,16 +9,25 @@ public abstract class CommonCanvasElement implements CanvasElement, CanvasElemen private boolean mVisible = false; + /** + * Is element visible? + */ @Override public boolean isVisible() { return mVisible; } + /** + * Set element visibility. + */ @Override public void setVisible(boolean visible) { mVisible = visible; } + /** + * Trigger drawing the element on the canvas. + */ @Override public void draw(Canvas canvas) { if (isVisible()) { @@ -26,6 +35,10 @@ public abstract class CommonCanvasElement implements CanvasElement, CanvasElemen } } + /** + * Hit test. Return true if the element was hit. Directly return false if + * the element is invisible. + */ @Override public boolean contains(float x, float y) { if (!isVisible()) { diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/Cursor.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/Cursor.java index bdb8e091454c..1cd30edb7549 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/Cursor.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/Cursor.java @@ -5,6 +5,9 @@ import android.graphics.Color; import android.graphics.Paint; import android.graphics.RectF; +/** + * Handles the cursor drawing on the canvas. + */ public class Cursor extends CommonCanvasElement { private static final float CURSOR_WIDTH = 2f; private final Paint mCursorPaint = new Paint(); @@ -12,26 +15,41 @@ public class Cursor extends CommonCanvasElement { public RectF mScaledPosition = new RectF(); public int mAlpha = 0; + /** + * Construct the cursor and set the default values. + */ public Cursor() { mCursorPaint.setColor(Color.BLACK); mCursorPaint.setAlpha(0xFF); } + /** + * Hit test for cursor, always false. + */ @Override public boolean onHitTest(float x, float y) { return false; } + /** + * Draw the cursor. + */ @Override public void onDraw(Canvas canvas) { canvas.drawRect(mScaledPosition, mCursorPaint); } + /** + * Reposition the cursor on screen. + */ public void reposition(RectF rect) { mScaledPosition = rect; mScaledPosition.right = mScaledPosition.left + CURSOR_WIDTH; } + /** + * Cycle the alpha color of the cursor, makes the + */ public void cycleAlpha() { mCursorPaint.setAlpha(mCursorPaint.getAlpha() == 0 ? 0xFF : 0); } 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 d6ca907f9aa0..773975752319 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelection.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/GraphicSelection.java @@ -252,10 +252,16 @@ public class GraphicSelection extends CommonCanvasElement { } } + /** + * When a single press (no dragging happend) was performed. + */ private void onSinglePress(PointF screenPosition) { sendGraphicSelection("LongPress", screenPosition); } + /** + * Set the visibility of the graphic selection. + */ @Override public void setVisible(boolean visible) { super.setVisible(visible); diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/SelectionHandleMiddle.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/SelectionHandleMiddle.java index ab30a8bfad1d..7415d6d3dadd 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/SelectionHandleMiddle.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/canvas/SelectionHandleMiddle.java @@ -13,11 +13,11 @@ public class SelectionHandleMiddle extends SelectionHandle { super(getBitmapForDrawable(context, R.drawable.handle_middle)); } - @Override /** * Change the position of the handle on the screen. Take into account the * handle alignment to the center. */ + @Override public void reposition(float x, float y) { super.reposition(x, y); // align to the center diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/DocumentOverlayView.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/DocumentOverlayView.java index c4866df0faec..8d199e4775f7 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/DocumentOverlayView.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/DocumentOverlayView.java @@ -329,6 +329,11 @@ public class DocumentOverlayView extends View implements View.OnTouchListener { return false; } + /** + * Change the handle document position. + * @param type - the type of the handle + * @param position - the new document position + */ public void positionHandle(SelectionHandle.HandleType type, RectF position) { SelectionHandle handle = getHandleForType(type); if (RectUtils.fuzzyEquals(handle.mDocumentPosition, position)) { @@ -341,6 +346,10 @@ public class DocumentOverlayView extends View implements View.OnTouchListener { repositionWithViewport(metrics.viewportRectLeft, metrics.viewportRectTop, metrics.zoomFactor); } + /** + * Hide the handle. + * @param type - type of the handle + */ public void hideHandle(SelectionHandle.HandleType type) { SelectionHandle handle = getHandleForType(type); if (handle.isVisible()) { @@ -349,6 +358,10 @@ public class DocumentOverlayView extends View implements View.OnTouchListener { } } + /** + * Show the handle. + * @param type - type of the handle + */ public void showHandle(SelectionHandle.HandleType type) { SelectionHandle handle = getHandleForType(type); if (!handle.isVisible()) { @@ -357,6 +370,9 @@ public class DocumentOverlayView extends View implements View.OnTouchListener { } } + /** + * Returns the handle instance for the input type. + */ private SelectionHandle getHandleForType(SelectionHandle.HandleType type) { switch(type) { case START: |