1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -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;
import com.fsck.k9.K9;
import android.content.Context;
import android.util.AttributeSet;
import android.view.animation.Animation;
@ -31,8 +33,7 @@ public class ViewSwitcher extends ViewAnimator implements AnimationListener {
return;
}
setInAnimation(mFirstInAnimation);
setOutAnimation(mFirstOutAnimation);
setupAnimations(mFirstInAnimation, mFirstOutAnimation);
setDisplayedChild(0);
}
@ -41,11 +42,20 @@ public class ViewSwitcher extends ViewAnimator implements AnimationListener {
return;
}
setInAnimation(mSecondInAnimation);
setOutAnimation(mSecondOutAnimation);
setupAnimations(mSecondInAnimation, mSecondOutAnimation);
setDisplayedChild(1);
}
private void setupAnimations(Animation in, Animation out) {
if (K9.showAnimations()) {
setInAnimation(in);
setOutAnimation(out);
} else {
setInAnimation(null);
setOutAnimation(null);
}
}
public Animation getFirstInAnimation() {
return mFirstInAnimation;
}