android.support.v4.animation.AnimatorCompatHelper Java Examples

The following examples show how to use android.support.v4.animation.AnimatorCompatHelper. 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: GuidePopupToast.java    From fuckView with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected View onCreateView(Context context) {
    final int screenWidth = getActivity().getResources().getDisplayMetrics().widthPixels;
    View layout = LayoutInflater.from(context).inflate(R.layout.guide_toasts, null);
    mText = (TextView) layout.findViewById(R.id.guide_info);
    mSteps = context.getResources().getStringArray(R.array.guide);
    //Set animation
    ViewUtils.setOnFinishLoadListener(layout, new ViewUtils.OnFinishLoadListener() {
        @Override
        public void onFinishedLoad(View view) {
            ValueAnimatorCompat animator = AnimatorCompatHelper.emptyValueAnimator();
            animator.setDuration(1000);
            animator.addUpdateListener(new AnimatorUpdateListenerCompat() {
                @Override
                public void onAnimationUpdate(ValueAnimatorCompat animation) {
                    setX((int) ((1 - animation.getAnimatedFraction()) * screenWidth));
                }
            });
            animator.start();
        }
    });
    goTo(Page.WELCOME.ordinal());
    return layout;
}
 
Example #2
Source File: ItemTouchHelper.java    From letv with Apache License 2.0 6 votes vote down vote up
public RecoverAnimation(ViewHolder viewHolder, int animationType, int actionState, float startDx, float startDy, float targetX, float targetY) {
    this.mActionState = actionState;
    this.mAnimationType = animationType;
    this.mViewHolder = viewHolder;
    this.mStartDx = startDx;
    this.mStartDy = startDy;
    this.mTargetX = targetX;
    this.mTargetY = targetY;
    this.mValueAnimator = AnimatorCompatHelper.emptyValueAnimator();
    this.mValueAnimator.addUpdateListener(new AnimatorUpdateListenerCompat(ItemTouchHelper.this) {
        public void onAnimationUpdate(ValueAnimatorCompat animation) {
            RecoverAnimation.this.setFraction(animation.getAnimatedFraction());
        }
    });
    this.mValueAnimator.setTarget(viewHolder.itemView);
    this.mValueAnimator.addListener(this);
    setFraction(0.0f);
}
 
Example #3
Source File: ImageViewTouchBase.java    From FlickableView with Apache License 2.0 5 votes vote down vote up
protected void zoomTo(float scale, float centerX, float centerY, final long durationMs) {
    if (scale > getMaxScale()) {
        scale = getMaxScale();
    }

    final float oldScale = getScale();

    Matrix m = new Matrix(mSuppMatrix);
    m.postScale(scale, scale, centerX, centerY);
    RectF rect = getCenter(m, true, true);

    final float finalScale = scale;
    final float destX = centerX + rect.left * scale;
    final float destY = centerY + rect.top * scale;

    stopAllAnimations();

    ValueAnimatorCompat animatorCompat = AnimatorCompatHelper.emptyValueAnimator();
    animatorCompat.setDuration(durationMs);
    final Interpolator interpolator = new DecelerateInterpolator(1.0f);
    animatorCompat.addUpdateListener(new AnimatorUpdateListenerCompat() {
        @Override
        public void onAnimationUpdate(ValueAnimatorCompat animation) {
            float fraction = interpolator.getInterpolation(animation.getAnimatedFraction());
            float value = oldScale + (fraction * (finalScale - oldScale));
            zoomTo(value, destX, destY);
        }
    });
    animatorCompat.start();
}
 
Example #4
Source File: DefaultItemAnimator.java    From letv with Apache License 2.0 4 votes vote down vote up
private void resetAnimation(ViewHolder holder) {
    AnimatorCompatHelper.clearInterpolator(holder.itemView);
    endAnimation(holder);
}
 
Example #5
Source File: BaseItemAnimator.java    From narrate-android with Apache License 2.0 4 votes vote down vote up
private void resetAnimation(RecyclerView.ViewHolder holder) {
    AnimatorCompatHelper.clearInterpolator(holder.itemView);
    endAnimation(holder);
}
 
Example #6
Source File: MyDefaultItemAnimator.java    From Dota2Helper with Apache License 2.0 4 votes vote down vote up
private void resetAnimation(RecyclerView.ViewHolder holder) {
    AnimatorCompatHelper.clearInterpolator(holder.itemView);
    endAnimation(holder);
}
 
Example #7
Source File: BaseItemAnimator.java    From onboarding-examples-android with Apache License 2.0 4 votes vote down vote up
private void resetAnimation(ViewHolder holder) {
    AnimatorCompatHelper.clearInterpolator(holder.itemView);
    endAnimation(holder);
}
 
Example #8
Source File: BaseItemAnimator.java    From FloatingSearchView with Apache License 2.0 4 votes vote down vote up
private void resetAnimation(ViewHolder holder) {
    AnimatorCompatHelper.clearInterpolator(holder.itemView);
    endAnimation(holder);
}
 
Example #9
Source File: BaseItemAnimator.java    From MyHearts with Apache License 2.0 4 votes vote down vote up
private void resetAnimation(RecyclerView.ViewHolder holder) {
    AnimatorCompatHelper.clearInterpolator(holder.itemView);
    endAnimation(holder);
}
 
Example #10
Source File: CircularRevealItemAnimator.java    From ExpandableRecyclerView with Apache License 2.0 4 votes vote down vote up
private void resetAnimation(RecyclerView.ViewHolder holder) {
    AnimatorCompatHelper.clearInterpolator(holder.itemView);
    endAnimation(holder);
}
 
Example #11
Source File: AppItemAnimator.java    From AppPlus with MIT License 4 votes vote down vote up
private void resetAnimation(RecyclerView.ViewHolder holder) {
    AnimatorCompatHelper.clearInterpolator(holder.itemView);
    endAnimation(holder);
}
 
Example #12
Source File: BaseItemAnimator.java    From FloatingSearchView with Apache License 2.0 4 votes vote down vote up
private void resetAnimation(ViewHolder holder) {
    AnimatorCompatHelper.clearInterpolator(holder.itemView);
    endAnimation(holder);
}
 
Example #13
Source File: CustomItemAnimator.java    From actor-platform with GNU Affero General Public License v3.0 4 votes vote down vote up
private void resetAnimation(ViewHolder holder) {
    AnimatorCompatHelper.clearInterpolator(holder.itemView);
    endAnimation(holder);
}