That fuck shit the fascists are using
1package org.tm.archive.components;
2
3import android.annotation.TargetApi;
4import android.content.Context;
5import android.os.Build;
6import android.util.AttributeSet;
7import android.view.animation.AlphaAnimation;
8import android.view.animation.Animation;
9import android.view.animation.AnimationSet;
10import android.view.animation.ScaleAnimation;
11import android.widget.LinearLayout;
12
13import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
14
15public class HidingLinearLayout extends LinearLayout {
16
17 public HidingLinearLayout(Context context) {
18 super(context);
19 }
20
21 public HidingLinearLayout(Context context, AttributeSet attrs) {
22 super(context, attrs);
23 }
24
25 public HidingLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
26 super(context, attrs, defStyleAttr);
27 }
28
29 public void hide() {
30 if (!isEnabled() || getVisibility() == GONE) return;
31
32 AnimationSet animation = new AnimationSet(true);
33 animation.addAnimation(new ScaleAnimation(1, 0.5f, 1, 1, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0.5f));
34 animation.addAnimation(new AlphaAnimation(1, 0));
35 animation.setDuration(100);
36
37 animation.setAnimationListener(new Animation.AnimationListener() {
38 @Override
39 public void onAnimationStart(Animation animation) {
40 }
41
42 @Override
43 public void onAnimationRepeat(Animation animation) {
44 }
45
46 @Override
47 public void onAnimationEnd(Animation animation) {
48 setVisibility(GONE);
49 }
50 });
51
52 animateWith(animation);
53 }
54
55 public void show() {
56 if (!isEnabled() || getVisibility() == VISIBLE) return;
57
58 setVisibility(VISIBLE);
59
60 AnimationSet animation = new AnimationSet(true);
61 animation.addAnimation(new ScaleAnimation(0.5f, 1, 1, 1, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0.5f));
62 animation.addAnimation(new AlphaAnimation(0, 1));
63 animation.setDuration(100);
64
65 animateWith(animation);
66 }
67
68 private void animateWith(Animation animation) {
69 animation.setDuration(150);
70 animation.setInterpolator(new FastOutSlowInInterpolator());
71 startAnimation(animation);
72 }
73
74 public void disable() {
75 setVisibility(GONE);
76 setEnabled(false);
77 }
78}