mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-02 02:32:37 +00:00
committed by
Moxie Marlinspike
parent
0794380ca8
commit
92b2da0286
@@ -26,6 +26,7 @@ import android.text.TextUtils.TruncateAt;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewStub;
|
||||
import android.view.animation.Animation;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class ViewUtil {
|
||||
@@ -73,4 +74,26 @@ public class ViewUtil {
|
||||
public static <T extends View> T findById(@NonNull View parent, @IdRes int resId) {
|
||||
return (T) parent.findViewById(resId);
|
||||
}
|
||||
|
||||
public static void animateOut(final @NonNull View view, final @NonNull Animation animation) {
|
||||
if (view.getVisibility() == View.GONE) return;
|
||||
|
||||
view.clearAnimation();
|
||||
animation.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override public void onAnimationStart(Animation animation) {}
|
||||
@Override public void onAnimationRepeat(Animation animation) {}
|
||||
@Override public void onAnimationEnd(Animation animation) {
|
||||
view.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
view.startAnimation(animation);
|
||||
}
|
||||
|
||||
public static void animateIn(final @NonNull View view, final @NonNull Animation animation) {
|
||||
if (view.getVisibility() == View.VISIBLE) return;
|
||||
view.clearAnimation();
|
||||
view.setVisibility(View.VISIBLE);
|
||||
view.startAnimation(animation);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user