use of android.animation.Animator.AnimatorListener in project Fairphone by Kwamecorp.
the class PeaceOfMindActivity method hideHelp.
public void hideHelp() {
ObjectAnimator showIn = ObjectAnimator.ofFloat(mHelpHolder, "alpha", 1, 0);
showIn.setDuration(400);
showIn.start();
showIn.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
mHelpButton.setEnabled(true);
mVerticalSeekBar.setEnabled(true);
mHelpHolder.setVisibility(View.GONE);
mHelpLayout.setVisibility(View.GONE);
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
}
use of android.animation.Animator.AnimatorListener in project Fairphone by Kwamecorp.
the class PeaceOfMindActivity method showHelp.
public void showHelp() {
// disable the seekbar and help button when the help is showed
mVerticalSeekBar.setEnabled(false);
mHelpButton.setEnabled(false);
mHelpHolder.setVisibility(View.VISIBLE);
ObjectAnimator showIn = ObjectAnimator.ofFloat(mHelpHolder, "alpha", 0, 1);
showIn.setDuration(400);
showIn.start();
showIn.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
mHelpLayout.setVisibility(View.VISIBLE);
Interpolator decelerator = new DecelerateInterpolator();
ObjectAnimator translateIn = ObjectAnimator.ofFloat(mHelpLayout, "translationY", 900f, 0f);
translateIn.setInterpolator(decelerator);
translateIn.setDuration(400);
translateIn.start();
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
}
use of android.animation.Animator.AnimatorListener in project 9GAG by Mixiaoxiao.
the class ImageFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onActivityCreated(savedInstanceState);
isClose = false;
// mTranslateManager = new MxxTranslateManager(getActivity());
mYoudaoFanyiManager = new MxxYoudaoFanyiManager(getActivity());
mImageTitleTextView.setTypeface(Typeface.createFromAsset(getActivity().getAssets(), "Roboto-Light.ttf"));
// LayoutTransition transition =new LayoutTransition();
fadeInAnimator = ObjectAnimator.ofFloat(((View) mImageTitleTextView.getParent()), "alpha", 0f, 1f);
// fadeInAnimator=ObjectAnimator.ofFloat(mImageTitleTextView, "translationY", -mImageTitleTextView.getHeight(), 0f);
fadeInAnimator.setDuration(MxxScaleImageView.anim_duration / 2);
fadeInAnimator.setStartDelay(MxxScaleImageView.anim_duration / 2);
fadeInAnimator.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
// mTranslateManager.translateNoDialog(mCurrentFeedItem.getCaption(), new MxxTranslateManager.TranslateListener() {
//
// @Override
// public void onSuccess(String content, String result) {
// mImageTitleTextView.setText(content + "\n" + result);
// }
//
// @Override
// public void onError() {
// MxxToastUtil.showToast(getActivity(), "Translate error.");
// }
// });
mYoudaoFanyiManager.fanyi(mCurrentFeedItem.getCaption(), new YoudaoFanyiListener() {
@Override
public void onSuccess(YoudaoFanyiItem fanyiItem) {
mImageTitleTextView.setText(fanyiItem.getTranslationContent(false));
}
@Override
public void onError(String errMsg) {
// TODO Auto-generated method stub
}
}, null);
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
fadeOutAnimator = ObjectAnimator.ofFloat(((View) mImageTitleTextView.getParent()), "alpha", 1f, 0f);
fadeOutAnimator.setDuration(MxxScaleImageView.anim_duration / 2);
// fadeOutAnimator.addListener(new AnimatorListener() {
//
// @Override
// public void onAnimationStart(Animator animation) {}
// @Override
// public void onAnimationRepeat(Animator animation) {}
//
// @Override
// public void onAnimationEnd(Animator animation) {
// mImageTitleTextView.setVisibility(View.GONE);
// }
//
// @Override
// public void onAnimationCancel(Animator animation) {}
// });
// transition.setAnimator(LayoutTransition.APPEARING, fadeInAnimator );
// transition.setAnimator(LayoutTransition.DISAPPEARING, fadeOutAnimator);
// ((ViewGroup)mImageTitleTextView.getParent()).setLayoutTransition(transition);
mScaleImageView.setImageViewListener(new ImageViewListener() {
@Override
public void onSingleTap() {
// TODO Auto-generated method stub
// mScaleImageView.resetScale();
isClose = true;
mScaleImageView.startCloseScaleAnimation();
fadeOutAnimator.start();
}
@Override
public void onScaleEnd() {
// TODO Auto-generated method stub
if (isClose) {
mScaleImageView.setImageDrawable(null);
rootView.setVisibility(View.GONE);
((MainActivity) getActivity()).showImageFragment(null, false, null);
getActivity().supportInvalidateOptionsMenu();
isClose = false;
} else {
mScaleImageView.setTopCrop(false);
mScaleImageView.initAttacher();
// checkGif();
}
}
});
// mImageTitleTextView.setOnLongClickListener(new View.OnLongClickListener() {
//
// @Override
// public boolean onLongClick(View v) {
// // TODO Auto-generated method stub
// showTitleTextViewTranslate();
// return true;
// }
// });
mImageTitleTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// showTitleTextViewTranslate(getActivity(), mCurrentFeedItem.getCaption(),mTranslateManager);
showTitleTextViewTranslate(getActivity(), mCurrentFeedItem.getCaption(), mYoudaoFanyiManager);
}
});
}
use of android.animation.Animator.AnimatorListener in project Xposed-Tinted-Status-Bar by MohammadAG.
the class OverlayDrawable method setOverrideColor.
public void setOverrideColor(final int color) {
int animateFrom;
final int animateTo;
if (mOverrideColor != -3) {
animateFrom = mOverrideColor;
} else {
animateFrom = mColor;
}
if (color == -3) {
animateTo = mColor;
} else {
animateTo = color;
}
if (mAnimator != null && mAnimator.isRunning()) {
mAnimator.cancel();
animateFrom = mOverrideColor;
mAnimator = null;
}
mAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), animateFrom, animateTo);
mAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
mOverrideColor = (Integer) animator.getAnimatedValue();
invalidateSelf();
}
});
mAnimator.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
if (color == -3) {
mOverrideColor = -3;
mColor = animateTo;
invalidateSelf();
}
mAnimator = null;
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
mAnimator.start();
}
use of android.animation.Animator.AnimatorListener in project android-different-loading-animations by raweng.
the class AllAnimation method leftToRightToLeftMove.
public void leftToRightToLeftMove() {
final ValueAnimator valueTvOne_x = ObjectAnimator.ofFloat(leftRightTvOne, "x", leftRightTvOne.getX(), screenWidth * .9f);
valueTvOne_x.setDuration(1000);
valueTvOne_x.setRepeatCount(0);
valueTvOne_x.setRepeatMode(ValueAnimator.REVERSE);
valueTvOne_x.setInterpolator(new DecelerateInterpolator());
//- 35);
final ValueAnimator valueTvTwo_x = ObjectAnimator.ofFloat(leftRightTvTwo, "x", leftRightTvTwo.getX(), screenWidth * .93f);
valueTvTwo_x.setDuration(1000);
valueTvTwo_x.setRepeatCount(0);
valueTvTwo_x.setRepeatMode(ValueAnimator.REVERSE);
valueTvTwo_x.setInterpolator(new DecelerateInterpolator());
// - 20);
final ValueAnimator valueTvThree_x = ObjectAnimator.ofFloat(leftRightTvThree, "x", leftRightTvThree.getX(), screenWidth * .96f);
valueTvThree_x.setDuration(1000);
valueTvThree_x.setRepeatCount(0);
valueTvThree_x.setRepeatMode(ValueAnimator.REVERSE);
valueTvThree_x.setInterpolator(new DecelerateInterpolator());
animatorSet1 = new AnimatorSet();
animatorSet1.playSequentially(valueTvOne_x, valueTvTwo_x, valueTvThree_x);
animatorSet1.start();
animatorSet1.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
ValueAnimator valueTvOne_x = ObjectAnimator.ofFloat(leftRightTvOne, "x", leftRightTvOne.getX(), leftRightTvOne.getX() * .01f);
valueTvOne_x.setDuration(1000);
valueTvOne_x.setRepeatCount(0);
valueTvOne_x.setRepeatMode(ValueAnimator.REVERSE);
valueTvOne_x.setInterpolator(new DecelerateInterpolator());
final ValueAnimator valueTvTwo_x = ObjectAnimator.ofFloat(leftRightTvTwo, "x", leftRightTvTwo.getX(), leftRightTvTwo.getX() * .03f);
valueTvTwo_x.setDuration(1000);
valueTvTwo_x.setRepeatCount(0);
valueTvTwo_x.setRepeatMode(ValueAnimator.REVERSE);
valueTvTwo_x.setInterpolator(new DecelerateInterpolator());
final ValueAnimator valueTvThree_x = ObjectAnimator.ofFloat(leftRightTvThree, "x", leftRightTvThree.getX(), leftRightTvThree.getX() * .06f);
valueTvThree_x.setDuration(1000);
valueTvThree_x.setRepeatCount(0);
valueTvThree_x.setRepeatMode(ValueAnimator.REVERSE);
valueTvThree_x.setInterpolator(new DecelerateInterpolator());
animatorSet = new AnimatorSet();
animatorSet.playSequentially(valueTvThree_x, valueTvTwo_x, valueTvOne_x);
animatorSet.start();
animatorSet.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
animatorSet1.start();
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
}
Aggregations