Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private void crossFadeAnimation(final View fadeInTarget, final View fadeOutTarget, long duration){
final int[] counter = {0};
AnimatorSet mAnimationSet = new AnimatorSet();
final ObjectAnimator fadeOut = ObjectAnimator.ofFloat(fadeOutTarget, View.ALPHA, 1f, 0f);
final ObjectAnimator fadeIn = ObjectAnimator.ofFloat(fadeInTarget, View.ALPHA, 0f, 1f);
fadeOut.addListener(new Animator.AnimatorListener() {
//აქ გადაეწერა მნიშვნელობა უხეშად
@Override
public void onAnimationStart(Animator animation) {
counter[0]++;
}
//ამ დროს ჩანს "Выберите желаемый язык"
@Override
public void onAnimationEnd(Animator animation) {
fadeIn.start();
if (counter[0] % 2 ==0){
chooseLanguageTextView.setText("აირჩიეთ სასურველი ენა");
}else {
chooseLanguageTextView.setText("Выберите желаемый язык");
}
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
fadeOut.setInterpolator(new LinearInterpolator());
fadeIn.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
//ამ დროს ჩანს "აირჩიეთ სასურველი ენა"
@Override
public void onAnimationEnd(Animator animation) {
fadeOut.start();
}
@Override
public void onAnimationCancel(Animator animation) {}
@Override
public void onAnimationRepeat(Animator animation) {}
});
fadeIn.setInterpolator(new LinearInterpolator());
mAnimationSet.setDuration(duration);
mAnimationSet.playTogether(fadeOut, fadeIn);
mAnimationSet.start();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.