summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
Diffstat (limited to 'android')
-rw-r--r--android/src/com/artifex/mupdfdemo/MuPDFActivity.java41
-rw-r--r--android/src/com/artifex/mupdfdemo/PageView.java12
2 files changed, 35 insertions, 18 deletions
diff --git a/android/src/com/artifex/mupdfdemo/MuPDFActivity.java b/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
index 9a8b691f..bfe0e135 100644
--- a/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
+++ b/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
@@ -554,24 +554,35 @@ public class MuPDFActivity extends Activity
mSelecting = false;
mTopBarSwitcher.setDisplayedChild(0);
mInfoView.setText(copied?"Copied to clipboard":"No text selected");
- AnimatorSet set = (AnimatorSet) AnimatorInflater.loadAnimator(context, R.animator.info);
- set.setTarget(mInfoView);
- set.addListener(new Animator.AnimatorListener() {
- public void onAnimationStart(Animator animation) {
- mInfoView.setVisibility(View.VISIBLE);
- }
- public void onAnimationRepeat(Animator animation) {
- }
+ int currentApiVersion = android.os.Build.VERSION.SDK_INT;
+ if (currentApiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
+ AnimatorSet set = (AnimatorSet) AnimatorInflater.loadAnimator(context, R.animator.info);
+ set.setTarget(mInfoView);
+ set.addListener(new Animator.AnimatorListener() {
+ public void onAnimationStart(Animator animation) {
+ mInfoView.setVisibility(View.VISIBLE);
+ }
- public void onAnimationEnd(Animator animation) {
- mInfoView.setVisibility(View.INVISIBLE);
- }
+ public void onAnimationRepeat(Animator animation) {
+ }
- public void onAnimationCancel(Animator animation) {
- }
- });
- set.start();
+ public void onAnimationEnd(Animator animation) {
+ mInfoView.setVisibility(View.INVISIBLE);
+ }
+
+ public void onAnimationCancel(Animator animation) {
+ }
+ });
+ set.start();
+ } else {
+ mInfoView.setVisibility(View.VISIBLE);
+ mHandler.postDelayed(new Runnable() {
+ public void run() {
+ mInfoView.setVisibility(View.INVISIBLE);
+ }
+ }, 500);
+ }
}
});
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();