summaryrefslogtreecommitdiff
path: root/platform/android/src/com/artifex/mupdfdemo/ReaderView.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/src/com/artifex/mupdfdemo/ReaderView.java')
-rw-r--r--platform/android/src/com/artifex/mupdfdemo/ReaderView.java26
1 files changed, 22 insertions, 4 deletions
diff --git a/platform/android/src/com/artifex/mupdfdemo/ReaderView.java b/platform/android/src/com/artifex/mupdfdemo/ReaderView.java
index 774c8dbe..2552e928 100644
--- a/platform/android/src/com/artifex/mupdfdemo/ReaderView.java
+++ b/platform/android/src/com/artifex/mupdfdemo/ReaderView.java
@@ -72,10 +72,23 @@ public class ReaderView
public ReaderView(Context context, AttributeSet attrs) {
super(context, attrs);
- mGestureDetector = new GestureDetector(this);
- mScaleGestureDetector = new ScaleGestureDetector(context, this);
- mScroller = new Scroller(context);
- mStepper = new Stepper(this, this);
+
+ // "Edit mode" means when the View is being displayed in the Android GUI editor. (this class
+ // is instantiated in the IDE, so we need to be a bit careful what we do).
+ if (isInEditMode())
+ {
+ mGestureDetector = null;
+ mScaleGestureDetector = null;
+ mScroller = null;
+ mStepper = null;
+ }
+ else
+ {
+ mGestureDetector = new GestureDetector(this);
+ mScaleGestureDetector = new ScaleGestureDetector(context, this);
+ mScroller = new Scroller(context);
+ mStepper = new Stepper(this, this);
+ }
}
public ReaderView(Context context, AttributeSet attrs, int defStyle) {
@@ -527,6 +540,11 @@ public class ReaderView
int bottom) {
super.onLayout(changed, left, top, right, bottom);
+ // "Edit mode" means when the View is being displayed in the Android GUI editor. (this class
+ // is instantiated in the IDE, so we need to be a bit careful what we do).
+ if (isInEditMode())
+ return;
+
View cv = mChildViews.get(mCurrent);
Point cvOffset;