diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2015-10-21 15:14:32 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2015-10-21 15:17:10 +0200 |
commit | 075c4db2844146dd861a77c8d51fb8ac675f520f (patch) | |
tree | 56ffa3b11175bd0b895bf8956b893fcfb1c77d51 /android | |
parent | c8dcec92470745f07c51074404ce4250428f2255 (diff) |
android: remove MockTileProvider
Change-Id: I1b44c9fa4edfdc79e48f52ba95493f83f0421669
Diffstat (limited to 'android')
-rw-r--r-- | android/source/src/java/org/libreoffice/MockTileProvider.java | 157 | ||||
-rw-r--r-- | android/source/src/java/org/libreoffice/TileProviderFactory.java | 15 |
2 files changed, 2 insertions, 170 deletions
diff --git a/android/source/src/java/org/libreoffice/MockTileProvider.java b/android/source/src/java/org/libreoffice/MockTileProvider.java deleted file mode 100644 index 19f7b48713b3..000000000000 --- a/android/source/src/java/org/libreoffice/MockTileProvider.java +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.libreoffice; - -import android.graphics.Bitmap; -import android.graphics.PointF; -import android.view.KeyEvent; - -import org.mozilla.gecko.gfx.BufferedCairoImage; -import org.mozilla.gecko.gfx.CairoImage; -import org.mozilla.gecko.gfx.GeckoLayerClient; -import org.mozilla.gecko.gfx.IntSize; - -public class MockTileProvider implements TileProvider { - private static final int TILE_SIZE = 256; - private final GeckoLayerClient mLayerClient; - private final String inputFile; - - public MockTileProvider(GeckoLayerClient layerClient, String input) { - mLayerClient = layerClient; - this.inputFile = input; - - for (int i = 0; i < 5; i++) { - String partName = "Part " + i; - final DocumentPartView partView = new DocumentPartView(i, partName); - LibreOfficeMainActivity.mAppContext.mMainHandler.post(new Runnable() { - @Override - public void run() { - LibreOfficeMainActivity.mAppContext.getDocumentPartViewListAdapter().add(partView); - } - }); - } - LibreOfficeMainActivity.mAppContext.mMainHandler.post(new Runnable() { - @Override - public void run() { - LibreOfficeMainActivity.mAppContext.getDocumentPartViewListAdapter().notifyDataSetChanged(); - } - }); - } - - @Override - public int getPageWidth() { - return 549; - } - - @Override - public int getPageHeight() { - return 630 * 5; - } - - @Override - public boolean isReady() { - return true; - } - - @Override - public CairoImage createTile(float x, float y, IntSize tileSize, float zoom) { - int tiles = (int) (getPageWidth() / TILE_SIZE) + 1; - int tileNumber = (int) ((y / TILE_SIZE) * tiles + (x / TILE_SIZE)); - tileNumber %= 9; - tileNumber += 1; // 0 to 1 based numbering - - String imageName = "d" + tileNumber; - Bitmap bitmap = mLayerClient.getView().getDrawable(imageName); - - return new BufferedCairoImage(bitmap); - } - - @Override - public void rerenderTile(CairoImage image, float x, float y, IntSize tileSize, float zoom) { - } - - @Override - public Bitmap thumbnail(int size) { - return mLayerClient.getView().getDrawable("dummy_page"); - } - - @Override - public void close() { - } - - @Override - public boolean isTextDocument() { - return true; - } - - @Override - public boolean isSpreadsheet() { - return false; - } - - @Override - public void sendKeyEvent(KeyEvent keyEvent) { - } - - @Override - public void mouseButtonDown(PointF documentCoordinate, int numberOfClicks) { - } - - @Override - public void mouseButtonUp(PointF documentCoordinate, int numberOfClicks) { - } - - @Override - public void postUnoCommand(String command) { - } - - @Override - public void setTextSelectionStart(PointF documentCoordinate) { - } - - @Override - public void setTextSelectionEnd(PointF documentCoordinate) { - } - - @Override - public void setTextSelectionReset(PointF documentCoordinate) { - } - - @Override - public void setGraphicSelectionStart(PointF documentCoordinate) { - } - - @Override - public void setGraphicSelectionEnd(PointF documentCoordinate) { - } - - @Override - public void changePart(int partIndex) { - } - - @Override - public int getCurrentPartNumber() { - return 0; - } - - @Override - public int getPartsCount() { - return 0; - } - - @Override - public void onSwipeLeft() { - } - - @Override - public void onSwipeRight() { - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/android/source/src/java/org/libreoffice/TileProviderFactory.java b/android/source/src/java/org/libreoffice/TileProviderFactory.java index 003a7141ecf3..45b10a9b2f1a 100644 --- a/android/source/src/java/org/libreoffice/TileProviderFactory.java +++ b/android/source/src/java/org/libreoffice/TileProviderFactory.java @@ -16,27 +16,16 @@ import org.mozilla.gecko.gfx.GeckoLayerClient; * Create a desired instance of TileProvider. */ public class TileProviderFactory { - private static TileProviderID currentTileProvider = TileProviderID.LOKIT; private TileProviderFactory() { } public static void initialize() { - if (currentTileProvider == TileProviderID.LOKIT) { - LibreOfficeKit.initializeLibrary(); - } + LibreOfficeKit.initializeLibrary(); } public static TileProvider create(GeckoLayerClient layerClient, InvalidationHandler invalidationHandler, String filename) { - if (currentTileProvider == TileProviderID.LOKIT) { - return new LOKitTileProvider(layerClient, invalidationHandler, filename); - } else { - return new MockTileProvider(layerClient, filename); - } - } - - private enum TileProviderID { - MOCK, LOKIT + return new LOKitTileProvider(layerClient, invalidationHandler, filename); } } |