summaryrefslogtreecommitdiff
path: root/android/src
diff options
context:
space:
mode:
authorPaul Gardiner <paulg.artifex@glidos.net>2013-02-18 15:04:23 +0000
committerPaul Gardiner <paulg.artifex@glidos.net>2013-02-22 12:21:22 +0000
commitd5dcc473b0e50e726dc80f2be4ecdcad43217d64 (patch)
tree3a2217041f026a0a1da5fb418b74c29adf090900 /android/src
parent5d15995814d4d99e44a860ae435659d9e30fad3b (diff)
downloadmupdf-d5dcc473b0e50e726dc80f2be4ecdcad43217d64.tar.xz
Android: add MuPDFCore.getAnnotations
Diffstat (limited to 'android/src')
-rw-r--r--android/src/com/artifex/mupdfdemo/Annotation.java18
-rw-r--r--android/src/com/artifex/mupdfdemo/MuPDFActivity.java9
-rw-r--r--android/src/com/artifex/mupdfdemo/MuPDFCore.java5
-rw-r--r--android/src/com/artifex/mupdfdemo/MuPDFView.java1
-rw-r--r--android/src/com/artifex/mupdfdemo/PageView.java1
-rw-r--r--android/src/com/artifex/mupdfdemo/ReaderView.java2
6 files changed, 24 insertions, 12 deletions
diff --git a/android/src/com/artifex/mupdfdemo/Annotation.java b/android/src/com/artifex/mupdfdemo/Annotation.java
new file mode 100644
index 00000000..709b66cc
--- /dev/null
+++ b/android/src/com/artifex/mupdfdemo/Annotation.java
@@ -0,0 +1,18 @@
+package com.artifex.mupdfdemo;
+
+import android.graphics.RectF;
+
+public class Annotation extends RectF {
+ enum Type {
+ TEXT, LINK, FREETEXT, LINE, SQUARE, CIRCLE, POLYGON, POLYLINE, HIGHLIGHT,
+ UNDERLINE, SQUIGGLY, STRIKEOUT, STAMP, CARET, INK, POPUP, FILEATTACHMENT,
+ SOUND, MOVIE, WIDGET, SCREEN, PRINTERMARK, TRAPNET, WATERMARK, A3D
+ }
+
+ public final Type type;
+
+ public Annotation(float x0, float y0, float x1, float y1, int _type) {
+ super(x0, y0, x1, y1);
+ type = Type.values()[_type];
+ }
+}
diff --git a/android/src/com/artifex/mupdfdemo/MuPDFActivity.java b/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
index cb9769fe..a9729725 100644
--- a/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
+++ b/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
@@ -1,15 +1,13 @@
package com.artifex.mupdfdemo;
-import java.util.concurrent.Executor;
import java.io.InputStream;
-import java.io.FileInputStream;
+import java.util.concurrent.Executor;
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorSet;
import android.app.Activity;
import android.app.AlertDialog;
-import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -17,19 +15,14 @@ import android.content.SharedPreferences;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Color;
-import android.graphics.PorterDuff;
-import android.graphics.RectF;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.method.PasswordTransformationMethod;
-import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.Menu;
-import android.view.MotionEvent;
-import android.view.ScaleGestureDetector;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
diff --git a/android/src/com/artifex/mupdfdemo/MuPDFCore.java b/android/src/com/artifex/mupdfdemo/MuPDFCore.java
index a432371a..ec8fd513 100644
--- a/android/src/com/artifex/mupdfdemo/MuPDFCore.java
+++ b/android/src/com/artifex/mupdfdemo/MuPDFCore.java
@@ -49,6 +49,7 @@ public class MuPDFCore
private native int getFocusedWidgetTypeInternal();
private native LinkInfo [] getPageLinksInternal(int page);
private native RectF[] getWidgetAreasInternal(int page);
+ private native Annotation[] getAnnotationsInternal(int page);
private native OutlineItem [] getOutlineInternal();
private native boolean hasOutlineInternal();
private native boolean needsPasswordInternal();
@@ -196,6 +197,10 @@ public class MuPDFCore
return getWidgetAreasInternal(page);
}
+ public synchronized Annotation [] getAnnoations(int page) {
+ return getAnnotationsInternal(page);
+ }
+
public synchronized RectF [] searchPage(int page, String text) {
gotoPage(page);
return searchPage(text);
diff --git a/android/src/com/artifex/mupdfdemo/MuPDFView.java b/android/src/com/artifex/mupdfdemo/MuPDFView.java
index 919ac516..d2b8ac10 100644
--- a/android/src/com/artifex/mupdfdemo/MuPDFView.java
+++ b/android/src/com/artifex/mupdfdemo/MuPDFView.java
@@ -1,7 +1,6 @@
package com.artifex.mupdfdemo;
import android.graphics.PointF;
-import android.graphics.Rect;
import android.graphics.RectF;
public interface MuPDFView {
diff --git a/android/src/com/artifex/mupdfdemo/PageView.java b/android/src/com/artifex/mupdfdemo/PageView.java
index 04065174..b6b533bd 100644
--- a/android/src/com/artifex/mupdfdemo/PageView.java
+++ b/android/src/com/artifex/mupdfdemo/PageView.java
@@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import android.content.ClipData;
-import android.content.ClipboardManager;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
diff --git a/android/src/com/artifex/mupdfdemo/ReaderView.java b/android/src/com/artifex/mupdfdemo/ReaderView.java
index 540ad381..9e738cac 100644
--- a/android/src/com/artifex/mupdfdemo/ReaderView.java
+++ b/android/src/com/artifex/mupdfdemo/ReaderView.java
@@ -7,7 +7,6 @@ import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
import android.util.AttributeSet;
-import android.util.Log;
import android.util.SparseArray;
import android.view.GestureDetector;
import android.view.MotionEvent;
@@ -232,7 +231,6 @@ public class ReaderView extends AdapterView<Adapter>
int left = -(v.getLeft() + mXScroll + remainingX);
int top = -(v.getTop() + mYScroll + remainingY);
// docWidth/Height are the width/height of the scaled document e.g. 2000x3000
- int docWidth = v.getMeasuredWidth();
int docHeight = v.getMeasuredHeight();
int xOffset, yOffset;