diff options
-rw-r--r-- | android/src/com/artifex/mupdf/MuPDFActivity.java | 2 | ||||
-rw-r--r-- | android/src/com/artifex/mupdf/PageView.java | 10 |
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); } } |