| package org.apache.fineract.utils; |
| |
| import android.animation.Animator; |
| import android.animation.AnimatorListenerAdapter; |
| import android.view.View; |
| |
| /** |
| * @author Rajan Maurya |
| * On 28/07/17. |
| */ |
| |
| public class AnimationUtils { |
| |
| public static void animateView(final View view, final int toVisibility, float toAlpha, |
| int duration) { |
| boolean show = toVisibility == View.VISIBLE; |
| if (show) { |
| view.setAlpha(0); |
| } |
| view.setVisibility(View.VISIBLE); |
| view.animate() |
| .setDuration(duration) |
| .alpha(show ? toAlpha : 0) |
| .setListener(new AnimatorListenerAdapter() { |
| @Override |
| public void onAnimationEnd(Animator animation) { |
| view.setVisibility(toVisibility); |
| } |
| }); |
| } |
| } |