use of android.view.animation.LinearInterpolator in project Bitocle by mthli.
the class SmoothProgressBar method applyStyle.
public void applyStyle(int styleResId) {
TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.SmoothProgressBar, 0, styleResId);
if (a.hasValue(R.styleable.SmoothProgressBar_spb_color)) {
setSmoothProgressDrawableColor(a.getColor(R.styleable.SmoothProgressBar_spb_color, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_colors)) {
int colorsId = a.getResourceId(R.styleable.SmoothProgressBar_spb_colors, 0);
if (colorsId != 0) {
int[] colors = getResources().getIntArray(colorsId);
if (colors != null && colors.length > 0)
setSmoothProgressDrawableColors(colors);
}
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_sections_count)) {
setSmoothProgressDrawableSectionsCount(a.getInteger(R.styleable.SmoothProgressBar_spb_sections_count, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_stroke_separator_length)) {
setSmoothProgressDrawableSeparatorLength(a.getDimensionPixelSize(R.styleable.SmoothProgressBar_spb_stroke_separator_length, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_stroke_width)) {
setSmoothProgressDrawableStrokeWidth(a.getDimension(R.styleable.SmoothProgressBar_spb_stroke_width, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_speed)) {
setSmoothProgressDrawableSpeed(a.getFloat(R.styleable.SmoothProgressBar_spb_speed, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStart_speed)) {
setSmoothProgressDrawableProgressiveStartSpeed(a.getFloat(R.styleable.SmoothProgressBar_spb_progressiveStart_speed, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStop_speed)) {
setSmoothProgressDrawableProgressiveStopSpeed(a.getFloat(R.styleable.SmoothProgressBar_spb_progressiveStop_speed, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_reversed)) {
setSmoothProgressDrawableReversed(a.getBoolean(R.styleable.SmoothProgressBar_spb_reversed, false));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_mirror_mode)) {
setSmoothProgressDrawableMirrorMode(a.getBoolean(R.styleable.SmoothProgressBar_spb_mirror_mode, false));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStart_activated)) {
setProgressiveStartActivated(a.getBoolean(R.styleable.SmoothProgressBar_spb_progressiveStart_activated, false));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStart_activated)) {
setProgressiveStartActivated(a.getBoolean(R.styleable.SmoothProgressBar_spb_progressiveStart_activated, false));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_gradients)) {
setSmoothProgressDrawableUseGradients(a.getBoolean(R.styleable.SmoothProgressBar_spb_gradients, false));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_generate_background_with_colors)) {
if (a.getBoolean(R.styleable.SmoothProgressBar_spb_generate_background_with_colors, false)) {
setSmoothProgressDrawableBackgroundDrawable(SmoothProgressBarUtils.generateDrawableWithColors(checkIndeterminateDrawable().getColors(), checkIndeterminateDrawable().getStrokeWidth()));
}
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_interpolator)) {
int iInterpolator = a.getInteger(R.styleable.SmoothProgressBar_spb_interpolator, -1);
Interpolator interpolator;
switch(iInterpolator) {
case INTERPOLATOR_ACCELERATEDECELERATE:
interpolator = new AccelerateDecelerateInterpolator();
break;
case INTERPOLATOR_DECELERATE:
interpolator = new DecelerateInterpolator();
break;
case INTERPOLATOR_LINEAR:
interpolator = new LinearInterpolator();
break;
case INTERPOLATOR_ACCELERATE:
interpolator = new AccelerateInterpolator();
break;
default:
interpolator = null;
}
if (interpolator != null) {
setInterpolator(interpolator);
}
}
a.recycle();
}
use of android.view.animation.LinearInterpolator in project wechat by motianhuo.
the class FlippingImageView method setRotateAnimation.
private void setRotateAnimation() {
if (mIsHasAnimation == false && getWidth() > 0 && getVisibility() == View.VISIBLE) {
mIsHasAnimation = true;
mAnimation = new RotateAnimation(getWidth() / 2.0F, getHeight() / 2.0F, Mode.Y);
mAnimation.setDuration(1000L);
mAnimation.setInterpolator(new LinearInterpolator());
mAnimation.setRepeatCount(-1);
mAnimation.setRepeatMode(Animation.RESTART);
setAnimation(mAnimation);
}
}
use of android.view.animation.LinearInterpolator in project UltimateAndroid by cymcsg.
the class Titanic method start.
public void start(final TitanicTextView textView) {
final Runnable animate = new Runnable() {
@Override
public void run() {
textView.setSinking(true);
// horizontal animation. 200 = wave.png width
ObjectAnimator maskXAnimator = ObjectAnimator.ofFloat(textView, "maskX", 0, 200);
maskXAnimator.setRepeatCount(ValueAnimator.INFINITE);
maskXAnimator.setDuration(1000);
maskXAnimator.setStartDelay(0);
int h = textView.getHeight();
// vertical animation
// maskY = 0 -> wave vertically centered
// repeat mode REVERSE to go back and forth
ObjectAnimator maskYAnimator = ObjectAnimator.ofFloat(textView, "maskY", h / 2, -h / 2);
maskYAnimator.setRepeatCount(ValueAnimator.INFINITE);
maskYAnimator.setRepeatMode(ValueAnimator.REVERSE);
maskYAnimator.setDuration(10000);
maskYAnimator.setStartDelay(0);
// now play both animations together
animatorSet = new AnimatorSet();
animatorSet.playTogether(maskXAnimator, maskYAnimator);
animatorSet.setInterpolator(new LinearInterpolator());
animatorSet.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
textView.setSinking(false);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
textView.postInvalidate();
} else {
textView.postInvalidateOnAnimation();
}
animatorSet = null;
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
if (animatorListener != null) {
animatorSet.addListener(animatorListener);
}
animatorSet.start();
}
};
if (!textView.isSetUp()) {
textView.setAnimationSetupCallback(new TitanicTextView.AnimationSetupCallback() {
@Override
public void onSetupAnimation(final TitanicTextView target) {
animate.run();
}
});
} else {
animate.run();
}
}
use of android.view.animation.LinearInterpolator in project ETSMobile-Android2 by ApplETS.
the class CustomProgressDialog method show.
@Override
public void show() {
super.show();
RotateAnimation anim = new RotateAnimation(0.0f, 359.0f, Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f);
anim.setInterpolator(new LinearInterpolator());
anim.setRepeatCount(Animation.INFINITE);
anim.setDuration(3000);
rotatingImageView.setAnimation(anim);
rotatingImageView.startAnimation(anim);
}
use of android.view.animation.LinearInterpolator in project ChipsLayoutManager by BelooS.
the class HorizontalScrollingController 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(position > visiblePosition ? 1 : -1, 0);
}
@Override
protected void onTargetFound(View targetView, RecyclerView.State state, Action action) {
super.onTargetFound(targetView, state, action);
int currentLeft = layoutManager.getPaddingLeft();
int desiredLeft = layoutManager.getDecoratedLeft(targetView);
int dx = desiredLeft - currentLeft;
//perform fit animation to move target view at top of layoutX
action.update(dx, 0, timeMs, new LinearInterpolator());
}
};
}
Aggregations