1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Respect the 'enable animations' pref when animating views.

This commit is contained in:
Danny Baumann 2013-02-06 10:53:42 +01:00
parent 1d849f6664
commit 03f9b9ef0d

View File

@ -1,5 +1,7 @@
package com.fsck.k9.view; package com.fsck.k9.view;
import com.fsck.k9.K9;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.animation.Animation; import android.view.animation.Animation;
@ -31,8 +33,7 @@ public class ViewSwitcher extends ViewAnimator implements AnimationListener {
return; return;
} }
setInAnimation(mFirstInAnimation); setupAnimations(mFirstInAnimation, mFirstOutAnimation);
setOutAnimation(mFirstOutAnimation);
setDisplayedChild(0); setDisplayedChild(0);
} }
@ -41,11 +42,20 @@ public class ViewSwitcher extends ViewAnimator implements AnimationListener {
return; return;
} }
setInAnimation(mSecondInAnimation); setupAnimations(mSecondInAnimation, mSecondOutAnimation);
setOutAnimation(mSecondOutAnimation);
setDisplayedChild(1); setDisplayedChild(1);
} }
private void setupAnimations(Animation in, Animation out) {
if (K9.showAnimations()) {
setInAnimation(in);
setOutAnimation(out);
} else {
setInAnimation(null);
setOutAnimation(null);
}
}
public Animation getFirstInAnimation() { public Animation getFirstInAnimation() {
return mFirstInAnimation; return mFirstInAnimation;
} }