diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-02-20 14:51:40 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-23 10:10:28 +0100 |
commit | d103037d0f8ab10f98e59c40c37e14df4830f123 (patch) | |
tree | ab3cb8ab4383dfa5b4ae2786c12e67e8acbe8fcd /android | |
parent | b3fd1d5e5670c79e61c3ba19a04aa0cf0d429212 (diff) |
android: no need for TileInvalidationCallback
We can just handle the tile invalidation messaged directly in
LOKitTileProvider where we just send a tile invalidation event to
LOKitThread. This is needed as we aren't in the correct thread.
Change-Id: I62995f2f9abfa7496e0793549b8e02ff47b1ed65
Diffstat (limited to 'android')
5 files changed, 7 insertions, 44 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java index 1e3036c3cbdf..2037e9dddcd4 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java @@ -4,6 +4,7 @@ package org.libreoffice; import android.app.ActivityManager; import android.content.Context; import android.graphics.PointF; +import android.graphics.RectF; import android.os.Handler; import android.util.DisplayMetrics; import android.view.KeyEvent; @@ -119,4 +120,8 @@ public class LOKitShell { public static void sendTileReevaluationRequest(ComposedTileLayer composedTileLayer) { LOKitShell.sendEvent(new LOEvent(LOEvent.TILE_REEVALUATION_REQUEST, composedTileLayer)); } + + public static void sendTileInvalidationRequest(RectF rect) { + LOKitShell.sendEvent(new LOEvent(LOEvent.TILE_INVALIDATION, rect)); + } } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index 8ae5749b54dd..9ec76bee0392 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -17,7 +17,7 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.LinkedBlockingQueue; -public class LOKitThread extends Thread implements TileProvider.TileInvalidationCallback { +public class LOKitThread extends Thread { private static final String LOGTAG = LOKitThread.class.getSimpleName(); private LinkedBlockingQueue<LOEvent> mEventQueue = new LinkedBlockingQueue<LOEvent>(); @@ -154,7 +154,6 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation if (mTileProvider.isReady()) { LOKitShell.showProgressSpinner(); - mTileProvider.registerInvalidationCallback(this); refresh(); LOKitShell.hideProgressSpinner(); } else { @@ -246,11 +245,6 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation public void clearQueue() { mEventQueue.clear(); } - - @Override - public void invalidate(RectF rect) { - queueEvent(new LOEvent(LOEvent.TILE_INVALIDATION, rect)); - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index d8753de1ac61..eb7cb40701b6 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -32,7 +32,6 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback private Office mOffice; private Document mDocument; private boolean mIsReady = false; - private TileInvalidationCallback tileInvalidationCallback = null; private float mDPI; private float mWidthTwip; @@ -279,14 +278,6 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback } /** - * Register the tile invalidation callback. - */ - @Override - public void registerInvalidationCallback(TileInvalidationCallback tileInvalidationCallback) { - this.tileInvalidationCallback = tileInvalidationCallback; - } - - /** * Returns the Unicode character generated by this event or 0. */ private int getCharCode(KeyEvent keyEvent) { @@ -425,12 +416,9 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback } private void invalidateTiles(String payload) { - if (tileInvalidationCallback == null) { - return; - } RectF rect = convertCallbackMessageStringToRectF(payload); if (rect != null) { - tileInvalidationCallback.invalidate(rect); + LOKitShell.sendTileInvalidationRequest(rect); } } } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java index e6fbcd2f508b..fe934a1aca1b 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java @@ -90,10 +90,6 @@ public class MockTileProvider implements TileProvider { } @Override - public void registerInvalidationCallback(TileInvalidationCallback tileInvalidationCallback) { - } - - @Override public void sendKeyEvent(KeyEvent keyEvent) { } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java index 92dbb3d7462b..ea868bd97c73 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java @@ -61,14 +61,6 @@ public interface TileProvider { boolean isSpreadsheet(); /** - * Register a callback that is invoked when a tile invalidation is - * required. - * - * @param tileInvalidationCallback - the tile invalidation callback - */ - void registerInvalidationCallback(TileProvider.TileInvalidationCallback tileInvalidationCallback); - - /** * Trigger a key event. * * @param keyEvent - contains information about key event @@ -90,16 +82,4 @@ public interface TileProvider { * @param numberOfClicks - number of clicks (1 - single click, 2 - double click) */ void mouseButtonUp(PointF documentCoordinate, int numberOfClicks); - - /** - * Callback to retrieve invalidation calls - */ - public interface TileInvalidationCallback { - /** - * Invoked when a region is invalidated. - * - * @param rect area in pixels which was invalidated and needs to be redrawn - */ - void invalidate(RectF rect); - } } |