diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-01-22 16:13:44 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-01-22 16:15:34 +0000 |
commit | 02676a60608d5669807e5731fb694d197a10c0a3 (patch) | |
tree | ca5b7003b0b0e13fac3c1bd650d83182bc444bed /android/src/com/artifex/mupdfdemo/MuPDFActivity.java | |
parent | 8c1a2377de0b83626d3461f7d1554d3c4c9741b2 (diff) | |
download | mupdf-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/MuPDFActivity.java')
-rw-r--r-- | android/src/com/artifex/mupdfdemo/MuPDFActivity.java | 41 |
1 files changed, 26 insertions, 15 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); + } } }); |