diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-10-13 07:01:26 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-10-13 07:14:27 +0200 |
commit | eadc132d5fa339b6fe5b2f8bb482ed30dbd23147 (patch) | |
tree | 1d4337bf9b31a957bba0e56bdde5438f4314f36f /android | |
parent | c967872d46a7cfd7c52063068313d5ec0356453e (diff) |
android: When rotating, we also need to update the viewport geometry.
Change-Id: I04502c56b1e1d16cf65cbeb47632c508ef9889d0
Diffstat (limited to 'android')
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index 4c915423e046..4c5509a3ac4b 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -45,20 +45,32 @@ public class LOKitThread extends Thread { return true; } - private void refresh() { - Bitmap bitmap = mTileProvider.thumbnail(1000); - if (bitmap != null) { - mApplication.getLayerController().getView().changeCheckerboardBitmap(bitmap, mTileProvider.getPageWidth(), mTileProvider.getPageHeight()); + /** Handle the geometry change + draw. */ + private void redraw() { + if (mController == null || mTileProvider == null) { + // called too early... + return; } - mLayerClient.clearAndResetlayers(); draw(); + RectF rect = new RectF(0, 0, mTileProvider.getPageWidth(), mTileProvider.getPageHeight()); mController.setPageRect(rect, rect); mController.setViewportMetrics(mController.getViewportMetrics()); mController.setForceRedraw(); } + /** Invalidate everything + handle the geometry change + draw. */ + private void refresh() { + Bitmap bitmap = mTileProvider.thumbnail(1000); + if (bitmap != null) { + mApplication.getLayerController().getView().changeCheckerboardBitmap(bitmap, mTileProvider.getPageWidth(), mTileProvider.getPageHeight()); + } + + mLayerClient.clearAndResetlayers(); + redraw(); + } + private void changePart(int partIndex) { LOKitShell.showProgressSpinner(); mTileProvider.changePart(partIndex); @@ -119,8 +131,7 @@ public class LOKitThread extends Thread { draw(); break; case LOEvent.SIZE_CHANGED: - // re-draw when the size has changed - draw(); + redraw(); break; case LOEvent.CHANGE_PART: changePart(event.getPartIndex()); |