1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

extract animation code from MessageView

This commit is contained in:
Jesse Vincent 2010-12-25 22:30:22 +00:00
parent 5f9eae1580
commit 76fd8e9939
2 changed files with 27 additions and 21 deletions

View File

@ -11,6 +11,9 @@ import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener; import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.ScrollView; import android.widget.ScrollView;
import com.fsck.k9.K9; 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 class MyGestureDetector extends SimpleOnGestureListener
{ {

View File

@ -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() private void initializeCrypto()
{ {