y ( )源码实例Demo

android.view.ViewPropertyAnimator#y ( )源码实例Demo

下面列出了android.view.ViewPropertyAnimator#y ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Hentoid   文件: ZoomableRecyclerView.java
boolean zoomFling(int velocityX, int velocityY) {
    if (scale <= DEFAULT_SCALE) return false;

    float distanceTimeFactor = 0.4f;
    Float newX = null;
    Float newY = null;

    if (velocityX != 0 && canMoveHorizontally()) {
        float dx = (distanceTimeFactor * velocityX / 2);
        newX = getPositionX(getX() + dx);
    }
    if (velocityY != 0 && canMoveVertically()) {
        float dy = (distanceTimeFactor * velocityY / 2);
        newY = getPositionY(getY() + dy);
    }

    ViewPropertyAnimator animation = animate();
    if (newX != null) animation.x(newX);
    if (newY != null) animation.y(newY);
    animation.setInterpolator(new DecelerateInterpolator())
            .setDuration(400)
            .start();

    return true;
}
 
源代码2 项目: ChromeLikeTabSwitcher   文件: PhoneArithmetics.java
@Override
public final void animatePosition(@NonNull final Axis axis,
                                  @NonNull final ViewPropertyAnimator animator,
                                  @NonNull final AbstractItem item, final float position,
                                  final boolean includePadding) {
    Condition.INSTANCE.ensureNotNull(axis, "The axis may not be null");
    Condition.INSTANCE.ensureNotNull(animator, "The animator may not be null");
    Condition.INSTANCE.ensureNotNull(item, "The item may not be null");

    if (getOrientationInvariantAxis(axis) == Axis.DRAGGING_AXIS) {
        Toolbar[] toolbars = getTabSwitcher().getToolbars();
        animator.y((getTabSwitcher().areToolbarsShown() && getTabSwitcher().isSwitcherShown() &&
                toolbars != null ?
                toolbars[TabSwitcher.PRIMARY_TOOLBAR_INDEX].getHeight() - tabInset : 0) +
                (includePadding ? getTabSwitcherPadding(axis, Gravity.START) : 0) + position);
    } else {
        View view = item.getView();
        FrameLayout.LayoutParams layoutParams =
                (FrameLayout.LayoutParams) view.getLayoutParams();
        animator.x(position + layoutParams.leftMargin + (includePadding ?
                getTabSwitcher().getPaddingLeft() / 2f -
                        getTabSwitcher().getPaddingRight() / 2f : 0) -
                (getTabSwitcher().getLayout() == Layout.PHONE_LANDSCAPE &&
                        getTabSwitcher().isSwitcherShown() ?
                        stackedTabCount * stackedTabSpacing / 2f : 0));
    }
}
 
源代码3 项目: SpringActionMenu   文件: ActionMenu.java
/**
 * buttonItem open animation
 */
private void buttonItemOpenAnimation(int index,ActionButtonItems view) {
    if (index == 0) {
        view.startFactorAnimation(duration / 6, 0, 1);
    } else {
        ViewPropertyAnimator propertyAnimator = view.animate().alpha(1).
                setInterpolator(new OvershootInterpolator()).setDuration(duration / 3);

        switch (expandDirect) {
            case expandDirectTop:
                propertyAnimator.y((circleRadius * 2 + dimens) * (childViewCount - 1 - index) + circleRadius * 2);
                break;
            case expandDirectDown:
                propertyAnimator.y(circleRadius * 2 * index + dimens * (index - 1));
                break;
            case expandDirectLeft:
                propertyAnimator.x((circleRadius * 2 + dimens) * (childViewCount - 1 - index) + circleRadius * 2);
                break;
            case expandDirectRight:
                propertyAnimator.x(circleRadius * 2 * index + dimens * (index - 1));
                break;
        }
        if (isOpen) {
            view.setVisibility(View.VISIBLE);
        }

        propertyAnimator.start();

        // start factor animation
        view.startFactorAnimation(duration / 6, 0, -1);
    }
    view.setOpen(isOpen);
}
 
源代码4 项目: MiBandDecompiled   文件: g.java
public com.nineoldandroids.view.ViewPropertyAnimator y(float f)
{
    ViewPropertyAnimator viewpropertyanimator = (ViewPropertyAnimator)b.get();
    if (viewpropertyanimator != null)
    {
        viewpropertyanimator.y(f);
    }
    return this;
}