summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/source/src/java/org/libreoffice/LOEvent.java3
-rw-r--r--android/source/src/java/org/libreoffice/LOKitThread.java20
-rw-r--r--android/source/src/java/org/mozilla/gecko/gfx/LayerView.java4
3 files changed, 21 insertions, 6 deletions
diff --git a/android/source/src/java/org/libreoffice/LOEvent.java b/android/source/src/java/org/libreoffice/LOEvent.java
index f5579aea087a..14980dca0ec4 100644
--- a/android/source/src/java/org/libreoffice/LOEvent.java
+++ b/android/source/src/java/org/libreoffice/LOEvent.java
@@ -36,7 +36,8 @@ public class LOEvent implements Comparable<LOEvent> {
public static final int RESUME = 15;
public static final int LOAD_NEW = 16;
public static final int SAVE_AS = 17;
- public static final int UPDATE_PART_PAGE_RECT= 18;
+ public static final int UPDATE_PART_PAGE_RECT = 18;
+ public static final int UPDATE_ZOOM_CONSTRAINTS = 19;
public final int mType;
public int mPriority = 0;
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;
}
}
diff --git a/android/source/src/java/org/mozilla/gecko/gfx/LayerView.java b/android/source/src/java/org/mozilla/gecko/gfx/LayerView.java
index 0aa19ddf93e2..41fafd46a3db 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/LayerView.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/LayerView.java
@@ -25,6 +25,8 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.FrameLayout;
+import org.libreoffice.LOEvent;
+import org.libreoffice.LOKitShell;
import org.libreoffice.LibreOfficeMainActivity;
import org.libreoffice.R;
import org.mozilla.gecko.OnInterceptTouchListener;
@@ -319,6 +321,8 @@ public class LayerView extends FrameLayout {
if (mListener != null) {
mListener.surfaceChanged(width, height);
}
+
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UPDATE_ZOOM_CONSTRAINTS));
}
private void onDestroyed() {