summaryrefslogtreecommitdiff
path: root/android/source/src/java/org/libreoffice/LOKitThread.java
diff options
context:
space:
mode:
Diffstat (limited to 'android/source/src/java/org/libreoffice/LOKitThread.java')
-rw-r--r--android/source/src/java/org/libreoffice/LOKitThread.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/android/source/src/java/org/libreoffice/LOKitThread.java b/android/source/src/java/org/libreoffice/LOKitThread.java
index 52a7c6c2f43a..dac8cc43109c 100644
--- a/android/source/src/java/org/libreoffice/LOKitThread.java
+++ b/android/source/src/java/org/libreoffice/LOKitThread.java
@@ -168,6 +168,15 @@ class LOKitThread extends Thread {
mContext.getDocumentOverlay().setPartPageRectangles(partPageRectangles);
}
+ private void updateZoomConstraints() {
+ mLayerClient = mContext.getLayerClient();
+
+ // Set min zoom to the page width so that you cannot zoom below page width
+ // applies to all types of document; in the future spreadsheets may be singled out
+ float minZoom = mLayerClient.getViewportMetrics().getWidth()/mTileProvider.getPageWidth();
+ mLayerClient.setZoomConstraints(new ZoomConstraints(true, 0.0f, minZoom, 0.0f));
+ }
+
/**
* Resume the document with the current part
@@ -181,6 +190,7 @@ class LOKitThread extends Thread {
mTileProvider = TileProviderFactory.create(mContext, mInvalidationHandler, filename);
if (mTileProvider.isReady()) {
+ updateZoomConstraints();
changePart(partIndex);
} else {
closeDocument();
@@ -209,13 +219,9 @@ class LOKitThread extends Thread {
mInvalidationHandler = new InvalidationHandler(mContext);
mTileProvider = TileProviderFactory.create(mContext, mInvalidationHandler, filePath);
- // Set min zoom to the page width so that you cannot zoom below page width
- // applies to all types of document; in the future spreadsheets may be singled out
- float minZoom = mLayerClient.getViewportMetrics().getWidth()/mTileProvider.getPageWidth();
- mLayerClient.setZoomConstraints(new ZoomConstraints(true, 0.0f, minZoom, 0.0f));
-
if (mTileProvider.isReady()) {
LOKitShell.showProgressSpinner(mContext);
+ updateZoomConstraints();
refresh();
LOKitShell.hideProgressSpinner(mContext);
} else {
@@ -236,6 +242,7 @@ class LOKitThread extends Thread {
if (mTileProvider.isReady()) {
LOKitShell.showProgressSpinner(mContext);
+ updateZoomConstraints();
refresh();
LOKitShell.hideProgressSpinner(mContext);
@@ -333,6 +340,9 @@ class LOKitThread extends Thread {
case LOEvent.UPDATE_PART_PAGE_RECT:
updatePartPageRectangles();
break;
+ case LOEvent.UPDATE_ZOOM_CONSTRAINTS:
+ updateZoomConstraints();
+ break;
}
}