use of android.view.animation.LinearInterpolator in project ChipsLayoutManager by BelooS.
the class VerticalScrollingController method createSmoothScroller.
@Override
public RecyclerView.SmoothScroller createSmoothScroller(@NonNull Context context, final int position, final int timeMs, final AnchorViewState anchor) {
return new LinearSmoothScroller(context) {
/*
* LinearSmoothScroller, at a minimum, just need to know the vector
* (x/y distance) to travel in order to get from the current positioning
* to the target.
*/
@Override
public PointF computeScrollVectorForPosition(int targetPosition) {
int visiblePosition = anchor.getPosition();
//determine scroll up or scroll down needed
return new PointF(0, position > visiblePosition ? 1 : -1);
}
@Override
protected void onTargetFound(View targetView, RecyclerView.State state, Action action) {
super.onTargetFound(targetView, state, action);
int desiredTop = lm.getPaddingTop();
int currentTop = lm.getDecoratedTop(targetView);
int dy = currentTop - desiredTop;
//perform fit animation to move target view at top of layout
action.update(0, dy, timeMs, new LinearInterpolator());
}
};
}
use of android.view.animation.LinearInterpolator in project GSYVideoPlayer by CarGuo.
the class ENDownloadView method downloadAnim.
private void downloadAnim() {
if (mValueAnimator != null) {
mValueAnimator.removeAllListeners();
mValueAnimator.removeAllUpdateListeners();
if (mValueAnimator.isRunning())
mValueAnimator.cancel();
mValueAnimator = null;
}
if (mCurrentState != STATE_DOWNLOADING) {
return;
}
mValueAnimator = ValueAnimator.ofFloat(1.f, 100.f);
mValueAnimator.setDuration(mDownloadTime);
mValueAnimator.setInterpolator(new LinearInterpolator());
mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mFraction = valueAnimator.getAnimatedFraction();
if (mUnit != DownloadUnit.NONE && mTotalSize > 0)
mCurrentSize = mFraction * mTotalSize;
invalidate();
}
});
mValueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mCurrentState = STATE_DOWNLOADING;
downloadAnim();
}
});
mValueAnimator.start();
}
use of android.view.animation.LinearInterpolator in project bilibili-android-client by HotBitmapGG.
the class LoveLikeLayout method getEnterAnimtorSet.
/**
* 爱心的显示动画实现
*/
private AnimatorSet getEnterAnimtorSet(View target) {
//爱心的3中动画组合 透明度 x,y轴的缩放
ObjectAnimator alpha = ObjectAnimator.ofFloat(target, View.ALPHA, 0.2f, 1f);
ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, 0.2f, 1f);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, 0.2f, 1f);
//组合动画
AnimatorSet set = new AnimatorSet();
set.setDuration(500);
set.setInterpolator(new LinearInterpolator());
set.playTogether(alpha, scaleX, scaleY);
set.setTarget(target);
return set;
}
use of android.view.animation.LinearInterpolator in project ActionBarSherlock by JakeWharton.
the class IcsProgressBar method startAnimation.
/**
* <p>Start the indeterminate progress animation.</p>
*/
void startAnimation() {
if (getVisibility() != VISIBLE) {
return;
}
if (mIndeterminateDrawable instanceof Animatable) {
mShouldStartAnimationDrawable = true;
mAnimation = null;
} else {
if (mInterpolator == null) {
mInterpolator = new LinearInterpolator();
}
mTransformation = new Transformation();
mAnimation = new AlphaAnimation(0.0f, 1.0f);
mAnimation.setRepeatMode(mBehavior);
mAnimation.setRepeatCount(Animation.INFINITE);
mAnimation.setDuration(mDuration);
mAnimation.setInterpolator(mInterpolator);
mAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
}
postInvalidate();
}
use of android.view.animation.LinearInterpolator in project AndroidChromium by JackyAndroid.
the class ToolbarPhone method createEnterTabSwitcherModeAnimation.
private ObjectAnimator createEnterTabSwitcherModeAnimation() {
ObjectAnimator enterAnimation = ObjectAnimator.ofFloat(this, mTabSwitcherModePercentProperty, 1.f);
enterAnimation.setDuration(TAB_SWITCHER_MODE_ENTER_ANIMATION_DURATION_MS);
enterAnimation.setInterpolator(new LinearInterpolator());
enterAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
// render and only a layout triggers a refresh. See crbug.com/306890.
if (!mToggleTabStackButton.isEnabled())
requestLayout();
}
});
return enterAnimation;
}
Aggregations