android/source/src/java/org/libreoffice/LOKitTileProvider.java | 26 ++++------ 1 file changed, 12 insertions(+), 14 deletions(-)
New commits: commit 644d92ada400e335e256215598a532f116438a1f Author: aleksandar-stefanovic <theonewithid...@gmail.com> Date: Wed Jan 25 19:50:19 2017 +0100 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 <c...@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java index a068627..d0fbe94 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) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits