summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-10-10 14:27:23 +0200
committerJan Holesovsky <kendy@collabora.com>2014-10-10 14:32:45 +0200
commite147c5785f60506c58ba80455614bdbcdad18e61 (patch)
tree2745ac1e84e23d011ee184c148d3756e8723bbf3 /android
parent84949ba280287a284cd01c0da1d9041f390a38a8 (diff)
android: Repaint when the orientation changes.
Change-Id: I150b22b7b1179c1adc7995a8547c7644ac25be28
Diffstat (limited to 'android')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java9
-rw-r--r--android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java8
2 files changed, 17 insertions, 0 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index e5765e6ebdeb..4c915423e046 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
@@ -26,6 +26,11 @@ public class LOKitThread extends Thread {
}
private boolean draw() {
+ if (mTileProvider == null || mApplication == null) {
+ // called too early...
+ return false;
+ }
+
RectF rect = new RectF(0, 0, mTileProvider.getPageWidth(), mTileProvider.getPageHeight());
DisplayMetrics displayMetrics = LibreOfficeMainActivity.mAppContext.getResources().getDisplayMetrics();
mViewportMetrics = new ImmutableViewportMetrics(displayMetrics);
@@ -114,6 +119,8 @@ public class LOKitThread extends Thread {
draw();
break;
case LOEvent.SIZE_CHANGED:
+ // re-draw when the size has changed
+ draw();
break;
case LOEvent.CHANGE_PART:
changePart(event.getPartIndex());
@@ -130,3 +137,5 @@ public class LOKitThread extends Thread {
mEventQueue.clear();
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java
index 2a52d91afe27..863157aa252c 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java
@@ -341,6 +341,14 @@ public class LayerView extends FrameLayout {
}
}
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ super.onLayout(changed, left, top, right, bottom);
+ if (changed) {
+ setViewportSize(new IntSize(right - left, bottom - top));
+ }
+ }
+
private class SurfaceTextureListener implements TextureView.SurfaceTextureListener {
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
// We don't do this for surfaceCreated above because it is always followed by a surfaceChanged,