android.support.v4.view.ViewCompat#animate ( )源码实例Demo

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

源代码1 项目: styT   文件: MaterialRefreshLayout.java
public void finishRefreshing() {
    if (mChildView != null) {
        ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView);
        viewPropertyAnimatorCompat.setDuration(200);
        viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView));
        viewPropertyAnimatorCompat.translationY(0);
        viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
        viewPropertyAnimatorCompat.start();

        if (mMaterialHeaderView != null) {
            mMaterialHeaderView.onComlete(MaterialRefreshLayout.this);
        } else if (mSunLayout != null) {
            mSunLayout.onComlete(MaterialRefreshLayout.this);
        }

        if (refreshListener != null) {
            refreshListener.onfinish();
        }
    }
    isRefreshing = false;
    progressValue = 0;
}
 
源代码2 项目: SprintNBA   文件: MaterialRefreshLayout.java
public void finishRefreshing() {
    if (mChildView != null) {
        ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView);
        viewPropertyAnimatorCompat.setDuration(200);
        viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView));
        viewPropertyAnimatorCompat.translationY(0);
        viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
        viewPropertyAnimatorCompat.start();

        if (mMaterialHeaderView != null) {
            mMaterialHeaderView.onComplete(MaterialRefreshLayout.this);
        } else if (mSunLayout != null) {
            mSunLayout.onComplete(MaterialRefreshLayout.this);
        }

        if (refreshListener != null) {
            refreshListener.onfinish();
        }
    }
    isRefreshing = false;
    progressValue = 0;
}
 
源代码3 项目: RxAnimations   文件: AnimateOnSubscribe.java
@Override
public void call(final CompletableSubscriber completableSubscriber) {
    final View view = viewWeakRef.get();
    if (view == null) {
        completableSubscriber.onCompleted();
        return;
    }

    final ViewPropertyAnimatorCompat animator = ViewCompat.animate(view);
    completableSubscriber.onSubscribe(createClearSubscription(animator));

    if (preTransformActions != null) {
        applyActions(preTransformActions, animator);
        animator.setDuration(NONE).setStartDelay(NONE)
                .withEndAction(() -> runAnimation(completableSubscriber, animator))
                .start();
    } else {
        runAnimation(completableSubscriber, animator);
    }
}
 
源代码4 项目: BitkyShop   文件: MaterialRefreshLayout.java
public void finishRefreshing() {
    if (mChildView != null) {
        ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView);
        viewPropertyAnimatorCompat.setDuration(200);
        viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView));
        viewPropertyAnimatorCompat.translationY(0);
        viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
        viewPropertyAnimatorCompat.start();

        if (mMaterialHeaderView != null) {
            mMaterialHeaderView.onComlete(MaterialRefreshLayout.this);
        } else if (mSunLayout != null) {
            mSunLayout.onComlete(MaterialRefreshLayout.this);
        }

        if (refreshListener != null) {
            refreshListener.onfinish();
        }
    }
    isRefreshing = false;
    progressValue = 0;
}
 
源代码5 项目: MousePaint   文件: MaterialRefreshLayout.java
public void finishRefreshing() {
    if (mChildView != null) {
        ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView);
        viewPropertyAnimatorCompat.setDuration(200);
        viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView));
        viewPropertyAnimatorCompat.translationY(0);
        viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
        viewPropertyAnimatorCompat.start();

        if (materialHeadView != null) {
            materialHeadView.onComlete(MaterialRefreshLayout.this);
        }

        if (refreshListener != null) {
            refreshListener.onfinish();
        }
    }
    isRefreshing = false;
    progressValue = 0;
    setProgressValue(0);
}
 
源代码6 项目: styT   文件: MaterialRefreshLayout.java
public void createAnimatorTranslationY(final View v, final float h, final FrameLayout fl) {
    ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v);
    viewPropertyAnimatorCompat.setDuration(250);
    viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
    viewPropertyAnimatorCompat.translationY(h);
    viewPropertyAnimatorCompat.start();
    viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(View view) {
            float height = ViewCompat.getTranslationY(v);
            fl.getLayoutParams().height = (int) height;
            fl.requestLayout();
        }
    });
}
 
源代码7 项目: Hillffair17   文件: BottomSheetBehavior.java
private void ensureOrCancelAnimator(V child) {
    if (mOffsetValueAnimator == null) {
        mOffsetValueAnimator = ViewCompat.animate(child);
        mOffsetValueAnimator.setDuration(100);
        mOffsetValueAnimator.setInterpolator(INTERPOLATOR);
    } else {
        mOffsetValueAnimator.cancel();
    }
}
 
源代码8 项目: JD-Test   文件: BottomNavBarFabBehaviour.java
private void ensureOrCancelAnimator(FloatingActionButton fab) {
    if (mFabTranslationYAnimator == null) {
        mFabTranslationYAnimator = ViewCompat.animate(fab);
        mFabTranslationYAnimator.setDuration(400);
        mFabTranslationYAnimator.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR);
    } else {
        mFabTranslationYAnimator.cancel();
    }
}
 
源代码9 项目: JD-Test   文件: BadgeItem.java
/**
 * @param animate whether to animate the change
 * @return this, to allow builder pattern
 */
public BadgeItem show(boolean animate) {
    mIsHidden = false;
    if (isWeakReferenceValid()) {
        TextView textView = mTextViewRef.get();
        if (animate) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                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 {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                textView.setScaleX(1);
                textView.setScaleY(1);
            }
            textView.setVisibility(View.VISIBLE);
        }
    }
    return this;
}
 
源代码10 项目: JD-Test   文件: BottomNavigationBar.java
/**
 * Internal Method
 * <p>
 * used to set animation and
 * takes care of cancelling current animation
 * and sets duration and interpolator for animation
 *
 * @param offset translation offset that needs to set with animation
 */
private void animateOffset(final int offset) {
    if (mTranslationAnimator == null) {
        mTranslationAnimator = ViewCompat.animate(this);
        mTranslationAnimator.setDuration(mRippleAnimationDuration);
        mTranslationAnimator.setInterpolator(INTERPOLATOR);
    } else {
        mTranslationAnimator.cancel();
    }
    mTranslationAnimator.translationY(offset).start();
}
 
源代码11 项目: Nimbus   文件: BottomSheetBehavior.java
private void ensureOrCancelAnimator(V child) {
    if (mOffsetValueAnimator == null) {
        mOffsetValueAnimator = ViewCompat.animate(child);
        mOffsetValueAnimator.setDuration(100);
        mOffsetValueAnimator.setInterpolator(INTERPOLATOR);
    } else {
        mOffsetValueAnimator.cancel();
    }
}
 
源代码12 项目: NanoIconPack   文件: BottomNavigationBehavior.java
private void ensureOrCancelAnimator(@NonNull  V child) {
    if (mOffsetValueAnimator == null) {
        mOffsetValueAnimator = ViewCompat.animate(child);
        mOffsetValueAnimator.setDuration(100);
        mOffsetValueAnimator.setInterpolator(INTERPOLATOR);
    } else {
        mOffsetValueAnimator.cancel();
    }
}
 
源代码13 项目: BottomBar   文件: BottomNavigationBehavior.java
private void ensureOrCancelAnimator(V child) {
    if (mTranslationAnimator == null) {
        mTranslationAnimator = ViewCompat.animate(child);
        mTranslationAnimator.setDuration(300);
        mTranslationAnimator.setInterpolator(INTERPOLATOR);
    } else {
        mTranslationAnimator.cancel();
    }
}
 
源代码14 项目: SprintNBA   文件: MaterialRefreshLayout.java
public void createAnimatorTranslationY(final View v, final float h, final FrameLayout fl) {
    ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v);
    viewPropertyAnimatorCompat.setDuration(250);
    viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
    viewPropertyAnimatorCompat.translationY(h);
    viewPropertyAnimatorCompat.start();
    viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(View view) {
            float height = ViewCompat.getTranslationY(v);
            fl.getLayoutParams().height = (int) height;
            fl.requestLayout();
        }
    });
}
 
源代码15 项目: BitkyShop   文件: MaterialRefreshLayout.java
public void createAnimatorTranslationY(final View v, final float h, final FrameLayout fl) {
    ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v);
    viewPropertyAnimatorCompat.setDuration(250);
    viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
    viewPropertyAnimatorCompat.translationY(h);
    viewPropertyAnimatorCompat.start();
    viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(View view) {
            float height = ViewCompat.getTranslationY(v);
            fl.getLayoutParams().height = (int) height;
            fl.requestLayout();
        }
    });
}
 
源代码16 项目: MousePaint   文件: MaterialRefreshLayout.java
public void createAnimatorTranslationY(final View v, final float h, final FrameLayout fl) {
    ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v);
    viewPropertyAnimatorCompat.setDuration(200);
    viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
    viewPropertyAnimatorCompat.translationY(h);
    viewPropertyAnimatorCompat.start();
    viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(View view) {
            float height = ViewCompat.getTranslationY(v);
            fl.getLayoutParams().height = (int) height;
            fl.requestLayout();
        }
    });
}
 
protected ViewPropertyAnimatorCompat onAnimatedAdd(final ViewHolder holder) {
    return ViewCompat.animate(holder.itemView);
}
 
源代码18 项目: android-common-utils   文件: BadgeView.java
public ViewPropertyAnimatorCompat animate(){
	return ViewCompat.animate(view);
}
 
 同类方法