Java Code Examples for android.view.ViewPropertyAnimator#y()

The following examples show how to use android.view.ViewPropertyAnimator#y() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZoomableRecyclerView.java    From Hentoid with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: PhoneArithmetics.java    From ChromeLikeTabSwitcher with Apache License 2.0 5 votes vote down vote up
@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));
    }
}
 
Example 3
Source File: ActionMenu.java    From SpringActionMenu with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 4
Source File: g.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public com.nineoldandroids.view.ViewPropertyAnimator y(float f)
{
    ViewPropertyAnimator viewpropertyanimator = (ViewPropertyAnimator)b.get();
    if (viewpropertyanimator != null)
    {
        viewpropertyanimator.y(f);
    }
    return this;
}