use of com.nineoldandroids.animation.AnimatorSet in project AdvancedMaterialDrawer by madcyph3r.
the class MaterialRippleLayoutNineOld method startRipple.
private void startRipple(final Runnable animationEndRunnable) {
if (eventCancelled)
return;
float endRadius = getEndRadius();
cancelAnimations();
rippleAnimator = new AnimatorSet();
rippleAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (!ripplePersistent) {
setRadius(0);
setRippleAlpha(rippleAlpha);
}
if (animationEndRunnable != null && rippleDelayClick) {
animationEndRunnable.run();
}
childView.setPressed(false);
}
});
ObjectAnimator ripple = ObjectAnimator.ofFloat(this, radiusProperty, radius, endRadius);
ripple.setDuration(rippleDuration);
ripple.setInterpolator(new DecelerateInterpolator());
ObjectAnimator fade = ObjectAnimator.ofInt(this, circleAlphaProperty, rippleAlpha, 0);
fade.setDuration(rippleFadeDuration);
fade.setInterpolator(new AccelerateInterpolator());
fade.setStartDelay(rippleDuration - rippleFadeDuration - FADE_EXTRA_DELAY);
if (ripplePersistent) {
rippleAnimator.play(ripple);
} else if (getRadius() > endRadius) {
fade.setStartDelay(0);
rippleAnimator.play(fade);
} else {
rippleAnimator.playTogether(ripple, fade);
}
rippleAnimator.start();
}
use of com.nineoldandroids.animation.AnimatorSet in project PhotoNoter by yydcdut.
the class SettingActivity method closeActivityAnimation.
private void closeActivityAnimation() {
int actionBarHeight = getActionBarSize();
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int screenHeight = dm.heightPixels;
int contentHeight = screenHeight - actionBarHeight;
AnimatorSet animation = new AnimatorSet();
animation.setDuration(Const.DURATION_ACTIVITY);
animation.playTogether(ObjectAnimator.ofFloat(mToolbarLayout, "translationY", 0, -actionBarHeight), ObjectAnimator.ofFloat(mScrollView, "translationY", 0, contentHeight));
animation.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
mIsHiding = false;
finish();
overridePendingTransition(R.anim.activity_no_animation, R.anim.activity_no_animation);
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
animation.start();
}
use of com.nineoldandroids.animation.AnimatorSet in project PhotoNoter by yydcdut.
the class SettingActivity method startActivityAnimation.
@Override
public void startActivityAnimation() {
int actionBarHeight = getActionBarSize();
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int screenHeight = dm.heightPixels;
int contentHeight = screenHeight - actionBarHeight;
AnimatorSet animation = new AnimatorSet();
animation.setDuration(Const.DURATION_ACTIVITY);
animation.playTogether(ObjectAnimator.ofFloat(mToolbarLayout, "translationY", -actionBarHeight, 0), ObjectAnimator.ofFloat(mScrollView, "translationY", contentHeight, 0));
animation.start();
}
use of com.nineoldandroids.animation.AnimatorSet in project PhotoNoter by yydcdut.
the class AnimationTopLayout method doAnimation.
public void doAnimation() {
ObjectAnimator downAnimation = ObjectAnimator.ofFloat(mChildView, "Y", 0f, getResources().getDimension(R.dimen.dimen_48dip));
downAnimation.setDuration(ANIMATION_TIME / 2);
downAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (mOnAnimationHalfFinishListener != null) {
mOnAnimationHalfFinishListener.onHalf(mChildView);
}
}
});
ObjectAnimator upAnimation = ObjectAnimator.ofFloat(mChildView, "Y", -getResources().getDimension(R.dimen.dimen_48dip), 0f);
upAnimation.setDuration(ANIMATION_TIME / 2);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playSequentially(downAnimation, upAnimation);
animatorSet.start();
}
use of com.nineoldandroids.animation.AnimatorSet in project PhotoNoter by yydcdut.
the class EditTextActivity method finishActivityWithAnimation.
@Override
public void finishActivityWithAnimation(final boolean saved, final int categoryId, final int position, final int comparator) {
int actionBarHeight = getActionBarSize();
int screenHeight = Utils.sScreenHeight;
int contentEditHeight = screenHeight - actionBarHeight;
AnimatorSet animation = new AnimatorSet();
animation.setDuration(Const.DURATION_ACTIVITY);
animation.playTogether(ObjectAnimator.ofFloat(mAppBarLayout, "translationY", 0, -actionBarHeight), ObjectAnimator.ofFloat(mTitleTextInputLayout, "translationY", 0, -actionBarHeight * 3), ObjectAnimator.ofFloat(mContentEdit, "translationY", 0, contentEditHeight), ObjectAnimator.ofFloat(mFabMenuLayout, "translationY", 0, contentEditHeight), ObjectAnimator.ofFloat(mHorizontalEditScrollView, "translationY", 0, contentEditHeight));
animation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (!saved) {
setResult(RESULT_NOTHING);
EditTextActivity.this.finish();
overridePendingTransition(R.anim.activity_no_animation, R.anim.activity_no_animation);
} else {
Intent intent = new Intent();
Bundle bundle = new Bundle();
bundle.putInt(Const.PHOTO_POSITION, position);
bundle.putInt(Const.CATEGORY_ID_4_PHOTNOTES, categoryId);
bundle.putInt(Const.COMPARATOR_FACTORY, comparator);
intent.putExtras(bundle);
setResult(RESULT_DATA, intent);
EditTextActivity.this.finish();
overridePendingTransition(R.anim.activity_no_animation, R.anim.activity_no_animation);
}
}
});
animation.start();
}
Aggregations