use of android.animation.AnimatorSet in project Timber by naman14.
the class FastScroller method showBubble.
private void showBubble() {
AnimatorSet animatorSet = new AnimatorSet();
bubble.setVisibility(VISIBLE);
if (currentAnimator != null)
currentAnimator.cancel();
currentAnimator = ObjectAnimator.ofFloat(bubble, "alpha", 0f, 1f).setDuration(BUBBLE_ANIMATION_DURATION);
currentAnimator.start();
}
use of android.animation.AnimatorSet in project AnimationEasingFunctions by daimajia.
the class MyActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
mEasingList = (ListView) findViewById(R.id.easing_list);
mAdapter = new EasingAdapter(this);
mEasingList.setAdapter(mAdapter);
mTarget = findViewById(R.id.target);
mHistory = (DrawView) findViewById(R.id.history);
mEasingList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
mHistory.clear();
Skill s = (Skill) view.getTag();
AnimatorSet set = new AnimatorSet();
mTarget.setTranslationX(0);
mTarget.setTranslationY(0);
set.playTogether(Glider.glide(s, 1200, ObjectAnimator.ofFloat(mTarget, "translationY", 0, dipToPixels(MyActivity.this, -(160 - 3))), new BaseEasingMethod.EasingListener() {
@Override
public void on(float time, float value, float start, float end, float duration) {
mHistory.drawPoint(time, duration, value - dipToPixels(MyActivity.this, 60));
}
}));
set.setDuration(1200);
set.start();
}
});
}
use of android.animation.AnimatorSet in project circular-progress-button by dmytrodanylyk.
the class MorphingAnimation method start.
public void start() {
ValueAnimator widthAnimation = ValueAnimator.ofInt(mFromWidth, mToWidth);
final GradientDrawable gradientDrawable = mDrawable.getGradientDrawable();
widthAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
Integer value = (Integer) animation.getAnimatedValue();
int leftOffset;
int rightOffset;
int padding;
if (mFromWidth > mToWidth) {
leftOffset = (mFromWidth - value) / 2;
rightOffset = mFromWidth - leftOffset;
padding = (int) (mPadding * animation.getAnimatedFraction());
} else {
leftOffset = (mToWidth - value) / 2;
rightOffset = mToWidth - leftOffset;
padding = (int) (mPadding - mPadding * animation.getAnimatedFraction());
}
gradientDrawable.setBounds(leftOffset + padding, padding, rightOffset - padding, mView.getHeight() - padding);
}
});
ObjectAnimator bgColorAnimation = ObjectAnimator.ofInt(gradientDrawable, "color", mFromColor, mToColor);
bgColorAnimation.setEvaluator(new ArgbEvaluator());
ObjectAnimator strokeColorAnimation = ObjectAnimator.ofInt(mDrawable, "strokeColor", mFromStrokeColor, mToStrokeColor);
strokeColorAnimation.setEvaluator(new ArgbEvaluator());
ObjectAnimator cornerAnimation = ObjectAnimator.ofFloat(gradientDrawable, "cornerRadius", mFromCornerRadius, mToCornerRadius);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(mDuration);
animatorSet.playTogether(widthAnimation, bgColorAnimation, strokeColorAnimation, cornerAnimation);
animatorSet.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
if (mListener != null) {
mListener.onAnimationEnd();
}
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
animatorSet.start();
}
use of android.animation.AnimatorSet in project UltimateAndroid by cymcsg.
the class KugouLayout method init.
private void init(Context context) {
setBackgroundColor(0x0);
/**
* Distance in pixels a touch can wander before we think the user is scrolling
* */
final ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = configuration.getScaledTouchSlop();
mMaxVelocity = configuration.getScaledMaximumFlingVelocity();
mContentContainer = new UnClickableFrameLayout(context);
mContentContainer.setId(R.id.kugou_layout_md__content);
/**
* init Property Animation
* */
mAnimatorSet = new AnimatorSet();
mOffsetAnimator = ObjectAnimator.ofFloat(this, aOffset, 0, 0);
mOffsetAnimator.setDuration(ANIM_DURATION);
mAnimatorSet.playTogether(mOffsetAnimator);
mAnimatorSet.setInterpolator(mInterpolator);
mOffsetAnimator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
float endValue = (Float) mOffsetAnimator.getAnimatedValue();
if ((endValue == getWidth() || endValue == -getWidth())) {
setVisibility(INVISIBLE);
if (null != mLayoutCloseListener) {
mLayoutCloseListener.onLayoutClose();
}
} else if (endValue == 0 && showingChangeAlpha) {
showingChangeAlpha = false;
}
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
/**
* create rebound animator
* */
mSpringSystem = SpringSystem.create();
mSpring = mSpringSystem.createSpring();
SpringConfig config = new SpringConfig(70, 9);
mSpring.setSpringConfig(config);
mSpring.setCurrentValue(0);
mSpring.addListener(new SpringListener() {
@Override
public void onSpringUpdate(Spring spring) {
if (doAnim) {
double newValue = 1 - spring.getCurrentValue();
mOffsetPixels = (float) newValue * mBeginOffsetX;
moveContent();
if (showingChangeAlpha) {
changeAlpha();
}
}
}
@Override
public void onSpringAtRest(Spring spring) {
}
@Override
public void onSpringActivate(Spring spring) {
}
@Override
public void onSpringEndStateChange(Spring spring) {
}
});
/**
* add frame_layout mContentContainer as the parent of the activity's content view
* */
super.addView(mContentContainer, 0, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
mContentContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
use of android.animation.AnimatorSet in project UltimateAndroid by cymcsg.
the class MenuCircleShowingAnimation method closePromotedActions.
/**
* Set close animation for promoted actions
*/
public AnimatorSet closePromotedActions() {
if (objectAnimator == null) {
objectAnimatorSetup();
}
AnimatorSet animation = new AnimatorSet();
for (int i = 0; i < promotedActions.size(); i++) {
objectAnimator[i] = setCloseAnimation(promotedActions.get(i), i);
}
if (objectAnimator.length == 0) {
objectAnimator = null;
}
animation.playTogether(objectAnimator);
animation.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
mainImageButton.startAnimation(rotateCloseAnimation);
mainImageButton.setClickable(false);
}
@Override
public void onAnimationEnd(Animator animator) {
mainImageButton.setClickable(true);
hidePromotedActions();
}
@Override
public void onAnimationCancel(Animator animator) {
mainImageButton.setClickable(true);
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
return animation;
}
Aggregations