summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gardiner <paul@glidos.net>2012-03-20 16:57:20 +0000
committerPaul Gardiner <paul@glidos.net>2012-03-20 16:57:20 +0000
commitf27da2574c1b9389f02efff8223ee0e6a4ae4d55 (patch)
tree2e22979848b2b8c581fbac15075212055eb7888e
parentee46d71962a7c79aeca01f8db4a00fec3410a540 (diff)
downloadmupdf-f27da2574c1b9389f02efff8223ee0e6a4ae4d55.tar.xz
Android app: delay the appearance of the page render progress dialogs
-rw-r--r--android/src/com/artifex/mupdf/MuPDFActivity.java2
-rw-r--r--android/src/com/artifex/mupdf/PageView.java10
2 files changed, 11 insertions, 1 deletions
diff --git a/android/src/com/artifex/mupdf/MuPDFActivity.java b/android/src/com/artifex/mupdf/MuPDFActivity.java
index 9ec38dd7..a30e4dac 100644
--- a/android/src/com/artifex/mupdf/MuPDFActivity.java
+++ b/android/src/com/artifex/mupdf/MuPDFActivity.java
@@ -63,7 +63,7 @@ public class MuPDFActivity extends Activity
/* The core rendering instance */
private enum LinkState {DEFAULT, HIGHLIGHT, INHIBIT};
private final int TAP_PAGE_MARGIN = 5;
- private final int SEARCH_PROGRESS_DELAY = 200;
+ private static final int SEARCH_PROGRESS_DELAY = 200;
private MuPDFCore core;
private String mFileName;
private ReaderView mDocView;
diff --git a/android/src/com/artifex/mupdf/PageView.java b/android/src/com/artifex/mupdf/PageView.java
index 7c2e38d4..15025463 100644
--- a/android/src/com/artifex/mupdf/PageView.java
+++ b/android/src/com/artifex/mupdf/PageView.java
@@ -10,6 +10,7 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.os.AsyncTask;
import android.os.Build;
+import android.os.Handler;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
@@ -44,6 +45,7 @@ public abstract class PageView extends ViewGroup {
private static final int HIGHLIGHT_COLOR = 0x805555FF;
private static final int LINK_COLOR = 0x80FFCC88;
private static final int BACKGROUND_COLOR = 0xFFFFFFFF;
+ private static final int PROGRESS_DIALOG_DELAY = 200;
private final Context mContext;
protected int mPageNumber;
private Point mParentSize;
@@ -66,6 +68,7 @@ public abstract class PageView extends ViewGroup {
private boolean mHighlightLinks;
private ProgressBar mBusyIndicator;
+ private final Handler mHandler = new Handler();
public PageView(Context c, Point parentSize) {
super(c);
@@ -155,6 +158,13 @@ public abstract class PageView extends ViewGroup {
mBusyIndicator.setIndeterminate(true);
mBusyIndicator.setBackgroundResource(R.drawable.busy);
addView(mBusyIndicator);
+ mBusyIndicator.setVisibility(INVISIBLE);
+ mHandler.postDelayed(new Runnable() {
+ public void run() {
+ if (mBusyIndicator != null)
+ mBusyIndicator.setVisibility(VISIBLE);
+ }
+ }, PROGRESS_DIALOG_DELAY);
}
}