Here are the examples of the java api android.animation.AnimatorSet.setDuration() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
526 Examples
19
Source : ChannelAdapter.java
with MIT License
from zzh12138
with MIT License
from zzh12138
private void removeAnimation(final View view, final float x, final float y, final int position) {
final int fromX = view.getLeft();
final int fromY = view.getTop();
final ObjectAnimator animatorX = ObjectAnimator.ofFloat(view, "translationX", 0, x - fromX);
final ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, "translationY", 0, y - fromY);
ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 1, 0);
final AnimatorSet set = new AnimatorSet();
set.playTogether(animatorX, animatorY, alpha);
set.setDuration(350);
set.start();
set.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
if (isRecommend) {
cityList.add(0, mList.get(position));
} else {
recommendList.add(0, mList.get(position));
}
mList.remove(position);
notifyItemRemoved(position);
onItemRangeChangeListener.refrereplacedemDecoration();
// 这里需要重置view的属性
resetView(view, x - fromX, y - fromY);
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
}
19
Source : ChannelAdapter.java
with MIT License
from zzh12138
with MIT License
from zzh12138
/**
* 重置view的位置
*
* @param view
* @param toX
* @param toY
*/
private void resetView(View view, float toX, float toY) {
ObjectAnimator animatorX = ObjectAnimator.ofFloat(view, "translationX", -toX, 0);
ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, "translationY", -toY, 0);
ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 0, 1);
AnimatorSet set = new AnimatorSet();
set.playTogether(animatorX, animatorY, alpha);
set.setDuration(0);
set.setStartDelay(5);
set.start();
}
19
Source : OperationLayout.java
with MIT License
from zhongjhATC
with MIT License
from zhongjhATC
/**
* 多图片拍照后显示的右侧按钮
*/
public void startOperaeBtnAnimatorMulti() {
// 如果本身隐藏的,就显示出来
if (mViewHolder.btnConfirm.getVisibility() == View.GONE) {
// 显示提交按钮
mViewHolder.btnConfirm.setVisibility(VISIBLE);
// 动画未结束前不能让它们点击
mViewHolder.btnConfirm.setClickable(false);
// 显示动画
ObjectAnimator animatorConfirm = ObjectAnimator.ofFloat(mViewHolder.btnConfirm, "translationX", -mLayoutWidth / 4, 0);
AnimatorSet set = new AnimatorSet();
set.playTogether(animatorConfirm);
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
// 动画结束使得按钮可点击
mViewHolder.btnConfirm.setClickable(true);
}
});
set.setDuration(200);
set.start();
}
}
19
Source : OperationLayout.java
with MIT License
from zhongjhATC
with MIT License
from zhongjhATC
/**
* 点击长按结果后的动画
* 显示左右两边的按钮
*/
public void startShowLeftRightButtonsAnimator() {
// 显示提交和取消按钮
mViewHolder.btnConfirm.setVisibility(VISIBLE);
mViewHolder.btnCancel.setVisibility(VISIBLE);
// 动画未结束前不能让它们点击
mViewHolder.btnConfirm.setClickable(false);
mViewHolder.btnCancel.setClickable(false);
// 显示动画
mAnimatorSet.playTogether(mAnimatorCancel, mAnimatorConfirm);
mAnimatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
// 动画结束使得按钮可点击
mViewHolder.btnConfirm.setClickable(true);
mViewHolder.btnCancel.setClickable(true);
}
});
mAnimatorSet.setDuration(300);
mAnimatorSet.start();
}
19
Source : TabRadioButton.java
with Apache License 2.0
from zaaach
with Apache License 2.0
from zaaach
private Animator getDefaultScaleAnimator(float from, float to, long duration) {
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator animatorX = ObjectAnimator.ofFloat(this, "ScaleX", from, to);
ObjectAnimator animatorY = ObjectAnimator.ofFloat(this, "ScaleY", from, to);
animatorSet.play(animatorX).with(animatorY);
animatorSet.setDuration(duration);
animatorSet.setTarget(this);
return animatorSet;
}
19
Source : LoadErrorView.java
with GNU General Public License v3.0
from z-chu
with GNU General Public License v3.0
from z-chu
private void startShowContentAnim(View contentView, final View loadingView) {
AnimatorSet animatorSet = new AnimatorSet();
if (contentView != null && contentView.getVisibility() == View.VISIBLE) {
ObjectAnimator contentFadeIn = ObjectAnimator.ofFloat(contentView, View.ALPHA, 0f, 1f);
ObjectAnimator contentTranslateIn = ObjectAnimator.ofFloat(contentView, View.TRANSLATION_Y, ANIM_TRANSLATE_Y, 0);
animatorSet.playTogether(contentFadeIn, contentTranslateIn);
}
if (loadingView != null && loadingView.getVisibility() == View.VISIBLE) {
ObjectAnimator loadingFadeOut = ObjectAnimator.ofFloat(loadingView, View.ALPHA, 1f, 0f);
ObjectAnimator loadingTranslateOut = ObjectAnimator.ofFloat(loadingView, View.TRANSLATION_Y, 0, -ANIM_TRANSLATE_Y * 2);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
loadingView.setVisibility(View.GONE);
// For future showLoading calls
loadingView.setAlpha(1f);
loadingView.setTranslationY(0);
}
@Override
public void onAnimationStart(Animator animation) {
}
});
animatorSet.playTogether(loadingFadeOut, loadingTranslateOut);
}
animatorSet.setDuration(ANIM_TIME_LONG);
animatorSet.start();
}
19
Source : BaseAnimatorSet.java
with Apache License 2.0
from Yuphee
with Apache License 2.0
from Yuphee
protected void start(final View view) {
/**
* 设置动画中心点:pivotX--->X轴方向动画中心点,pivotY--->Y轴方向动画中心点
*/
// ViewHelper.setPivotX(view, view.getMeasuredWidth() / 2.0f);
// ViewHelper.setPivotY(view, view.getMeasuredHeight() / 2.0f);
reset(view);
setAnimation(view);
animatorSet.setDuration(duration);
if (interpolator != null) {
animatorSet.setInterpolator(interpolator);
}
if (delay > 0) {
animatorSet.setStartDelay(delay);
}
if (listener != null) {
animatorSet.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
listener.onAnimationStart(animator);
}
@Override
public void onAnimationRepeat(Animator animator) {
listener.onAnimationRepeat(animator);
}
@Override
public void onAnimationEnd(Animator animator) {
listener.onAnimationEnd(animator);
}
@Override
public void onAnimationCancel(Animator animator) {
listener.onAnimationCancel(animator);
}
});
}
animatorSet.start();
}
19
Source : PreLayout.java
with Apache License 2.0
from Yuphee
with Apache License 2.0
from Yuphee
private void showView(final View view, AnimatorsListener mListener, long duration) {
if (view == null) {
return;
}
if (mListener != null) {
if (duration <= 0) {
throw new IllegalArgumentException("durantion must more than 0");
}
AnimatorSet animSet = new AnimatorSet();
animSet.playTogether(mListener.onAnimators(mContentView));
animSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
changeViewVisible(view);
}
});
animSet.setDuration(duration);
animSet.start();
} else {
changeViewVisible(view);
}
}
19
Source : PreventKeyboardBlockUtil.java
with Apache License 2.0
from yoyoyaobin
with Apache License 2.0
from yoyoyaobin
void startAnim(int transY) {
float curTranslationY = rootView.getTranslationY();
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(rootView, "translationY", curTranslationY, transY);
animSet.play(objectAnimator);
animSet.setDuration(200);
animSet.start();
}
19
Source : BaseViewAnimator.java
with Apache License 2.0
from yibulaxi
with Apache License 2.0
from yibulaxi
/**
* start to animate
*/
public void start() {
for (Animator animator : mAnimatorSet.getChildAnimations()) {
if (animator instanceof ValueAnimator) {
((ValueAnimator) animator).setRepeatCount(mRepeatTimes);
((ValueAnimator) animator).setRepeatMode(mRepeatMode);
}
}
mAnimatorSet.setDuration(mDuration);
mAnimatorSet.start();
}
19
Source : VerticalBannerView.java
with MIT License
from yanxiaonuo
with MIT License
from yanxiaonuo
private void performSwitch() {
ObjectAnimator animator1 = ObjectAnimator.ofFloat(mFirstView, "translationY", mFirstView.getTranslationY() - mBannerHeight);
ObjectAnimator animator2 = ObjectAnimator.ofFloat(mSecondView, "translationY", mSecondView.getTranslationY() - mBannerHeight);
AnimatorSet set = new AnimatorSet();
set.playTogether(animator1, animator2);
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mFirstView.setTranslationY(0);
mSecondView.setTranslationY(0);
View removedView = getChildAt(0);
mPosition++;
mAdapter.sereplacedem(removedView, mAdapter.gereplacedem(mPosition % mAdapter.getCount()));
removeView(removedView);
addView(removedView, 1);
}
});
set.setDuration(mAnimDuration);
set.start();
}
19
Source : BaseAnimator.java
with Apache License 2.0
from xuexiangjys
with Apache License 2.0
from xuexiangjys
protected void start(final View view) {
reset(view);
setAnimation(view);
mAnimatorSet.setDuration(mDuration);
if (mInterpolator != null) {
mAnimatorSet.setInterpolator(mInterpolator);
}
if (mDelay > 0) {
mAnimatorSet.setStartDelay(mDelay);
}
if (mListener != null) {
mAnimatorSet.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
mListener.onAnimationStart(animator);
}
@Override
public void onAnimationRepeat(Animator animator) {
mListener.onAnimationRepeat(animator);
}
@Override
public void onAnimationEnd(Animator animator) {
mListener.onAnimationEnd(animator);
}
@Override
public void onAnimationCancel(Animator animator) {
mListener.onAnimationCancel(animator);
}
});
}
mAnimatorSet.start();
}
19
Source : ViewCustomAnimationFragment.java
with Apache License 2.0
from xuexiangjys
with Apache License 2.0
from xuexiangjys
/**
* 切换旋转动画
*/
private void switchAnimation() {
ObjectAnimator rotation;
ObjectAnimator alpha;
if (isExpand) {
rotation = ObjectAnimator.ofFloat(ivAdd, "rotation", -45, 0);
alpha = ObjectAnimator.ofFloat(llContainer, "alpha", 1, 0);
} else {
rotation = ObjectAnimator.ofFloat(ivAdd, "rotation", 0, -45);
alpha = ObjectAnimator.ofFloat(llContainer, "alpha", 0, 1);
}
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(alpha).with(rotation);
animatorSet.setDuration(500).start();
isExpand = !isExpand;
}
19
Source : TabLayoutViewPager2Fragment.java
with Apache License 2.0
from xuexiangjys
with Apache License 2.0
from xuexiangjys
private void refreshStatus(final boolean isShow) {
ObjectAnimator rotation;
ObjectAnimator tabAlpha;
ObjectAnimator textAlpha;
if (isShow) {
rotation = ObjectAnimator.ofFloat(ivSwitch, "rotation", 0, -45);
tabAlpha = ObjectAnimator.ofFloat(tabLayout, "alpha", 0, 1);
textAlpha = ObjectAnimator.ofFloat(tvreplacedle, "alpha", 1, 0);
} else {
rotation = ObjectAnimator.ofFloat(ivSwitch, "rotation", -45, 0);
tabAlpha = ObjectAnimator.ofFloat(tabLayout, "alpha", 1, 0);
textAlpha = ObjectAnimator.ofFloat(tvreplacedle, "alpha", 0, 1);
}
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(rotation).with(tabAlpha).with(textAlpha);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
refreshAdapter(isShow);
}
@Override
public void onAnimationEnd(Animator animation) {
switchContainer(isShow);
}
});
animatorSet.setDuration(500).start();
}
19
Source : CheckBox.java
with Apache License 2.0
from wuyinlei
with Apache License 2.0
from wuyinlei
private void animationStart() {
if (isHook) {
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(valueAnimator1, valueAnimator2, valueAnimator3, valueAnimator4, valueAnimatorBorder, valueAnimator);
animatorSet.setInterpolator(new DecelerateInterpolator());
valueAnimatorBorder.setInterpolator(new AccelerateInterpolator());
animatorSet.setDuration(Duration);
animatorSet.start();
} else {
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(cValueAnimator, cValueAnimator1, valueAnimatorBorder, valueAnimator);
animatorSet.setInterpolator(new DecelerateInterpolator());
valueAnimatorBorder.setInterpolator(new AccelerateInterpolator());
animatorSet.setDuration(Duration);
animatorSet.start();
}
}
19
Source : PhotoView.java
with Apache License 2.0
from wanglu1209
with Apache License 2.0
from wanglu1209
public void exit() {
Matrix m = new Matrix();
m.postScale(((float) mImgSize[0] / getWidth()), ((float) mImgSize[1] / getHeight()));
ObjectAnimator scaleOa = ObjectAnimator.ofFloat(this, "scale", attacher.getScale(m));
ObjectAnimator xOa = ObjectAnimator.ofFloat(this, "translationX", mExitLocation[0] - getWidth() / 2 + getScrollX());
ObjectAnimator yOa = ObjectAnimator.ofFloat(this, "translationY", mExitLocation[1] - getHeight() / 2 + getScrollY());
AnimatorSet set = new AnimatorSet();
set.setDuration(250);
set.playTogether(scaleOa, xOa, yOa);
if (getRootView().getBackground().getAlpha() > 0) {
ValueAnimator bgVa = ValueAnimator.ofInt(getRootView().getBackground().getAlpha(), 0);
bgVa.setDuration(250);
bgVa.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
getRootView().getBackground().setAlpha((Integer) animation.getAnimatedValue());
}
});
bgVa.start();
}
set.start();
new Timer().schedule(new TimerTask() {
@Override
public void run() {
mExitListener.exit();
}
}, 270);
}
19
Source : AnimUtils.java
with GNU Lesser General Public License v3.0
from WangDaYeeeeee
with GNU Lesser General Public License v3.0
from WangDaYeeeeee
public static void animScale(final View v, int duration, int delay, float scaleTo) {
ObjectAnimator scaleX = ObjectAnimator.ofFloat(v, "scaleX", v.getScaleX(), scaleTo);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(v, "scaleY", v.getScaleY(), scaleTo);
AnimatorSet set = new AnimatorSet();
set.setDuration(duration);
if (delay > 0) {
set.setStartDelay(delay);
}
set.setInterpolator(new DecelerateInterpolator());
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
if (v.getVisibility() != View.VISIBLE) {
v.setVisibility(View.VISIBLE);
}
}
});
set.play(scaleX).with(scaleY);
set.start();
}
19
Source : EasyFlipView.java
with Apache License 2.0
from wajahatkarim3
with Apache License 2.0
from wajahatkarim3
/**
* Flip the view for one side with or without animation.
*
* @param withAnimation true means flip view with animation otherwise without animation.
*/
public void flipTheView(boolean withAnimation) {
if (getChildCount() < 2)
return;
if (flipType.equalsIgnoreCase("horizontal")) {
if (!withAnimation) {
mSetLeftIn.setDuration(0);
mSetRightOut.setDuration(0);
boolean oldFlipEnabled = flipEnabled;
flipEnabled = true;
flipTheView();
mSetLeftIn.setDuration(flipDuration);
mSetRightOut.setDuration(flipDuration);
flipEnabled = oldFlipEnabled;
} else {
flipTheView();
}
} else {
if (!withAnimation) {
mSetBottomIn.setDuration(0);
mSetTopOut.setDuration(0);
boolean oldFlipEnabled = flipEnabled;
flipEnabled = true;
flipTheView();
mSetBottomIn.setDuration(flipDuration);
mSetTopOut.setDuration(flipDuration);
flipEnabled = oldFlipEnabled;
} else {
flipTheView();
}
}
}
19
Source : AuthAdapter.java
with MIT License
from vpaliy
with MIT License
from vpaliy
@Override
public void scale(boolean hasFocus) {
final float scale = hasFocus ? 1 : 1.4f;
final float logoScale = hasFocus ? 0.75f : 1f;
View logo = sharedElements.get(0);
AnimatorSet scaleAnimation = new AnimatorSet();
scaleAnimation.playTogether(ObjectAnimator.ofFloat(logo, View.SCALE_X, logoScale));
scaleAnimation.playTogether(ObjectAnimator.ofFloat(logo, View.SCALE_Y, logoScale));
scaleAnimation.playTogether(ObjectAnimator.ofFloat(authBackground, View.SCALE_X, scale));
scaleAnimation.playTogether(ObjectAnimator.ofFloat(authBackground, View.SCALE_Y, scale));
scaleAnimation.setDuration(200);
scaleAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
scaleAnimation.start();
}
19
Source : DragView.java
with Apache License 2.0
from triline3
with Apache License 2.0
from triline3
public void dragEnd() {
ObjectAnimator animatorX = ObjectAnimator.ofFloat(this, "x", getX(), mCreateX);
ObjectAnimator animatorY = ObjectAnimator.ofFloat(this, "y", getY(), mCreateY);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(550);
animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.play(animatorX).with(animatorY);
animatorSet.addListener(animatorListener);
animatorSet.start();
}
19
Source : DragView.java
with Apache License 2.0
from triline3
with Apache License 2.0
from triline3
public void drop() {
ObjectAnimator animatorX = ObjectAnimator.ofFloat(this, "x", getX(), mTouchX - layoutWidth / 2);
ObjectAnimator animatorY = ObjectAnimator.ofFloat(this, "y", getY(), mTouchY - layoutHeight / 2);
ObjectAnimator animatorWidth = ObjectAnimator.ofFloat(this, "scaleX", 1f, 0f);
ObjectAnimator animatorHeight = ObjectAnimator.ofFloat(this, "scaleY", 1f, 0f);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(450);
animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.play(animatorX).with(animatorY).with(animatorWidth).with(animatorHeight);
animatorSet.addListener(animatorListener);
animatorSet.start();
mTargetView.setVisibility(VISIBLE);
}
19
Source : MorphingAnimation.java
with Apache License 2.0
from triline3
with Apache License 2.0
from triline3
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();
}
19
Source : AnimatorAdapter.java
with Apache License 2.0
from triline3
with Apache License 2.0
from triline3
protected void initAnimatorSet() {
mSet = new AnimatorSet();
mSet.setInterpolator(new AccelerateDecelerateInterpolator());
mSet.setDuration(getDuration());
}
19
Source : CircleLoading.java
with Apache License 2.0
from tommybuonomo
with Apache License 2.0
from tommybuonomo
private void setUpAnimators(int duration) {
AnimatorSet outerAnimatorSet = createCircleAnimation(mOuterCircle, true);
AnimatorSet innerAnimatorSet = createCircleAnimation(mInnerCircle, false);
outerAnimatorSet.setDuration(duration);
innerAnimatorSet.setDuration(duration);
mCircleAnimator = new AnimatorSet();
mCircleAnimator.playTogether(outerAnimatorSet, innerAnimatorSet);
mCircleAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
mCircleAnimator.start();
}
});
}
19
Source : ElemeRefreshView.java
with Apache License 2.0
from tohodog
with Apache License 2.0
from tohodog
private void popAnime(final View v) {
flag = !flag;
int w = (int) (2 * 30 * density);
int h = (int) (1.5 * 30 * density);
int h1 = h * 8 / 10;
ObjectAnimator animator1 = ObjectAnimator.ofFloat(v, "translationX", 0.0f, flag ? -w : w);
ObjectAnimator animator2 = ObjectAnimator.ofFloat(v, "translationY", 0, -h1, -h, -h, -h1, -(float) Math.random() * h1 / 2);
// animator2.setInterpolator(new AccelerateDecelerateInterpolator());
AnimatorSet set = new AnimatorSet();
// set.setInterpolator(new AccelerateInterpolator());
set.setDuration(1000);
set.play(animator1);
set.play(animator2);
set.start();
set.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
v.setVisibility(GONE);
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
}
19
Source : IdenticonActivity.java
with GNU General Public License v2.0
from TelePlusDev
with GNU General Public License v2.0
from TelePlusDev
private void updateEmojiButton(boolean animated) {
if (animatorSet != null) {
animatorSet.cancel();
animatorSet = null;
}
if (animated) {
animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(emojiTextView, "alpha", emojiSelected ? 1.0f : 0.0f), ObjectAnimator.ofFloat(codeTextView, "alpha", emojiSelected ? 0.0f : 1.0f), ObjectAnimator.ofFloat(emojiTextView, "scaleX", emojiSelected ? 1.0f : 0.0f), ObjectAnimator.ofFloat(emojiTextView, "scaleY", emojiSelected ? 1.0f : 0.0f), ObjectAnimator.ofFloat(codeTextView, "scaleX", emojiSelected ? 0.0f : 1.0f), ObjectAnimator.ofFloat(codeTextView, "scaleY", emojiSelected ? 0.0f : 1.0f));
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (animation.equals(animatorSet)) {
animatorSet = null;
}
}
});
animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.setDuration(150);
animatorSet.start();
} else {
emojiTextView.setAlpha(emojiSelected ? 1.0f : 0.0f);
codeTextView.setAlpha(emojiSelected ? 0.0f : 1.0f);
emojiTextView.setScaleX(emojiSelected ? 1.0f : 0.0f);
emojiTextView.setScaleY(emojiSelected ? 1.0f : 0.0f);
codeTextView.setScaleX(emojiSelected ? 0.0f : 1.0f);
codeTextView.setScaleY(emojiSelected ? 0.0f : 1.0f);
}
emojiTextView.setTag(!emojiSelected ? Theme.key_chat_emojiPanelIcon : Theme.key_chat_emojiPanelIconSelected);
}
19
Source : DataSettingsActivity.java
with GNU General Public License v2.0
from TelePlusDev
with GNU General Public License v2.0
from TelePlusDev
private void updateAutodownloadRows(boolean check) {
int count = listView.getChildCount();
ArrayList<Animator> animators = new ArrayList<>();
for (int a = 0; a < count; a++) {
View child = listView.getChildAt(a);
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.getChildViewHolder(child);
int type = holder.gereplacedemViewType();
int p = holder.getAdapterPosition();
if (p >= photosRow && p <= gifsRow) {
TextSettingsCell textCell = (TextSettingsCell) holder.itemView;
textCell.setEnabled(DownloadController.getInstance(currentAccount).globalAutodownloadEnabled, animators);
} else if (check && p == autoDownloadMediaRow) {
TextCheckCell textCell = (TextCheckCell) holder.itemView;
textCell.setChecked(true);
}
}
if (!animators.isEmpty()) {
if (animatorSet != null) {
animatorSet.cancel();
}
animatorSet = new AnimatorSet();
animatorSet.playTogether(animators);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (animator.equals(animatorSet)) {
animatorSet = null;
}
}
});
animatorSet.setDuration(150);
animatorSet.start();
}
}
19
Source : UpdateAppAlertDialog.java
with GNU General Public License v2.0
from TelePlusDev
with GNU General Public License v2.0
from TelePlusDev
private void showProgress(final boolean show) {
if (progressAnimation != null) {
progressAnimation.cancel();
}
progressAnimation = new AnimatorSet();
final View textButton = buttonsLayout.findViewWithTag(BUTTON_POSITIVE);
if (show) {
radialProgressView.setVisibility(View.VISIBLE);
textButton.setEnabled(false);
progressAnimation.playTogether(ObjectAnimator.ofFloat(textButton, "scaleX", 0.1f), ObjectAnimator.ofFloat(textButton, "scaleY", 0.1f), ObjectAnimator.ofFloat(textButton, "alpha", 0.0f), ObjectAnimator.ofFloat(radialProgressView, "scaleX", 1.0f), ObjectAnimator.ofFloat(radialProgressView, "scaleY", 1.0f), ObjectAnimator.ofFloat(radialProgressView, "alpha", 1.0f));
} else {
textButton.setVisibility(View.VISIBLE);
textButton.setEnabled(true);
progressAnimation.playTogether(ObjectAnimator.ofFloat(radialProgressView, "scaleX", 0.1f), ObjectAnimator.ofFloat(radialProgressView, "scaleY", 0.1f), ObjectAnimator.ofFloat(radialProgressView, "alpha", 0.0f), ObjectAnimator.ofFloat(textButton, "scaleX", 1.0f), ObjectAnimator.ofFloat(textButton, "scaleY", 1.0f), ObjectAnimator.ofFloat(textButton, "alpha", 1.0f));
}
progressAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (progressAnimation != null && progressAnimation.equals(animation)) {
if (!show) {
radialProgressView.setVisibility(View.INVISIBLE);
} else {
textButton.setVisibility(View.INVISIBLE);
}
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (progressAnimation != null && progressAnimation.equals(animation)) {
progressAnimation = null;
}
}
});
progressAnimation.setDuration(150);
progressAnimation.start();
}
19
Source : ShutterButton.java
with GNU General Public License v2.0
from TelePlusDev
with GNU General Public License v2.0
from TelePlusDev
private void setHighlighted(boolean value) {
AnimatorSet animatorSet = new AnimatorSet();
if (value) {
animatorSet.playTogether(ObjectAnimator.ofFloat(this, "scaleX", 1.06f), ObjectAnimator.ofFloat(this, "scaleY", 1.06f));
} else {
animatorSet.playTogether(ObjectAnimator.ofFloat(this, "scaleX", 1.0f), ObjectAnimator.ofFloat(this, "scaleY", 1.0f));
animatorSet.setStartDelay(40);
}
animatorSet.setDuration(120);
animatorSet.setInterpolator(interpolator);
animatorSet.start();
}
19
Source : PipVideoView.java
with GNU General Public License v2.0
from TelePlusDev
with GNU General Public License v2.0
from TelePlusDev
private void animateToBoundsMaybe() {
int startX = getSideCoord(true, 0, 0, videoWidth);
int endX = getSideCoord(true, 1, 0, videoWidth);
int startY = getSideCoord(false, 0, 0, videoHeight);
int endY = getSideCoord(false, 1, 0, videoHeight);
ArrayList<Animator> animators = null;
SharedPreferences.Editor editor = preferences.edit();
int maxDiff = AndroidUtilities.dp(20);
boolean slideOut = false;
if (Math.abs(startX - windowLayoutParams.x) <= maxDiff || windowLayoutParams.x < 0 && windowLayoutParams.x > -videoWidth / 4) {
if (animators == null) {
animators = new ArrayList<>();
}
editor.putInt("sidex", 0);
if (windowView.getAlpha() != 1.0f) {
animators.add(ObjectAnimator.ofFloat(windowView, "alpha", 1.0f));
}
animators.add(ObjectAnimator.ofInt(this, "x", startX));
} else if (Math.abs(endX - windowLayoutParams.x) <= maxDiff || windowLayoutParams.x > AndroidUtilities.displaySize.x - videoWidth && windowLayoutParams.x < AndroidUtilities.displaySize.x - videoWidth / 4 * 3) {
if (animators == null) {
animators = new ArrayList<>();
}
editor.putInt("sidex", 1);
if (windowView.getAlpha() != 1.0f) {
animators.add(ObjectAnimator.ofFloat(windowView, "alpha", 1.0f));
}
animators.add(ObjectAnimator.ofInt(this, "x", endX));
} else if (windowView.getAlpha() != 1.0f) {
if (animators == null) {
animators = new ArrayList<>();
}
if (windowLayoutParams.x < 0) {
animators.add(ObjectAnimator.ofInt(this, "x", -videoWidth));
} else {
animators.add(ObjectAnimator.ofInt(this, "x", AndroidUtilities.displaySize.x));
}
slideOut = true;
} else {
editor.putFloat("px", (windowLayoutParams.x - startX) / (float) (endX - startX));
editor.putInt("sidex", 2);
}
if (!slideOut) {
if (Math.abs(startY - windowLayoutParams.y) <= maxDiff || windowLayoutParams.y <= ActionBar.getCurrentActionBarHeight()) {
if (animators == null) {
animators = new ArrayList<>();
}
editor.putInt("sidey", 0);
animators.add(ObjectAnimator.ofInt(this, "y", startY));
} else if (Math.abs(endY - windowLayoutParams.y) <= maxDiff) {
if (animators == null) {
animators = new ArrayList<>();
}
editor.putInt("sidey", 1);
animators.add(ObjectAnimator.ofInt(this, "y", endY));
} else {
editor.putFloat("py", (windowLayoutParams.y - startY) / (float) (endY - startY));
editor.putInt("sidey", 2);
}
editor.commit();
}
if (animators != null) {
if (decelerateInterpolator == null) {
decelerateInterpolator = new DecelerateInterpolator();
}
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setInterpolator(decelerateInterpolator);
animatorSet.setDuration(150);
if (slideOut) {
animators.add(ObjectAnimator.ofFloat(windowView, "alpha", 0.0f));
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (parentSheet != null) {
parentSheet.destroy();
} else if (photoViewer != null) {
photoViewer.destroyPhotoViewer();
}
}
});
}
animatorSet.playTogether(animators);
animatorSet.start();
}
}
19
Source : PhotoPickerPhotoCell.java
with GNU General Public License v2.0
from TelePlusDev
with GNU General Public License v2.0
from TelePlusDev
public void showCheck(boolean show) {
if (animatorSet != null) {
animatorSet.cancel();
animatorSet = null;
}
animatorSet = new AnimatorSet();
animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.setDuration(180);
animatorSet.playTogether(ObjectAnimator.ofFloat(videoInfoContainer, "alpha", show ? 1.0f : 0.0f), ObjectAnimator.ofFloat(checkBox, "alpha", show ? 1.0f : 0.0f));
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (animation.equals(animatorSet)) {
animatorSet = null;
}
}
});
animatorSet.start();
}
19
Source : PhotoPickerPhotoCell.java
with GNU General Public License v2.0
from TelePlusDev
with GNU General Public License v2.0
from TelePlusDev
public void setChecked(final int num, final boolean checked, final boolean animated) {
checkBox.setChecked(num, checked, animated);
if (animator != null) {
animator.cancel();
animator = null;
}
if (zoomOnSelect) {
if (animated) {
if (checked) {
setBackgroundColor(0xff0a0a0a);
}
animator = new AnimatorSet();
animator.playTogether(ObjectAnimator.ofFloat(photoImage, "scaleX", checked ? 0.85f : 1.0f), ObjectAnimator.ofFloat(photoImage, "scaleY", checked ? 0.85f : 1.0f));
animator.setDuration(200);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (animator != null && animator.equals(animation)) {
animator = null;
if (!checked) {
setBackgroundColor(0);
}
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (animator != null && animator.equals(animation)) {
animator = null;
}
}
});
animator.start();
} else {
setBackgroundColor(checked ? 0xff0A0A0A : 0);
photoImage.setScaleX(checked ? 0.85f : 1.0f);
photoImage.setScaleY(checked ? 0.85f : 1.0f);
}
}
}
19
Source : ActionBarPopupWindow.java
with GNU General Public License v2.0
from TelePlusDev
with GNU General Public License v2.0
from TelePlusDev
public void dismiss(boolean animated) {
setFocusable(false);
if (animationEnabled && animated) {
if (windowAnimatorSet != null) {
windowAnimatorSet.cancel();
}
ActionBarPopupWindowLayout content = (ActionBarPopupWindowLayout) getContentView();
windowAnimatorSet = new AnimatorSet();
windowAnimatorSet.playTogether(ObjectAnimator.ofFloat(content, "translationY", AndroidUtilities.dp(content.showedFromBotton ? 5 : -5)), ObjectAnimator.ofFloat(content, "alpha", 0.0f));
windowAnimatorSet.setDuration(150);
windowAnimatorSet.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
windowAnimatorSet = null;
setFocusable(false);
try {
ActionBarPopupWindow.super.dismiss();
} catch (Exception e) {
// don't promt
}
unregisterListener();
}
@Override
public void onAnimationCancel(Animator animation) {
onAnimationEnd(animation);
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
windowAnimatorSet.start();
} else {
try {
super.dismiss();
} catch (Exception e) {
// don't promt
}
unregisterListener();
}
}
19
Source : AnimationEngine.java
with Apache License 2.0
from TaoPaox
with Apache License 2.0
from TaoPaox
public void startTogether(long duration, Animator.AnimatorListener listener, List<AnimatorValue> animatorValues) {
if (animationSet == null) {
Log.d(TAG, "δ�ܳ�ʼ��");
return;
}
if (listener != null) {
animationSet.addListener(listener);
}
lits.clear();
for (AnimatorValue animatorValue : animatorValues) {
if (animatorValue.getAnimator() != null) {
lits.add(animatorValue.getAnimator());
}
}
if (lits.isEmpty()) {
Log.d(TAG, "���������ǿ�");
return;
}
animationSet.playTogether(lits);
animationSet.setDuration(duration);
animationSet.setInterpolator(interpolator);
animationSet.start();
}
19
Source : AnimationEngine.java
with Apache License 2.0
from TaoPaox
with Apache License 2.0
from TaoPaox
public void startSequentially(long duration, Animator.AnimatorListener listener, AnimatorValue... animatorValues) {
if (animationSet == null) {
Log.d(TAG, "δ�ܳ�ʼ��");
return;
}
if (listener != null) {
animationSet.addListener(listener);
}
animationSet.setDuration(duration);
animationSet.setInterpolator(interpolator);
lits.clear();
for (AnimatorValue animatorValue : animatorValues) {
if (animatorValue.getAnimator() != null) {
lits.add(animatorValue.getAnimator());
}
}
if (lits.isEmpty()) {
Log.d(TAG, "���������ǿ�");
return;
}
animationSet.playSequentially(lits);
animationSet.setDuration(duration);
animationSet.setInterpolator(interpolator);
animationSet.start();
}
19
Source : AnimationEngine.java
with Apache License 2.0
from TaoPaox
with Apache License 2.0
from TaoPaox
public void startTogether(long duration, Animator.AnimatorListener listener, AnimatorValue... animatorValues) {
if (animationSet == null) {
Log.d(TAG, "δ�ܳ�ʼ��");
return;
}
if (listener != null) {
animationSet.addListener(listener);
}
lits.clear();
for (AnimatorValue animatorValue : animatorValues) {
if (animatorValue.getAnimator() != null) {
lits.add(animatorValue.getAnimator());
}
}
if (lits.isEmpty()) {
Log.d(TAG, "���������ǿ�");
return;
}
animationSet.playTogether(lits);
animationSet.setDuration(duration);
animationSet.setInterpolator(interpolator);
animationSet.start();
}
19
Source : WaveRefreshLayout.java
with MIT License
from StevenDXC
with MIT License
from StevenDXC
private void startAnimation(boolean startLoading) {
ValueAnimator animator = ValueAnimator.ofFloat(background.getTopMargin(), topImageHeight);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
float value = (Float) valueAnimator.getAnimatedValue();
background.setTopMargin(value - topImageHeight);
}
});
ValueAnimator animatorPadding = ValueAnimator.ofInt(getPaddingTop(), mPaddingTop);
animatorPadding.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
int value = (Integer) valueAnimator.getAnimatedValue();
setPadding(0, value, 0, 0);
}
});
AnimatorSet set = new AnimatorSet();
if (startLoading) {
set.playTogether(animator, animatorPadding, background.getPreLoadingAnimator());
} else {
set.playTogether(animator, animatorPadding);
}
set.setDuration(300);
set.setInterpolator(new BounceInterpolator());
if (startLoading) {
set.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
startLoading();
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
}
set.start();
}
19
Source : RefreshScrollView.java
with MIT License
from StevenDXC
with MIT License
from StevenDXC
private void playScaleAnimation() {
if (mAnimatableView == null) {
return;
}
ObjectAnimator animatorSX = ObjectAnimator.ofFloat(mAnimatableView, "scaleX", mAnimatableView.getScaleX(), 0);
ObjectAnimator animatorSY = ObjectAnimator.ofFloat(mAnimatableView, "scaleY", mAnimatableView.getScaleY(), 0);
AnimatorSet set = new AnimatorSet();
set.setDuration(animationDuration);
set.playTogether(animatorSX, animatorSY);
set.setInterpolator(new BounceInterpolator());
set.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
mAnimatableView.setVisibility(View.INVISIBLE);
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
set.start();
}
19
Source : RefreshScrollView.java
with MIT License
from StevenDXC
with MIT License
from StevenDXC
private void playRestoreScaleAnimation() {
if (mAnimatableView == null) {
return;
}
ObjectAnimator animatorSX = ObjectAnimator.ofFloat(mAnimatableView, "scaleX", mAnimatableView.getScaleX(), 1);
ObjectAnimator animatorSY = ObjectAnimator.ofFloat(mAnimatableView, "scaleY", mAnimatableView.getScaleY(), 1);
AnimatorSet set = new AnimatorSet();
set.setDuration(animationDuration);
set.playTogether(animatorSX, animatorSY);
set.setInterpolator(new BounceInterpolator());
set.start();
}
19
Source : RefreshScrollView.java
with MIT License
from StevenDXC
with MIT License
from StevenDXC
private void playStopAnimation() {
if (mAnimatableView == null) {
return;
}
if (mAnimatableView.getVisibility() != View.VISIBLE) {
mAnimatableView.setVisibility(View.VISIBLE);
}
ObjectAnimator animatorSX = ObjectAnimator.ofFloat(mAnimatableView, "scaleX", 0, 1);
ObjectAnimator animatorSY = ObjectAnimator.ofFloat(mAnimatableView, "scaleY", 0, 1);
AnimatorSet set = new AnimatorSet();
set.setDuration(animationDuration);
set.setStartDelay(animationDuration);
set.playTogether(animatorSX, animatorSY);
set.setInterpolator(new AccelerateDecelerateInterpolator());
set.start();
}
19
Source : FloatView.java
with Apache License 2.0
from starscryer
with Apache License 2.0
from starscryer
public void show() {
if (isShowing())
return;
setVisibility(VISIBLE);
AnimatorSet set = new AnimatorSet();
final ObjectAnimator alphaAnimatorX = ObjectAnimator.ofFloat(mContainerView, "scaleX", 0f, 1f);
final ObjectAnimator alphaAnimatorY = ObjectAnimator.ofFloat(mContainerView, "scaleY", 0f, 1f);
set.setDuration(300);
set.setInterpolator(new LinearInterpolator());
set.playTogether(alphaAnimatorX, alphaAnimatorY);
set.start();
if (BuildConfig.DEBUG) {
XposedLog.verbose("FloatView show");
}
}
19
Source : FloatView.java
with Apache License 2.0
from starscryer
with Apache License 2.0
from starscryer
public void hideAndDetach() {
if (!isShowing())
return;
AnimatorSet set = new AnimatorSet();
final ObjectAnimator alphaAnimatorX = ObjectAnimator.ofFloat(mContainerView, "scaleX", 1f, 0f);
final ObjectAnimator alphaAnimatorY = ObjectAnimator.ofFloat(mContainerView, "scaleY", 1f, 0f);
set.setDuration(200);
set.setInterpolator(new LinearInterpolator());
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
setVisibility(INVISIBLE);
detach();
}
});
set.playTogether(alphaAnimatorX, alphaAnimatorY);
set.start();
}
19
Source : FloatView.java
with Apache License 2.0
from starscryer
with Apache License 2.0
from starscryer
private void performTapFeedbackIfNeed() {
if (!mFeedbackAnimEnabled)
return;
AnimatorSet set = new AnimatorSet();
final ObjectAnimator alphaAnimatorX = ObjectAnimator.ofFloat(mContainerView, "scaleX", 1f, 0.8f);
final ObjectAnimator alphaAnimatorY = ObjectAnimator.ofFloat(mContainerView, "scaleY", 1f, 0.8f);
set.setDuration(120);
set.setInterpolator(new LinearInterpolator());
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
AnimatorSet set = new AnimatorSet();
final ObjectAnimator alphaAnimatorX = ObjectAnimator.ofFloat(mContainerView, "scaleX", 0.8f, 1f);
final ObjectAnimator alphaAnimatorY = ObjectAnimator.ofFloat(mContainerView, "scaleY", 0.8f, 1f);
set.setDuration(120);
set.setInterpolator(new LinearInterpolator());
set.playTogether(alphaAnimatorX, alphaAnimatorY);
set.start();
}
});
set.playTogether(alphaAnimatorX, alphaAnimatorY);
set.start();
}
19
Source : FloatingActionMenu.java
with Apache License 2.0
from sougata-chatterjee
with Apache License 2.0
from sougata-chatterjee
/**
* Sets whether open and close actions should be animated
*
* @param animated if <b>false</b> - menu items will appear/disappear instantly without any animation
*/
public void setAnimated(boolean animated) {
mIsAnimated = animated;
mOpenAnimatorSet.setDuration(animated ? ANIMATION_DURATION : 0);
mCloseAnimatorSet.setDuration(animated ? ANIMATION_DURATION : 0);
}
19
Source : SplashActivity.java
with Apache License 2.0
from simplebam
with Apache License 2.0
from simplebam
private void startTextAnim(TextView textView) {
Random r = new Random();
int x = r.nextInt(ScreenUtils.getScreenWidth() * 4 / 3);
int y = r.nextInt(ScreenUtils.getScreenHeight() * 4 / 3);
float s = r.nextFloat() + 4.0f;
// translation:平移 scale:缩放 alpha:透明度 rotate:旋转
ValueAnimator tranY = ObjectAnimator.ofFloat(textView, "translationY", y - textView.getY(), 0);
ValueAnimator tranX = ObjectAnimator.ofFloat(textView, "translationX", x - textView.getX(), 0);
ValueAnimator scaleX = ObjectAnimator.ofFloat(textView, "scaleX", s, 1.0f);
ValueAnimator scaleY = ObjectAnimator.ofFloat(textView, "scaleY", s, 1.0f);
ValueAnimator alpha = ObjectAnimator.ofFloat(textView, "alpha", 0.0f, 1.0f);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(1800);
animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
animatorSet.play(tranX).with(tranY).with(scaleX).with(scaleY).with(alpha);
if (R.id.tv_t2 == textView.getId()) {
animatorSet.addListener(new AnimatorListenerImpl() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
onTextAnimFinish();
}
});
}
animatorSet.start();
}
19
Source : SDSkipLoadView.java
with Apache License 2.0
from SiberiaDante
with Apache License 2.0
from SiberiaDante
/**
* 分析:1.布局分为三块,分别为最上面ShapeChangeView,中间的阴影mShadowView,和下面的TextView
* 2.ShapeChangeView 和 mShadowView有动画效果
* 3.ShapeChangeView的动画效果是,下落和弹起。而当ShapeChangeView下落时伴随着阴影mShadowView
* 的变小;弹起时阴影变大,如此往复
* 4.当ShapeChangeView弹起时,为其添加旋转动画
*/
/**
* 定义 下落动画 和 阴影缩小动画
*/
private void startFallAnimation() {
if (isStopAnimation) {
return;
}
// 下落的动画
ObjectAnimator translateAnimation = ObjectAnimator.ofFloat(mShapeChangeView, "translationY", 0, translateDistance);
translateAnimation.setInterpolator(new AccelerateInterpolator());
// 阴影缩小动画
ObjectAnimator scaleAnimation = ObjectAnimator.ofFloat(mShadowView, "scaleX", 1f, 0.4f);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(translateAnimation, scaleAnimation);
animatorSet.setDuration(animateTime);
animatorSet.setInterpolator(new AccelerateInterpolator());
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
mShapeChangeView.changeShape();
startUpAnimation();
}
});
animatorSet.start();
}
19
Source : SDSkipLoadView.java
with Apache License 2.0
from SiberiaDante
with Apache License 2.0
from SiberiaDante
private void startUpAnimation() {
if (isStopAnimation) {
return;
}
// 弹起的动画
ObjectAnimator translateAnimation = ObjectAnimator.ofFloat(mShapeChangeView, "translationY", translateDistance, 0);
// 阴影放大的动画
ObjectAnimator scaleAnimation = ObjectAnimator.ofFloat(mShadowView, "scaleX", 0.4f, 1f);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(translateAnimation, scaleAnimation);
animatorSet.setDuration(animateTime);
animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
// 弹起时旋转
startRotateAnimation();
}
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
startFallAnimation();
}
});
animatorSet.start();
}
19
Source : SDCircleMove.java
with Apache License 2.0
from SiberiaDante
with Apache License 2.0
from SiberiaDante
/**
* 开始执行动画
*/
private void startAnimator() {
/**
* 向左来回移动的X位移动画*
*/
ObjectAnimator objectAnimatorLeft = ObjectAnimator.ofFloat(views.get(0), "translationX", 0, -maxRadius, 0);
objectAnimatorLeft.setRepeatCount(-1);
// objectAnimatorLeft.setDuration(2000);
// objectAnimatorLeft.start();
/**
* 向右来回移动的X位移动画*
*/
ObjectAnimator objectAnimatorRight = ObjectAnimator.ofFloat(views.get(1), "translationX", 0, maxRadius, 0);
objectAnimatorRight.setRepeatCount(-1);
// objectAnimatorRight.setDuration(1000);
/**
* 动画组合->让左右同时执行*
*/
animatorSet = new AnimatorSet();
animatorSet.play(objectAnimatorRight).with(objectAnimatorLeft);
animatorSet.setInterpolator(new LinearInterpolator());
animatorSet.setDuration(1000);
animatorSet.start();
/**
* 动画监听*
*/
objectAnimatorLeft.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
/**
* 每次记录一下下次应该停止在中间的Image索引,然后和中间的交换*
*/
if (startIndex == 0) {
sweep(0, 2);
startIndex = 1;
} else {
sweep(1, 2);
startIndex = 0;
}
}
});
}
19
Source : PopupManager.java
with Apache License 2.0
from REBOOTERS
with Apache License 2.0
from REBOOTERS
public static void closePopup() {
final RelativeLayout popupContainer = (RelativeLayout) Shared.activity.findViewById(R.id.popup_container);
int childCount = popupContainer.getChildCount();
if (childCount > 0) {
View background = null;
View viewPopup = null;
if (childCount == 1) {
viewPopup = popupContainer.getChildAt(0);
} else {
background = popupContainer.getChildAt(0);
viewPopup = popupContainer.getChildAt(1);
}
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(viewPopup, "scaleX", 0f);
ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(viewPopup, "scaleY", 0f);
if (childCount > 1) {
ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(background, "alpha", 0f);
animatorSet.playTogether(scaleXAnimator, scaleYAnimator, alphaAnimator);
} else {
animatorSet.playTogether(scaleXAnimator, scaleYAnimator);
}
animatorSet.setDuration(300);
animatorSet.setInterpolator(new AccelerateInterpolator(2));
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
popupContainer.removeAllViews();
}
});
animatorSet.start();
}
}
19
Source : AlipaySuccessView.java
with Apache License 2.0
from REBOOTERS
with Apache License 2.0
from REBOOTERS
private void SuccessAnim() {
ObjectAnimator scaleXAnim = ObjectAnimator.ofFloat(this, "scaleX", 1.0f, 1.1f, 1.0f);
ObjectAnimator scaleYAnim = ObjectAnimator.ofFloat(this, "scaleY", 1.0f, 1.1f, 1.0f);
AnimatorSet set = new AnimatorSet();
set.setDuration(3000);
set.setInterpolator(new BounceInterpolator());
set.playTogether(scaleXAnim, scaleYAnim);
set.start();
}
See More Examples