mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 21:22:26 -05:00
Add a message-flip animation. Long-term, we want a ViewSwitcher instead
This commit is contained in:
parent
027e213bb2
commit
30459125aa
@ -13,6 +13,11 @@ import java.util.Map;
|
|||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
import com.android.email.K9Activity;
|
import com.android.email.K9Activity;
|
||||||
|
import android.view.animation.AccelerateInterpolator;
|
||||||
|
import android.view.animation.Animation;
|
||||||
|
import android.view.animation.TranslateAnimation;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
@ -839,6 +844,7 @@ public class MessageView extends K9Activity
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
displayMessage(mNextMessageUid);
|
displayMessage(mNextMessageUid);
|
||||||
|
mTopView.startAnimation(outToLeftAnimation());
|
||||||
next.requestFocus();
|
next.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -848,6 +854,7 @@ public class MessageView extends K9Activity
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
displayMessage(mPreviousMessageUid);
|
displayMessage(mPreviousMessageUid);
|
||||||
|
mTopView.startAnimation(inFromRightAnimation());
|
||||||
previous.requestFocus();
|
previous.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1485,5 +1492,23 @@ public class MessageView extends K9Activity
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(500);
|
||||||
|
slide.setFillBefore(true);
|
||||||
|
slide.setInterpolator(new AccelerateInterpolator());
|
||||||
|
return slide;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user