From 76fd8e9939bb20445d9ce74479db92a26696e692 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sat, 25 Dec 2010 22:30:22 +0000 Subject: [PATCH] extract animation code from MessageView --- src/com/fsck/k9/activity/K9Activity.java | 27 +++++++++++++++++++++++ src/com/fsck/k9/activity/MessageView.java | 21 ------------------ 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/com/fsck/k9/activity/K9Activity.java b/src/com/fsck/k9/activity/K9Activity.java index b37b95319..cd478e490 100644 --- a/src/com/fsck/k9/activity/K9Activity.java +++ b/src/com/fsck/k9/activity/K9Activity.java @@ -11,6 +11,9 @@ import android.view.GestureDetector; import android.view.GestureDetector.SimpleOnGestureListener; import android.view.MotionEvent; import android.view.View; +import android.view.animation.AccelerateInterpolator; +import android.view.animation.Animation; +import android.view.animation.TranslateAnimation; import android.widget.ScrollView; import com.fsck.k9.K9; @@ -106,6 +109,30 @@ public class K9Activity extends Activity { } + + protected Animation inFromRightAnimation() + { + return slideAnimation(0.0f, +1.0f); + } + + protected Animation outToLeftAnimation() + { + return slideAnimation(0.0f, -1.0f); + } + + private Animation slideAnimation(float right, float left) + { + + Animation slide = new TranslateAnimation( + Animation.RELATIVE_TO_PARENT, right, Animation.RELATIVE_TO_PARENT, left, + Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f + ); + slide.setDuration(125); + slide.setFillBefore(true); + slide.setInterpolator(new AccelerateInterpolator()); + return slide; + } + class MyGestureDetector extends SimpleOnGestureListener { diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index 2e3af368b..f4c0d7ff6 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -2590,28 +2590,7 @@ public class MessageView extends K9Activity implements OnClickListener } - private Animation inFromRightAnimation() - { - return slideAnimation(0.0f, +1.0f); - } - private Animation outToLeftAnimation() - { - return slideAnimation(0.0f, -1.0f); - } - - private Animation slideAnimation(float right, float left) - { - - Animation slide = new TranslateAnimation( - Animation.RELATIVE_TO_PARENT, right, Animation.RELATIVE_TO_PARENT, left, - Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f - ); - slide.setDuration(125); - slide.setFillBefore(true); - slide.setInterpolator(new AccelerateInterpolator()); - return slide; - } private void initializeCrypto() {