[Libreoffice-commits] core.git: Branch 'feature/droid_calcimpress3' - android/experimental

Jan Holesovsky kendy at collabora.com
Sun Oct 12 22:13:21 PDT 2014


 android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java |   25 +++++++---
 1 file changed, 18 insertions(+), 7 deletions(-)

New commits:
commit f4c3ab1c80df52129f8f5574cdc6b63aa998f74e
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Oct 13 07:01:26 2014 +0200

    android: When rotating, we also need to update the viewport geometry.
    
    Change-Id: I04502c56b1e1d16cf65cbeb47632c508ef9889d0

diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index 4c91542..4c5509a 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());


More information about the Libreoffice-commits mailing list