summaryrefslogtreecommitdiff
path: root/android/src/com/artifex/mupdfdemo/MuPDFPageView.java
diff options
context:
space:
mode:
Diffstat (limited to 'android/src/com/artifex/mupdfdemo/MuPDFPageView.java')
-rw-r--r--android/src/com/artifex/mupdfdemo/MuPDFPageView.java32
1 files changed, 30 insertions, 2 deletions
diff --git a/android/src/com/artifex/mupdfdemo/MuPDFPageView.java b/android/src/com/artifex/mupdfdemo/MuPDFPageView.java
index 06c3827a..69f038bb 100644
--- a/android/src/com/artifex/mupdfdemo/MuPDFPageView.java
+++ b/android/src/com/artifex/mupdfdemo/MuPDFPageView.java
@@ -59,8 +59,6 @@ class PassClickResultChoice extends PassClickResult {
}
public class MuPDFPageView extends PageView implements MuPDFView {
- private static final float LINE_THICKNESS = 0.07f;
- private static final float STRIKE_HEIGHT = 0.375f;
private final MuPDFCore mCore;
private AsyncTask<Void,Void,PassClickResult> mPassClick;
private RectF mWidgetAreas[];
@@ -75,6 +73,7 @@ public class MuPDFPageView extends PageView implements MuPDFView {
private AsyncTask<String,Void,Boolean> mSetWidgetText;
private AsyncTask<String,Void,Void> mSetWidgetChoice;
private AsyncTask<PointF[],Void,Void> mAddStrikeOut;
+ private AsyncTask<PointF[][],Void,Void> mAddInk;
private AsyncTask<Integer,Void,Void> mDeleteAnnotation;
private Runnable changeReporter;
@@ -185,6 +184,7 @@ public class MuPDFPageView extends PageView implements MuPDFView {
case UNDERLINE:
case SQUIGGLY:
case STRIKEOUT:
+ case INK:
mSelectedAnnotationIndex = i;
setItemSelectBox(mAnnotations[i]);
return Hit.Annotation;
@@ -357,6 +357,34 @@ public class MuPDFPageView extends PageView implements MuPDFView {
setItemSelectBox(null);
}
+ public void saveDraw() {
+ PointF[][] path = getDraw();
+
+ if (path != null) {
+ if (mAddInk != null) {
+ mAddInk.cancel(true);
+ mAddInk = null;
+ }
+ mAddInk = new AsyncTask<PointF[][],Void,Void>() {
+ @Override
+ protected Void doInBackground(PointF[][]... params) {
+ mCore.addInkAnnotation(mPageNumber, params[0]);
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(Void result) {
+ loadAnnotations();
+ update();
+ }
+
+ };
+
+ mAddInk.execute(getDraw());
+ cancelDraw();
+ }
+ }
+
@Override
protected Bitmap drawPage(int sizeX, int sizeY,
int patchX, int patchY, int patchWidth, int patchHeight) {