Created
June 22, 2016 11:40
-
-
Save developer--/9972a0741d45d212d5d921d2a29ec914 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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