public static void setActivityToolbarReset(Toolbar aMainToolbar, Toolbar aDecorativeToolbar, Activity aActivity, float fromToolbarPosition, float fromMainToolbarPosition) {
final int TOOLBAR_TRANSLATION_DURATION = 700;
float DECORATIVE_TOOLBAR_HEIGHT = -1 * aActivity.getResources().getDimension(R.dimen.additional_toolbar_height);
if(fromMainToolbarPosition == 0) {
DECORATIVE_TOOLBAR_HEIGHT += aActivity.getResources().getDimension(R.dimen.main_toolbar_height);
} else {
Animation moveMainToolbarAnimation = new TranslateAnimation(0, 0, fromMainToolbarPosition, 0);
moveMainToolbarAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
moveMainToolbarAnimation.setDuration(TOOLBAR_TRANSLATION_DURATION);
aMainToolbar.startAnimation(moveMainToolbarAnimation);
}
float fromTranslationY = (fromToolbarPosition < DECORATIVE_TOOLBAR_HEIGHT) ? DECORATIVE_TOOLBAR_HEIGHT : fromToolbarPosition;
Animation moveToolbarAnimation = new TranslateAnimation(0, 0, fromTranslationY, 0);
moveToolbarAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
moveToolbarAnimation.setDuration(TOOLBAR_TRANSLATION_DURATION);
aDecorativeToolbar.startAnimation(moveToolbarAnimation);
}
AnimationService.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:Pocket-Plays-for-Twitch
作者:
评论列表
文章目录