summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authoraleksandar-stefanovic <theonewithideas@gmail.com>2017-01-25 19:50:19 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2017-01-31 10:47:42 +0000
commit644d92ada400e335e256215598a532f116438a1f (patch)
tree6663c5b7e69c40a878ef365cee5d5ee81d46b613 /android
parentb01ec28b6dfa84c9c9f07d08af27a0107a5260a1 (diff)
Removed static context from LOKitTileProvider
Removed references to static context, replaced them with the context object already available in the class, and changed access levels on some methods in LOKitTileProvider. Change-Id: Ib52d325650377b77ec166ddbfb760f74c19067ff Reviewed-on: https://gerrit.libreoffice.org/33554 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'android')
-rw-r--r--android/source/src/java/org/libreoffice/LOKitTileProvider.java26
1 files changed, 12 insertions, 14 deletions
diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
index a068627711fb..d0fbe9431de7 100644
--- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
@@ -19,7 +19,6 @@ import org.libreoffice.kit.LibreOfficeKit;
import org.libreoffice.kit.Office;
import org.mozilla.gecko.gfx.BufferedCairoImage;
import org.mozilla.gecko.gfx.CairoImage;
-import org.mozilla.gecko.gfx.GeckoLayerClient;
import org.mozilla.gecko.gfx.IntSize;
import java.nio.ByteBuffer;
@@ -27,7 +26,7 @@ import java.nio.ByteBuffer;
/**
* LOKit implementation of TileProvider.
*/
-public class LOKitTileProvider implements TileProvider {
+class LOKitTileProvider implements TileProvider {
private static final String LOGTAG = LOKitTileProvider.class.getSimpleName();
private static int TILE_SIZE = 256;
private final float mTileWidth;
@@ -51,7 +50,7 @@ public class LOKitTileProvider implements TileProvider {
* @param messageCallback - callback for messages retrieved from LOKit
* @param input - input path of the document
*/
- public LOKitTileProvider(LibreOfficeMainActivity context, Document.MessageCallback messageCallback, String input) {
+ LOKitTileProvider(LibreOfficeMainActivity context, Document.MessageCallback messageCallback, String input) {
mContext = context;
mMessageCallback = messageCallback;
mDPI = LOKitShell.getDpi(mContext);
@@ -59,7 +58,7 @@ public class LOKitTileProvider implements TileProvider {
mTileHeight = pixelToTwip(TILE_SIZE, mDPI);
LibreOfficeKit.putenv("SAL_LOG=+WARN+INFO");
- LibreOfficeKit.init(LibreOfficeMainActivity.mAppContext);
+ LibreOfficeKit.init(mContext);
mOffice = new Office(LibreOfficeKit.getLibreOfficeKitHandle());
@@ -100,8 +99,7 @@ public class LOKitTileProvider implements TileProvider {
int parts = mDocument.getParts();
Log.i(LOGTAG, "Document parts: " + parts);
-
- LibreOfficeMainActivity.mAppContext.getDocumentPartView().clear();
+ mContext.getDocumentPartView().clear();
// Writer documents always have one part, so hide the navigation drawer.
if (mDocument.getDocumentType() != Document.DOCTYPE_TEXT) {
@@ -115,10 +113,10 @@ public class LOKitTileProvider implements TileProvider {
mDocument.setPart(i);
resetDocumentSize();
final DocumentPartView partView = new DocumentPartView(i, partName);
- LibreOfficeMainActivity.mAppContext.getDocumentPartView().add(partView);
+ mContext.getDocumentPartView().add(partView);
}
} else {
- LibreOfficeMainActivity.mAppContext.disableNavigationDrawer();
+ mContext.disableNavigationDrawer();
}
mDocument.setPart(0);
@@ -128,7 +126,7 @@ public class LOKitTileProvider implements TileProvider {
LOKitShell.getMainHandler().post(new Runnable() {
@Override
public void run() {
- LibreOfficeMainActivity.mAppContext.getDocumentPartViewListAdapter().notifyDataSetChanged();
+ mContext.getDocumentPartViewListAdapter().notifyDataSetChanged();
}
});
}
@@ -160,11 +158,11 @@ public class LOKitTileProvider implements TileProvider {
}
}
- public static float twipToPixel(float input, float dpi) {
+ static float twipToPixel(float input, float dpi) {
return input / 1440.0f * dpi;
}
- public static float pixelToTwip(float input, float dpi) {
+ private static float pixelToTwip(float input, float dpi) {
return (input / dpi) * 1440.0f;
}
@@ -218,7 +216,7 @@ public class LOKitTileProvider implements TileProvider {
LOKitShell.getMainHandler().post(new Runnable() {
@Override
public void run() {
- LibreOfficeMainActivity.mAppContext.showAlertDialog(message);
+ mContext.showAlertDialog(message);
}
});
}
@@ -416,7 +414,7 @@ public class LOKitTileProvider implements TileProvider {
}
/**
- * @see TileProvider#mouseButtonDown(android.graphics.PointF, int)
+ * @see TileProvider#mouseButtonDown(android.graphics.PointF, int, float)
*/
@Override
public void mouseButtonDown(PointF documentCoordinate, int numberOfClicks, float zoomFactor) {
@@ -424,7 +422,7 @@ public class LOKitTileProvider implements TileProvider {
}
/**
- * @see TileProvider#mouseButtonUp(android.graphics.PointF, int)
+ * @see TileProvider#mouseButtonUp(android.graphics.PointF, int, float)
*/
@Override
public void mouseButtonUp(PointF documentCoordinate, int numberOfClicks, float zoomFactor) {