androidx.core.view.ViewPropertyAnimatorCompat Java Examples

The following examples show how to use androidx.core.view.ViewPropertyAnimatorCompat. 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: BadgeItem.java    From BottomNavigation with Apache License 2.0 6 votes vote down vote up
/**
 * @param animate whether to animate the change
 * @return this, to allow builder pattern
 */
public T show(boolean animate) {
    mIsHidden = false;
    if (isWeakReferenceValid()) {
        TextView textView = mTextViewRef.get();
        if (animate) {
            textView.setScaleX(0);
            textView.setScaleY(0);
            textView.setVisibility(View.VISIBLE);
            ViewPropertyAnimatorCompat animatorCompat = ViewCompat.animate(textView);
            animatorCompat.cancel();
            animatorCompat.setDuration(mAnimationDuration);
            animatorCompat.scaleX(1).scaleY(1);
            animatorCompat.setListener(null);
            animatorCompat.start();
        } else {
            textView.setScaleX(1);
            textView.setScaleY(1);
            textView.setVisibility(View.VISIBLE);
        }
    }
    return getSubInstance();
}
 
Example #2
Source File: PendingItemAnimator.java    From FlexibleAdapter with Apache License 2.0 6 votes vote down vote up
/**
 * Preform your animation. You do not need to override this in most cases cause the default is pretty good.
 * Listeners will be overridden
 **/
protected ViewPropertyAnimatorCompat animateMoveImpl(final ViewHolder holder, int fromX, int fromY, int toX, int toY) {
    final View view = holder.itemView;
    final int deltaX = toX - fromX;
    final int deltaY = toY - fromY;
    ViewCompat.animate(view).cancel();
    if (deltaX != 0) {
        ViewCompat.animate(view).translationX(0);
    }
    if (deltaY != 0) {
        ViewCompat.animate(view).translationY(0);
    }
    // TODO: make EndActions end listeners instead, since end actions aren't called when
    // vpas are canceled (and can't end them. why?)
    // need listener functionality in VPACompat for this. Ick.
    return ViewCompat.animate(view).setInterpolator(null).setDuration(getMoveDuration());
}
 
Example #3
Source File: FlipDownItemAnimator.java    From FlexibleAdapter with Apache License 2.0 5 votes vote down vote up
@Override
protected ViewPropertyAnimatorCompat animateRemoveImpl(ViewHolder holder) {
    return ViewCompat.animate(holder.itemView)
                     .rotationY(90)
                     .translationX(-(holder.itemView.getMeasuredWidth() / 4))
                     .scaleX(0.5F)
                     .scaleY(0.5F)
                     .setInterpolator(new AccelerateInterpolator());
}
 
Example #4
Source File: FlipDownItemAnimator.java    From FlexibleAdapter with Apache License 2.0 5 votes vote down vote up
@Override
protected ViewPropertyAnimatorCompat animateAddImpl(ViewHolder holder) {
    return ViewCompat.animate(holder.itemView)
                     .rotationY(0)
                     .translationX(0)
                     .setInterpolator(new BounceInterpolator());
}
 
Example #5
Source File: FromTopItemAnimator.java    From FlexibleAdapter with Apache License 2.0 5 votes vote down vote up
@Override
protected ViewPropertyAnimatorCompat animateRemoveImpl(ViewHolder holder) {
    Point screen = Utils.getScreenDimensions(holder.itemView.getContext());
    int top = holder.itemView.getTop();
    return ViewCompat.animate(holder.itemView)
                     .rotation(80)
                     .translationY(screen.y - top)
                     .setInterpolator(new AccelerateInterpolator());
}
 
Example #6
Source File: SlideItemAnimator.java    From FlexibleAdapter with Apache License 2.0 5 votes vote down vote up
protected ViewPropertyAnimatorCompat animateRemoveImpl(ViewHolder holder) {
    final View view = holder.itemView;
    ViewCompat.animate(view).cancel();
    return ViewCompat.animate(view)
                     .translationX(Utils.getScreenDimensions(holder.itemView.getContext()).x)
                     .setInterpolator(new AnticipateOvershootInterpolator());
}
 
Example #7
Source File: SlideItemAnimator.java    From FlexibleAdapter with Apache License 2.0 5 votes vote down vote up
protected ViewPropertyAnimatorCompat animateAddImpl(ViewHolder holder) {
    final View view = holder.itemView;
    ViewCompat.animate(view).cancel();
    int width = getWidth(holder);
    return ViewCompat.animate(view)
                     .translationXBy(-width)
                     .setInterpolator(new BounceInterpolator());
}
 
Example #8
Source File: FromTopItemAnimator.java    From FlexibleAdapter with Apache License 2.0 4 votes vote down vote up
@Override
protected ViewPropertyAnimatorCompat animateAddImpl(ViewHolder holder) {
    return ViewCompat.animate(holder.itemView)
                     .translationY(0)
                     .setInterpolator(new OvershootInterpolator());
}
 
Example #9
Source File: PendingItemAnimator.java    From FlexibleAdapter with Apache License 2.0 2 votes vote down vote up
/**
 * Preform your animation. Listener will be overridden.
 **/
protected abstract ViewPropertyAnimatorCompat animateRemoveImpl(H holder);
 
Example #10
Source File: PendingItemAnimator.java    From FlexibleAdapter with Apache License 2.0 2 votes vote down vote up
/**
 * Preform your animation. Listeners will be overridden
 **/
protected abstract ViewPropertyAnimatorCompat animateAddImpl(H holder);