diff options
Diffstat (limited to 'platform/android/src/com/artifex/mupdfdemo/SafeAnimatorInflater.java')
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/SafeAnimatorInflater.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/platform/android/src/com/artifex/mupdfdemo/SafeAnimatorInflater.java b/platform/android/src/com/artifex/mupdfdemo/SafeAnimatorInflater.java new file mode 100644 index 00000000..7c6a7ebc --- /dev/null +++ b/platform/android/src/com/artifex/mupdfdemo/SafeAnimatorInflater.java @@ -0,0 +1,37 @@ +package com.artifex.mupdfdemo; + +import android.animation.Animator; +import android.view.View; +import android.view.animation.Animation; +import android.animation.AnimatorInflater; +import android.animation.AnimatorSet; +import android.view.View; +import android.app.Activity; + +public class SafeAnimatorInflater +{ + private View mView; + + public SafeAnimatorInflater(Activity activity, int animation, View view) + { + AnimatorSet set = (AnimatorSet) AnimatorInflater.loadAnimator(activity, R.animator.info); + mView = view; + set.setTarget(view); + set.addListener(new Animator.AnimatorListener() { + public void onAnimationStart(Animator animation) { + mView.setVisibility(View.VISIBLE); + } + + public void onAnimationRepeat(Animator animation) { + } + + public void onAnimationEnd(Animator animation) { + mView.setVisibility(View.INVISIBLE); + } + + public void onAnimationCancel(Animator animation) { + } + }); + set.start(); + } +} |