/**
* Animates to rotation of all tabs to be reset to normal.
*
* @param interpolator
* The interpolator, which should be used by the animation, as an instance of the type
* {@link Interpolator}. The interpolator may not be null
* @param maxAngle
* The angle, the tabs may be rotated by at maximum, in degrees as a {@link Float}
* 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
* @return True, if at least one tab was animated, false otherwise
*/
private boolean animateTilt(@NonNull final Interpolator interpolator, final float maxAngle,
@Nullable final AnimatorListener listener) {
ItemIterator iterator =
new ItemIterator.Builder(getTabSwitcher(), tabViewRecycler).reverse(true).create();
AbstractItem item;
boolean result = false;
while ((item = iterator.next()) != null) {
if (item.isInflated() &&
getArithmetics().getRotation(Axis.ORTHOGONAL_AXIS, item) != 0) {
View view = item.getView();
ViewPropertyAnimator animation = view.animate();
animation.setListener(new AnimationListenerWrapper(
createRevertOvershootAnimationListener(item, !result ? listener : null)));
animation.setDuration(Math.round(revertOvershootAnimationDuration *
(Math.abs(getArithmetics().getRotation(Axis.ORTHOGONAL_AXIS, item)) /
maxAngle)));
animation.setInterpolator(interpolator);
getArithmetics().animateRotation(Axis.ORTHOGONAL_AXIS, animation, 0);
animation.setStartDelay(0);
animation.start();
result = true;
}
}
return result;
}
PhoneTabSwitcherLayout.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:ChromeLikeTabSwitcher
作者:
评论列表
文章目录