use of android.animation.ValueAnimator in project ENViews by codeestX.
the class ENPlayView method pause.
public void pause() {
if (mCurrentState == STATE_PAUSE) {
return;
}
mCurrentState = STATE_PAUSE;
ValueAnimator valueAnimator = ValueAnimator.ofFloat(1.f, 100.f);
valueAnimator.setDuration(mDuration);
valueAnimator.setInterpolator(new AnticipateInterpolator());
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mFraction = valueAnimator.getAnimatedFraction();
invalidate();
}
});
if (!valueAnimator.isRunning()) {
valueAnimator.start();
}
}
use of android.animation.ValueAnimator in project ENViews by codeestX.
the class ENScrollView method select.
public void select() {
if (mCurrentState == STATE_SELECT) {
return;
}
mCurrentState = STATE_SELECT;
ValueAnimator valueAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mBgLineColor, mLineColor);
valueAnimator.setDuration(mDuration);
valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mFraction = valueAnimator.getAnimatedFraction();
mCurrentColor = (int) valueAnimator.getAnimatedValue();
invalidate();
}
});
if (!valueAnimator.isRunning()) {
valueAnimator.start();
}
valueAnimator.start();
}
use of android.animation.ValueAnimator in project ENViews by codeestX.
the class ENSearchView method start.
public void start() {
if (mCurrentState == STATE_SEARCHING) {
return;
}
mCurrentState = STATE_SEARCHING;
ValueAnimator valueAnim = ValueAnimator.ofFloat(1.f, 100.f);
valueAnim.setDuration(mDuration);
valueAnim.setInterpolator(new LinearInterpolator());
valueAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mFraction = valueAnimator.getAnimatedFraction();
invalidate();
}
});
valueAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mCurrentState = STATE_WAIT;
}
});
valueAnim.start();
}
use of android.animation.ValueAnimator in project ENViews by codeestX.
the class ENVolumeView method closeVolume.
private void closeVolume() {
ValueAnimator valueAnimator = ValueAnimator.ofFloat(1.f, 100.f);
valueAnimator.setDuration(800);
valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mFraction = 1 - valueAnimator.getAnimatedFraction();
invalidate();
}
});
if (!valueAnimator.isRunning()) {
valueAnimator.start();
}
}
use of android.animation.ValueAnimator in project ENViews by codeestX.
the class ENVolumeView method onSizeChanged.
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mWidth = w * 5 / 6;
mHeight = h;
mBaseLength = mWidth / 6;
mCenterX = w / 2;
mCenterY = h / 2;
mPath.moveTo(mCenterX - 3 * mBaseLength, mCenterY);
mPath.lineTo(mCenterX - 3 * mBaseLength, mCenterY - 0.5f * mBaseLength);
mPath.lineTo(mCenterX - 2 * mBaseLength, mCenterY - 0.5f * mBaseLength);
mPath.lineTo(mCenterX, mCenterY - 2 * mBaseLength);
mPath.lineTo(mCenterX, mCenterY + 2 * mBaseLength);
mPath.lineTo(mCenterX - 2 * mBaseLength, mCenterY + 0.5f * mBaseLength);
mPath.lineTo(mCenterX - 3 * mBaseLength, mCenterY + 0.5f * mBaseLength);
mPath.close();
mPathMeasure.setPath(mPath, false);
mPathLength = mPathMeasure.getLength();
vibrateAnim = ValueAnimator.ofFloat(1.f, 100.f);
vibrateAnim.setDuration(100);
vibrateAnim.setInterpolator(new LinearInterpolator());
vibrateAnim.setRepeatCount(ValueAnimator.INFINITE);
vibrateAnim.setRepeatMode(ValueAnimator.REVERSE);
vibrateAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mFraction = valueAnimator.getAnimatedFraction();
invalidate();
}
});
}
Aggregations