android: Repaint when the orientation changes.
Change-Id: I150b22b7b1179c1adc7995a8547c7644ac25be28
This commit is contained in:
@@ -26,6 +26,11 @@ public class LOKitThread extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean draw() {
|
private boolean draw() {
|
||||||
|
if (mTileProvider == null || mApplication == null) {
|
||||||
|
// called too early...
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
RectF rect = new RectF(0, 0, mTileProvider.getPageWidth(), mTileProvider.getPageHeight());
|
RectF rect = new RectF(0, 0, mTileProvider.getPageWidth(), mTileProvider.getPageHeight());
|
||||||
DisplayMetrics displayMetrics = LibreOfficeMainActivity.mAppContext.getResources().getDisplayMetrics();
|
DisplayMetrics displayMetrics = LibreOfficeMainActivity.mAppContext.getResources().getDisplayMetrics();
|
||||||
mViewportMetrics = new ImmutableViewportMetrics(displayMetrics);
|
mViewportMetrics = new ImmutableViewportMetrics(displayMetrics);
|
||||||
@@ -114,6 +119,8 @@ public class LOKitThread extends Thread {
|
|||||||
draw();
|
draw();
|
||||||
break;
|
break;
|
||||||
case LOEvent.SIZE_CHANGED:
|
case LOEvent.SIZE_CHANGED:
|
||||||
|
// re-draw when the size has changed
|
||||||
|
draw();
|
||||||
break;
|
break;
|
||||||
case LOEvent.CHANGE_PART:
|
case LOEvent.CHANGE_PART:
|
||||||
changePart(event.getPartIndex());
|
changePart(event.getPartIndex());
|
||||||
@@ -130,3 +137,5 @@ public class LOKitThread extends Thread {
|
|||||||
mEventQueue.clear();
|
mEventQueue.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -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 {
|
private class SurfaceTextureListener implements TextureView.SurfaceTextureListener {
|
||||||
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
|
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,
|
// We don't do this for surfaceCreated above because it is always followed by a surfaceChanged,
|
||||||
|
Reference in New Issue
Block a user