diff options
-rw-r--r-- | android/src/com/artifex/mupdf/MuPDFActivity.java | 7 | ||||
-rw-r--r-- | android/src/com/artifex/mupdf/ReaderView.java | 12 |
2 files changed, 18 insertions, 1 deletions
diff --git a/android/src/com/artifex/mupdf/MuPDFActivity.java b/android/src/com/artifex/mupdf/MuPDFActivity.java index 4e0625b6..6141c464 100644 --- a/android/src/com/artifex/mupdf/MuPDFActivity.java +++ b/android/src/com/artifex/mupdf/MuPDFActivity.java @@ -39,6 +39,7 @@ class SearchTaskResult { public class MuPDFActivity extends Activity { /* The core rendering instance */ + private final int TAP_PAGE_MARGIN = 5; private MuPDFCore core; private String mFileName; private ReaderView mDocView; @@ -158,7 +159,11 @@ public class MuPDFActivity extends Activity private boolean showButtonsDisabled; public boolean onSingleTapUp(MotionEvent e) { - if (!showButtonsDisabled) { + if (e.getX() < super.getWidth()/TAP_PAGE_MARGIN) { + super.moveToPrevious(); + } else if (e.getX() > super.getWidth()*(TAP_PAGE_MARGIN-1)/TAP_PAGE_MARGIN) { + super.moveToNext(); + } else if (!showButtonsDisabled) { int linkPage = -1; MuPDFPageView pageView = (MuPDFPageView) mDocView.getDisplayedView(); if (pageView != null) { diff --git a/android/src/com/artifex/mupdf/ReaderView.java b/android/src/com/artifex/mupdf/ReaderView.java index 25945f20..811f8b78 100644 --- a/android/src/com/artifex/mupdf/ReaderView.java +++ b/android/src/com/artifex/mupdf/ReaderView.java @@ -90,6 +90,18 @@ public class ReaderView extends AdapterView<Adapter> } } + public void moveToNext() { + View v = mChildViews.get(mCurrent+1); + if (v != null) + slideViewOntoScreen(v); + } + + public void moveToPrevious() { + View v = mChildViews.get(mCurrent-1); + if (v != null) + slideViewOntoScreen(v); + } + public void resetupChildren() { for (int i = 0; i < mChildViews.size(); i++) onChildSetup(mChildViews.keyAt(i), mChildViews.valueAt(i)); |