/**
* Animates the position and size of a specific tab item in order to hide the tab switcher.
*
* @param tabItem
* The tab item, which should be animated, as an instance of the class {@link TabItem}.
* The tab item may not be null
* @param duration
* The duration of the animation in milliseconds as a {@link Long} value
* @param interpolator
* The interpolator, which should be used by the animation, as an instance of the class
* {@link Interpolator}. The interpolator may not be null
* @param delay
* The delay of the animation in milliseconds as a {@link Long} value
* @param listener
* The listener, which should be notified about the animation's progress, as an instance
* of the type {@link AnimatorListener} or null, if no listener should be notified
*/
private void animateHideSwitcher(@NonNull final TabItem tabItem, final long duration,
@NonNull final Interpolator interpolator, final long delay,
@Nullable final AnimatorListener listener) {
View view = tabItem.getView();
animateBottomMargin(view, -(tabInset + tabBorderWidth), duration, delay);
ViewPropertyAnimator animation = view.animate();
animation.setDuration(duration);
animation.setInterpolator(interpolator);
animation.setListener(new AnimationListenerWrapper(listener));
getArithmetics().animateScale(Axis.DRAGGING_AXIS, animation, 1);
getArithmetics().animateScale(Axis.ORTHOGONAL_AXIS, animation, 1);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
getArithmetics().animatePosition(Axis.ORTHOGONAL_AXIS, animation, view,
getTabSwitcher().getLayout() == Layout.PHONE_LANDSCAPE ? layoutParams.topMargin : 0,
false);
int selectedTabIndex = getModel().getSelectedTabIndex();
if (tabItem.getIndex() < selectedTabIndex) {
getArithmetics().animatePosition(Axis.DRAGGING_AXIS, animation, view,
getArithmetics().getTabContainerSize(Axis.DRAGGING_AXIS), false);
} else if (tabItem.getIndex() > selectedTabIndex) {
getArithmetics().animatePosition(Axis.DRAGGING_AXIS, animation, view,
getTabSwitcher().getLayout() == Layout.PHONE_LANDSCAPE ? 0 :
layoutParams.topMargin, false);
} else {
getArithmetics().animatePosition(Axis.DRAGGING_AXIS, animation, view,
getTabSwitcher().getLayout() == Layout.PHONE_LANDSCAPE ? 0 :
layoutParams.topMargin, false);
}
animation.setStartDelay(delay);
animation.start();
}
PhoneTabSwitcherLayout.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:NeoTerm
作者:
评论列表
文章目录