diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-02-15 11:45:56 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-23 10:10:19 +0100 |
commit | 172eec516df02a76dcdade5314629e446d8dcdf6 (patch) | |
tree | a2343e0c5592e8be78449c703dc0c0ec4dbdf583 /android/experimental | |
parent | 54b231e7c867b3a36730e23ddca3e12a406be00f (diff) |
android: remove LOEventFactory
Change-Id: I46809f24337e56b47a379eb4c482251b97337fd9
Diffstat (limited to 'android/experimental')
7 files changed, 40 insertions, 56 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java index b34b2c4a0e0e..47ecddf6a613 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java @@ -31,8 +31,8 @@ public abstract class LOAbout extends Activity { i.setComponent(componentName); startActivity(i); } else { - LOKitShell.sendEvent(LOEventFactory.close()); - LOKitShell.sendEvent(LOEventFactory.load(input)); + LOKitShell.sendCloseEvent(); + LOKitShell.sendLoadEvent(input); } } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEventFactory.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEventFactory.java deleted file mode 100644 index 71bceb2c8d92..000000000000 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEventFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.libreoffice; - -import org.mozilla.gecko.gfx.ComposedTileLayer; -import org.mozilla.gecko.gfx.IntSize; - - -public class LOEventFactory { - public static LOEvent sizeChanged(int widthPixels, int heightPixels) { - return new LOEvent(LOEvent.SIZE_CHANGED, widthPixels, heightPixels); - } - - public static LOEvent tileSize(IntSize tileSize) { - return new LOEvent(LOEvent.TILE_SIZE, tileSize); - } - - public static LOEvent changePart(int part) { - return new LOEvent(LOEvent.CHANGE_PART, part); - } - - public static LOEvent load(String inputFile) { - return new LOEvent(LOEvent.LOAD, inputFile); - } - - public static LOEvent close() { - return new LOEvent(LOEvent.CLOSE); - } - - public static LOEvent redraw() { - return new LOEvent(LOEvent.REDRAW); - } - - public static LOEvent tileRequest(ComposedTileLayer composedTileLayer, TileIdentifier tileID, boolean forceRedraw) { - return new LOEvent(LOEvent.TILE_REQUEST, composedTileLayer, tileID); - } - - public static LOEvent thumbnail(ThumbnailCreator.ThumbnailCreationTask task) { - return new LOEvent(LOEvent.THUMBNAIL, task); - } -} diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java index 401608e68b3a..fd54bbfb5b09 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java @@ -9,6 +9,7 @@ import android.util.DisplayMetrics; import android.view.KeyEvent; import android.view.MotionEvent; +import org.mozilla.gecko.gfx.ComposedTileLayer; import org.mozilla.gecko.gfx.LayerView; @@ -57,6 +58,14 @@ public class LOKitShell { return metrics; } + public static boolean isEditingEnabled() { + return false; + } + + public static LayerView getLayerView() { + return LibreOfficeMainActivity.mAppContext.getLayerClient().getView(); + } + // EVENTS /** @@ -93,11 +102,30 @@ public class LOKitShell { LOKitShell.sendEvent(new LOEvent(LOEvent.KEY_EVENT, "KeyRelease", event)); } - public static boolean isEditingEnabled() { - return false; + public static void sendSizeChangedEvent(int width, int height) { + LOKitShell.sendEvent(new LOEvent(LOEvent.SIZE_CHANGED, width, height)); } - public static LayerView getLayerView() { - return LibreOfficeMainActivity.mAppContext.getLayerClient().getView(); + public static void sendChangePartEvent(int part) { + LOKitShell.sendEvent(new LOEvent(LOEvent.CHANGE_PART, part)); + } + + public static void sendLoadEvent(String inputFile) { + LOKitShell.sendEvent(new LOEvent(LOEvent.LOAD, inputFile)); + } + + public static void sendCloseEvent() { + LOKitShell.sendEvent(new LOEvent(LOEvent.CLOSE)); } + + public static void sendRedrawEvent() { + LOKitShell.sendEvent(new LOEvent(LOEvent.REDRAW)); + } + + public static void sendTileRequestEvent(ComposedTileLayer composedTileLayer, TileIdentifier tileID, boolean forceRedraw, int priority) { + LOEvent event = new LOEvent(LOEvent.TILE_REQUEST, composedTileLayer, tileID); + event.mPriority = priority; + LOKitShell.sendEvent(event); + } + } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java index ad4d92095774..0b87a59da8b6 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -192,13 +192,13 @@ public class LibreOfficeMainActivity extends LOAbout { protected void onStart() { Log.i(LOGTAG, "onStart.."); super.onStart(); - LOKitShell.sendEvent(LOEventFactory.load(mInputFile)); + LOKitShell.sendLoadEvent(mInputFile); } @Override protected void onStop() { Log.i(LOGTAG, "onStop.."); - LOKitShell.sendEvent(LOEventFactory.close()); + LOKitShell.sendCloseEvent(); super.onStop(); } @@ -293,7 +293,7 @@ public class LibreOfficeMainActivity extends LOAbout { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { DocumentPartView partView = mDocumentPartViewListAdapter.getItem(position); - LOKitShell.sendEvent(LOEventFactory.changePart(partView.partIndex)); + LOKitShell.sendChangePartEvent(partView.partIndex); mDrawerLayout.closeDrawer(mDrawerList); } } diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java index 02fa4fa12bc5..8bbcb2bb9ed8 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java @@ -8,7 +8,6 @@ import android.graphics.Region; import android.util.Log; import org.libreoffice.LOEvent; -import org.libreoffice.LOEventFactory; import org.libreoffice.LOKitShell; import org.libreoffice.TileIdentifier; import org.mozilla.gecko.util.FloatUtils; @@ -162,9 +161,7 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba } if (!contains) { TileIdentifier tileId = new TileIdentifier((int) x, (int) y, currentZoom, tileSize); - LOEvent event = LOEventFactory.tileRequest(this, tileId, true); - event.mPriority = getTilePriority(); - LOKitShell.sendEvent(event); + LOKitShell.sendTileRequestEvent(this, tileId, true, getTilePriority()); } } } diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java index 93beb3da45b1..4c3f87a38e35 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java @@ -13,7 +13,6 @@ import android.util.DisplayMetrics; import android.util.Log; import org.libreoffice.LOEvent; -import org.libreoffice.LOEventFactory; import org.libreoffice.LOKitShell; import org.libreoffice.LOKitThread; import org.mozilla.gecko.ZoomConstraints; @@ -156,8 +155,7 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener { mScreenSize = newScreenSize; - LOEvent event = LOEventFactory.sizeChanged(mScreenSize.width, mScreenSize.height); - LOKitShell.sendEvent(event); + LOKitShell.sendSizeChangedEvent(mScreenSize.width, mScreenSize.height); } /** diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java index 342dc3c12086..42750df62838 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java @@ -253,4 +253,4 @@ public class SubTile extends Layer { GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); } } -} +}
\ No newline at end of file |