summaryrefslogtreecommitdiff
path: root/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-04-08 15:29:48 +0100
committerRobin Watts <robin.watts@artifex.com>2013-04-08 15:37:29 +0100
commit93b5a19064fab0c0fb4530a44d137d29c39e808f (patch)
treef09bf9f1232be72157f8713524aaf429f2cee8be /android/src/com/artifex/mupdfdemo/MuPDFActivity.java
parenta5347efa93cf7bf2cb4ba281e3693d24a2bcc839 (diff)
downloadmupdf-93b5a19064fab0c0fb4530a44d137d29c39e808f.tar.xz
Android: Fix operation under Froyo/Gingerbread.
Android resolves references at class load time, so when MuPDFActivity is loaded, it tries to resolve AnimatorInflater. This fails on a 2.2 system. The fix is to push the code into 'SafeAnimatorInflater'. When MuPDFActivity is loaded, SafeAnimatorInflater is resolved, but it's not actually loaded until it's used. We never use it unless we have at least honeycomb, hence we never try to resolve the missing class.
Diffstat (limited to 'android/src/com/artifex/mupdfdemo/MuPDFActivity.java')
-rw-r--r--android/src/com/artifex/mupdfdemo/MuPDFActivity.java22
1 files changed, 1 insertions, 21 deletions
diff --git a/android/src/com/artifex/mupdfdemo/MuPDFActivity.java b/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
index 63f5b963..37a00f5e 100644
--- a/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
+++ b/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
@@ -3,9 +3,6 @@ package com.artifex.mupdfdemo;
import java.io.InputStream;
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.content.Context;
@@ -805,24 +802,7 @@ public class MuPDFActivity extends Activity
int currentApiVersion = android.os.Build.VERSION.SDK_INT;
if (currentApiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
- AnimatorSet set = (AnimatorSet) AnimatorInflater.loadAnimator(this, 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) {
- }
-
- public void onAnimationEnd(Animator animation) {
- mInfoView.setVisibility(View.INVISIBLE);
- }
-
- public void onAnimationCancel(Animator animation) {
- }
- });
- set.start();
+ SafeAnimatorInflater safe = new SafeAnimatorInflater((Activity)this, R.animator.info, (View)mInfoView);
} else {
mInfoView.setVisibility(View.VISIBLE);
mHandler.postDelayed(new Runnable() {