use of android.view.animation.LinearInterpolator in project XRecyclerView by jianghejie.
the class BallZigZagDeflectIndicator method createAnimation.
@Override
public List<Animator> createAnimation() {
List<Animator> animators = new ArrayList<>();
float startX = getWidth() / 6;
float startY = getWidth() / 6;
for (int i = 0; i < 2; i++) {
final int index = i;
ValueAnimator translateXAnim = ValueAnimator.ofFloat(startX, getWidth() - startX, startX, getWidth() - startX, startX);
if (i == 1) {
translateXAnim = ValueAnimator.ofFloat(getWidth() - startX, startX, getWidth() - startX, startX, getWidth() - startX);
}
ValueAnimator translateYAnim = ValueAnimator.ofFloat(startY, startY, getHeight() - startY, getHeight() - startY, startY);
if (i == 1) {
translateYAnim = ValueAnimator.ofFloat(getHeight() - startY, getHeight() - startY, startY, startY, getHeight() - startY);
}
translateXAnim.setDuration(2000);
translateXAnim.setInterpolator(new LinearInterpolator());
translateXAnim.setRepeatCount(-1);
translateXAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
translateX[index] = (float) animation.getAnimatedValue();
postInvalidate();
}
});
translateXAnim.start();
translateYAnim.setDuration(2000);
translateYAnim.setInterpolator(new LinearInterpolator());
translateYAnim.setRepeatCount(-1);
translateYAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
translateY[index] = (float) animation.getAnimatedValue();
postInvalidate();
}
});
translateYAnim.start();
animators.add(translateXAnim);
animators.add(translateYAnim);
}
return animators;
}
use of android.view.animation.LinearInterpolator in project XRecyclerView by jianghejie.
the class CubeTransitionIndicator method createAnimation.
@Override
public List<Animator> createAnimation() {
List<Animator> animators = new ArrayList<>();
float startX = getWidth() / 5;
float startY = getHeight() / 5;
for (int i = 0; i < 2; i++) {
final int index = i;
translateX[index] = startX;
ValueAnimator translationXAnim = ValueAnimator.ofFloat(startX, getWidth() - startX, getWidth() - startX, startX, startX);
if (i == 1) {
translationXAnim = ValueAnimator.ofFloat(getWidth() - startX, startX, startX, getWidth() - startX, getWidth() - startX);
}
translationXAnim.setInterpolator(new LinearInterpolator());
translationXAnim.setDuration(1600);
translationXAnim.setRepeatCount(-1);
translationXAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
translateX[index] = (float) animation.getAnimatedValue();
postInvalidate();
}
});
translationXAnim.start();
translateY[index] = startY;
ValueAnimator translationYAnim = ValueAnimator.ofFloat(startY, startY, getHeight() - startY, getHeight() - startY, startY);
if (i == 1) {
translationYAnim = ValueAnimator.ofFloat(getHeight() - startY, getHeight() - startY, startY, startY, getHeight() - startY);
}
translationYAnim.setDuration(1600);
translationYAnim.setInterpolator(new LinearInterpolator());
translationYAnim.setRepeatCount(-1);
translationYAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
translateY[index] = (float) animation.getAnimatedValue();
postInvalidate();
}
});
translationYAnim.start();
animators.add(translationXAnim);
animators.add(translationYAnim);
}
ValueAnimator scaleAnim = ValueAnimator.ofFloat(1, 0.5f, 1, 0.5f, 1);
scaleAnim.setDuration(1600);
scaleAnim.setInterpolator(new LinearInterpolator());
scaleAnim.setRepeatCount(-1);
scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
scaleFloat = (float) animation.getAnimatedValue();
postInvalidate();
}
});
scaleAnim.start();
ValueAnimator rotateAnim = ValueAnimator.ofFloat(0, 180, 360, 1.5f * 360, 2 * 360);
rotateAnim.setDuration(1600);
rotateAnim.setInterpolator(new LinearInterpolator());
rotateAnim.setRepeatCount(-1);
rotateAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
degrees = (float) animation.getAnimatedValue();
postInvalidate();
}
});
rotateAnim.start();
animators.add(scaleAnim);
animators.add(rotateAnim);
return animators;
}
use of android.view.animation.LinearInterpolator in project LoadingView by ldoublem.
the class LVChromeLogo method initPaint.
private void initPaint() {
evaluator = new ArgbEvaluator();
mPaintRed = new Paint();
mPaintRed.setAntiAlias(true);
mPaintRed.setStyle(Paint.Style.FILL);
mPaintRed.setColor(Color.rgb(211, 57, 53));
mPaintYellow = new Paint();
mPaintYellow.setAntiAlias(true);
mPaintYellow.setStyle(Paint.Style.FILL);
mPaintYellow.setColor(Color.rgb(253, 197, 53));
mPaintGreen = new Paint();
mPaintGreen.setAntiAlias(true);
mPaintGreen.setStyle(Paint.Style.FILL);
mPaintGreen.setColor(Color.rgb(27, 147, 76));
mPaintBulue = new Paint();
mPaintBulue.setAntiAlias(true);
mPaintBulue.setStyle(Paint.Style.FILL);
mPaintBulue.setColor(Color.rgb(61, 117, 242));
mPaintWhite = new Paint();
mPaintWhite.setAntiAlias(true);
mPaintWhite.setStyle(Paint.Style.FILL);
mPaintWhite.setColor(Color.WHITE);
mPaintLine = new Paint();
mPaintLine.setAntiAlias(true);
mPaintLine.setStyle(Paint.Style.FILL);
mPaintLine.setColor(Color.argb(30, 0, 0, 0));
mProgerssRotateAnim = new RotateAnimation(0f, 360f, android.view.animation.Animation.RELATIVE_TO_SELF, 0.5f, android.view.animation.Animation.RELATIVE_TO_SELF, 0.5f);
mProgerssRotateAnim.setRepeatCount(-1);
//不停顿
mProgerssRotateAnim.setInterpolator(new LinearInterpolator());
//停在最后
mProgerssRotateAnim.setFillAfter(true);
}
use of android.view.animation.LinearInterpolator in project FastDev4Android by jiangqqlmj.
the class PullToRefreshListView method init.
private void init(Context context) {
mFlipAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mFlipAnimation.setInterpolator(new LinearInterpolator());
mFlipAnimation.setDuration(250);
mFlipAnimation.setFillAfter(true);
mReverseFlipAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
mReverseFlipAnimation.setDuration(250);
mReverseFlipAnimation.setFillAfter(true);
mRefreshView = (LinearLayout) View.inflate(context, R.layout.pull_to_refresh_header, null);
mRefreshViewText = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text);
mRefreshViewImage = (ImageView) mRefreshView.findViewById(R.id.pull_to_refresh_image);
mRefreshViewProgress = (ProgressBar) mRefreshView.findViewById(R.id.pull_to_refresh_progress);
mRefreshViewLastUpdated = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_updated_at);
mRefreshState = PULL_TO_REFRESH;
//设置下拉最小的高度为50
mRefreshViewImage.setMinimumHeight(50);
setFadingEdgeLength(0);
setHeaderDividersEnabled(false);
//把refreshview加入到listview的头部
addHeaderView(mRefreshView);
super.setOnScrollListener(this);
mRefreshView.setOnClickListener(this);
mRefreshView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
mRefreshViewHeight = mRefreshView.getMeasuredHeight();
mRefreshOriginalTopPadding = -mRefreshViewHeight;
resetHeaderPadding();
}
use of android.view.animation.LinearInterpolator in project android-common by Trinea.
the class DropDownListView method initDropDownStyle.
/**
* init drop down style, only init once
*/
private void initDropDownStyle() {
if (headerLayout != null) {
if (isDropDownStyle) {
addHeaderView(headerLayout);
} else {
removeHeaderView(headerLayout);
}
return;
}
if (!isDropDownStyle) {
return;
}
headerReleaseMinDistance = context.getResources().getDimensionPixelSize(R.dimen.drop_down_list_header_release_min_distance);
flipAnimation = new RotateAnimation(0, 180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
flipAnimation.setInterpolator(new LinearInterpolator());
flipAnimation.setDuration(250);
flipAnimation.setFillAfter(true);
reverseFlipAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
reverseFlipAnimation.setInterpolator(new LinearInterpolator());
reverseFlipAnimation.setDuration(250);
reverseFlipAnimation.setFillAfter(true);
headerDefaultText = context.getString(R.string.drop_down_list_header_default_text);
headerPullText = context.getString(R.string.drop_down_list_header_pull_text);
headerReleaseText = context.getString(R.string.drop_down_list_header_release_text);
headerLoadingText = context.getString(R.string.drop_down_list_header_loading_text);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
headerLayout = (RelativeLayout) inflater.inflate(R.layout.drop_down_list_header, this, false);
headerText = (TextView) headerLayout.findViewById(R.id.drop_down_list_header_default_text);
headerImage = (ImageView) headerLayout.findViewById(R.id.drop_down_list_header_image);
headerProgressBar = (ProgressBar) headerLayout.findViewById(R.id.drop_down_list_header_progress_bar);
headerSecondText = (TextView) headerLayout.findViewById(R.id.drop_down_list_header_second_text);
headerLayout.setClickable(true);
headerLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onDropDown();
}
});
headerText.setText(headerDefaultText);
addHeaderView(headerLayout);
measureHeaderLayout(headerLayout);
headerOriginalHeight = headerLayout.getMeasuredHeight();
headerOriginalTopPadding = headerLayout.getPaddingTop();
currentHeaderStatus = HEADER_STATUS_CLICK_TO_LOAD;
}
Aggregations