download control details

Closes #4063
// FREEBIE
This commit is contained in:
Jake McGinty
2015-09-09 18:05:21 -10:00
committed by Moxie Marlinspike
parent 0794380ca8
commit 92b2da0286
17 changed files with 177 additions and 84 deletions

View File

@@ -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);
}
}