summaryrefslogtreecommitdiff
path: root/android/src
diff options
context:
space:
mode:
authorPaul Gardiner <paulg.artifex@glidos.net>2013-02-05 17:38:15 +0000
committerPaul Gardiner <paulg.artifex@glidos.net>2013-02-05 17:38:15 +0000
commit92f7f71619220210f43a1281d1abf6c9434e3c1b (patch)
tree7095c3b0180a951dc9959be8c34400d7f2025978 /android/src
parent49b4eedf24212cac7ae0b94b855b219e4f1ae86f (diff)
downloadmupdf-92f7f71619220210f43a1281d1abf6c9434e3c1b.tar.xz
Android: reflow - request layout each time we learn a new page height
Diffstat (limited to 'android/src')
-rw-r--r--android/src/com/artifex/mupdfdemo/MuPDFReflowView.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/android/src/com/artifex/mupdfdemo/MuPDFReflowView.java b/android/src/com/artifex/mupdfdemo/MuPDFReflowView.java
index d689e9b2..301dc2b0 100644
--- a/android/src/com/artifex/mupdfdemo/MuPDFReflowView.java
+++ b/android/src/com/artifex/mupdfdemo/MuPDFReflowView.java
@@ -1,11 +1,10 @@
package com.artifex.mupdfdemo;
-import java.io.UnsupportedEncodingException;
-
import android.content.Context;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.RectF;
+import android.os.Handler;
import android.util.Base64;
import android.view.MotionEvent;
import android.view.View;
@@ -14,6 +13,7 @@ import android.webkit.WebViewClient;
public class MuPDFReflowView extends WebView implements MuPDFView {
private final MuPDFCore mCore;
+ private final Handler mHandler;
private final Point mParentSize;
private int mPage;
private int mContentHeight;
@@ -21,6 +21,7 @@ public class MuPDFReflowView extends WebView implements MuPDFView {
public MuPDFReflowView(Context c, MuPDFCore core, Point parentSize) {
super(c);
+ mHandler = new Handler();
mCore = core;
mParentSize = parentSize;
mContentHeight = parentSize.y;
@@ -28,6 +29,11 @@ public class MuPDFReflowView extends WebView implements MuPDFView {
addJavascriptInterface(new Object(){
public void reportContentHeight(String value) {
mContentHeight = (int)Float.parseFloat(value);
+ mHandler.post(new Runnable() {
+ public void run() {
+ requestLayout();
+ }
+ });
}
}, "HTMLOUT");
setWebViewClient(new WebViewClient() {