summaryrefslogtreecommitdiff
path: root/android/src/com/artifex/mupdfdemo/PageView.java
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-01-22 16:13:44 +0000
committerRobin Watts <robin.watts@artifex.com>2013-01-22 16:15:34 +0000
commit02676a60608d5669807e5731fb694d197a10c0a3 (patch)
treeca5b7003b0b0e13fac3c1bd650d83182bc444bed /android/src/com/artifex/mupdfdemo/PageView.java
parent8c1a2377de0b83626d3461f7d1554d3c4c9741b2 (diff)
downloadmupdf-02676a60608d5669807e5731fb694d197a10c0a3.tar.xz
Android: Fix clipboard operation on older androids.
ClipboardManager changed its API at Honeycomb, AnimatorInflater only appeared at Honeycomb. Both of these are used by the clipboard code. Add fallback code to work with the older systems on older devices.
Diffstat (limited to 'android/src/com/artifex/mupdfdemo/PageView.java')
-rw-r--r--android/src/com/artifex/mupdfdemo/PageView.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/android/src/com/artifex/mupdfdemo/PageView.java b/android/src/com/artifex/mupdfdemo/PageView.java
index 8e784b24..b793db3f 100644
--- a/android/src/com/artifex/mupdfdemo/PageView.java
+++ b/android/src/com/artifex/mupdfdemo/PageView.java
@@ -425,9 +425,15 @@ public abstract class PageView extends ViewGroup {
if (text.length() == 0)
return false;
- ClipboardManager cm = (ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE);
-
- cm.setPrimaryClip(ClipData.newPlainText("MuPDF", text));
+ int currentApiVersion = android.os.Build.VERSION.SDK_INT;
+ if (currentApiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
+ android.content.ClipboardManager cm = (android.content.ClipboardManager)mContext.getSystemService(Context.CLIPBOARD_SERVICE);
+
+ cm.setPrimaryClip(ClipData.newPlainText("MuPDF", text));
+ } else {
+ android.text.ClipboardManager cm = (android.text.ClipboardManager)mContext.getSystemService(Context.CLIPBOARD_SERVICE);
+ cm.setText(text);
+ }
mSelectBox = null;
mSearchView.invalidate();