That fuck shit the fascists are using
1package org.tm.archive.wallpaper;
2
3import android.graphics.drawable.Drawable;
4import android.os.Parcel;
5import android.os.Parcelable;
6import android.widget.ImageView;
7
8import androidx.annotation.NonNull;
9
10import org.tm.archive.components.RotatableGradientDrawable;
11import org.tm.archive.database.model.databaseprotos.Wallpaper;
12
13import java.util.ArrayList;
14import java.util.Arrays;
15import java.util.List;
16import java.util.Objects;
17
18public final class GradientChatWallpaper implements ChatWallpaper, Parcelable {
19
20 public static final ChatWallpaper SUNSET = new GradientChatWallpaper(168f,
21 new int[] { 0xFFF3DC47, 0xFFF3DA47, 0xFFF2D546, 0xFFF2CC46, 0xFFF1C146, 0xFFEFB445, 0xFFEEA544, 0xFFEC9644, 0xFFEB8743, 0xFFE97743, 0xFFE86942, 0xFFE65C41, 0xFFE55041, 0xFFE54841, 0xFFE44240, 0xFFE44040 },
22 new float[] { 0.0f, 0.0807f, 0.1554f, 0.225f, 0.2904f, 0.3526f, 0.4125f, 0.471f, 0.529f, 0.5875f, 0.6474f, 0.7096f, 0.775f, 0.8446f, 0.9193f, 1f },
23 0f);
24 public static final ChatWallpaper NOIR = new GradientChatWallpaper(180f,
25 new int[] { 0xFF16161D, 0xFF17171E, 0xFF1A1A22, 0xFF1F1F28, 0xFF26262F, 0xFF2D2D38, 0xFF353542, 0xFF3E3E4C, 0xFF474757, 0xFF4F4F61, 0xFF57576B, 0xFF5F5F74, 0xFF65657C, 0xFF6A6A82, 0xFF6D6D85, 0xFF6E6E87 },
26 new float[] { 0.0000f, 0.0807f, 0.1554f, 0.2250f, 0.2904f, 0.3526f, 0.4125f, 0.4710f, 0.5290f, 0.5875f, 0.6474f, 0.7096f, 0.7750f, 0.8446f, 0.9193f, 1.0000f },
27 0f);
28 public static final ChatWallpaper HEATMAP = new GradientChatWallpaper(192f,
29 new int[] { 0xFFF53844, 0xFFF33845, 0xFFEC3848, 0xFFE2384C, 0xFFD63851, 0xFFC73857, 0xFFB6385E, 0xFFA43866, 0xFF93376D, 0xFF813775, 0xFF70377C, 0xFF613782, 0xFF553787, 0xFF4B378B, 0xFF44378E, 0xFF42378F },
30 new float[] { 0.0000f, 0.0075f, 0.0292f, 0.0637f, 0.1097f, 0.1659f, 0.2310f, 0.3037f, 0.3827f, 0.4666f, 0.5541f, 0.6439f, 0.7347f, 0.8252f, 0.9141f, 1.0000f },
31 0f);
32 public static final ChatWallpaper AQUA = new GradientChatWallpaper(180f,
33 new int[] { 0xFF0093E9, 0xFF0294E9, 0xFF0696E7, 0xFF0D99E5, 0xFF169EE3, 0xFF21A3E0, 0xFF2DA8DD, 0xFF3AAEDA, 0xFF46B5D6, 0xFF53BBD3, 0xFF5FC0D0, 0xFF6AC5CD, 0xFF73CACB, 0xFF7ACDC9, 0xFF7ECFC7, 0xFF80D0C7 },
34 new float[] { 0.0000f, 0.0807f, 0.1554f, 0.2250f, 0.2904f, 0.3526f, 0.4125f, 0.4710f, 0.5290f, 0.5875f, 0.6474f, 0.7096f, 0.7750f, 0.8446f, 0.9193f, 1.0000f },
35 0f);
36 public static final ChatWallpaper IRIDESCENT = new GradientChatWallpaper(192f,
37 new int[] { 0xFFF04CE6, 0xFFEE4BE6, 0xFFE54AE5, 0xFFD949E5, 0xFFC946E4, 0xFFB644E3, 0xFFA141E3, 0xFF8B3FE2, 0xFF743CE1, 0xFF5E39E0, 0xFF4936DF, 0xFF3634DE, 0xFF2632DD, 0xFF1930DD, 0xFF112FDD, 0xFF0E2FDD },
38 new float[] { 0.0000f, 0.0807f, 0.1554f, 0.2250f, 0.2904f, 0.3526f, 0.4125f, 0.4710f, 0.5290f, 0.5875f, 0.6474f, 0.7096f, 0.7750f, 0.8446f, 0.9193f, 1.0000f },
39 0f);
40 public static final ChatWallpaper MONSTERA = new GradientChatWallpaper(180f,
41 new int[] { 0xFF65CDAC, 0xFF64CDAB, 0xFF60CBA8, 0xFF5BC8A3, 0xFF55C49D, 0xFF4DC096, 0xFF45BB8F, 0xFF3CB687, 0xFF33B17F, 0xFF2AAC76, 0xFF21A76F, 0xFF1AA268, 0xFF139F62, 0xFF0E9C5E, 0xFF0B9A5B, 0xFF0A995A },
42 new float[] { 0.0000f, 0.0807f, 0.1554f, 0.2250f, 0.2904f, 0.3526f, 0.4125f, 0.4710f, 0.5290f, 0.5875f, 0.6474f, 0.7096f, 0.7750f, 0.8446f, 0.9193f, 1.0000f },
43 0f);
44 public static final ChatWallpaper BLISS = new GradientChatWallpaper(180f,
45 new int[] { 0xFFD8E1FA, 0xFFD8E0F9, 0xFFD8DEF7, 0xFFD8DBF3, 0xFFD8D6EE, 0xFFD7D1E8, 0xFFD7CCE2, 0xFFD7C6DB, 0xFFD7BFD4, 0xFFD7B9CD, 0xFFD6B4C7, 0xFFD6AFC1, 0xFFD6AABC, 0xFFD6A7B8, 0xFFD6A5B6, 0xFFD6A4B5 },
46 new float[] { 0.0000f, 0.0807f, 0.1554f, 0.2250f, 0.2904f, 0.3526f, 0.4125f, 0.4710f, 0.5290f, 0.5875f, 0.6474f, 0.7096f, 0.7750f, 0.8446f, 0.9193f, 1.0000f },
47 0f);
48 public static final ChatWallpaper SKY = new GradientChatWallpaper(180f,
49 new int[] { 0xFFD8EBFD, 0xFFD7EAFD, 0xFFD5E9FD, 0xFFD2E7FD, 0xFFCDE5FD, 0xFFC8E3FD, 0xFFC3E0FD, 0xFFBDDDFC, 0xFFB7DAFC, 0xFFB2D7FC, 0xFFACD4FC, 0xFFA7D1FC, 0xFFA3CFFB, 0xFFA0CDFB, 0xFF9ECCFB, 0xFF9DCCFB },
50 new float[] { 0.0000f, 0.0807f, 0.1554f, 0.2250f, 0.2904f, 0.3526f, 0.4125f, 0.4710f, 0.5290f, 0.5875f, 0.6474f, 0.7096f, 0.7750f, 0.8446f, 0.9193f, 1.0000f },
51 0f);
52 public static final ChatWallpaper PEACH = new GradientChatWallpaper(192f,
53 new int[] { 0xFFFFE5C2, 0xFFFFE4C1, 0xFFFFE2BF, 0xFFFFDFBD, 0xFFFEDBB9, 0xFFFED6B5, 0xFFFED1B1, 0xFFFDCCAC, 0xFFFDC6A8, 0xFFFDC0A3, 0xFFFCBB9F, 0xFFFCB69B, 0xFFFCB297, 0xFFFCAF95, 0xFFFCAD93, 0xFFFCAC92 },
54 new float[] { 0.0000f, 0.0807f, 0.1554f, 0.2250f, 0.2904f, 0.3526f, 0.4125f, 0.4710f, 0.5290f, 0.5875f, 0.6474f, 0.7096f, 0.7750f, 0.8446f, 0.9193f, 1.0000f },
55 0f);
56
57
58 private final float degrees;
59 private final int[] colors;
60 private final float[] positions;
61 private final float dimLevelInDarkTheme;
62
63 GradientChatWallpaper(float degrees, int[] colors, float[] positions, float dimLevelInDarkTheme) {
64 this.degrees = degrees;
65 this.colors = colors;
66 this.positions = positions;
67 this.dimLevelInDarkTheme = dimLevelInDarkTheme;
68 }
69
70 private GradientChatWallpaper(Parcel in) {
71 degrees = in.readFloat();
72 colors = in.createIntArray();
73 positions = in.createFloatArray();
74 dimLevelInDarkTheme = in.readFloat();
75 }
76
77 @Override
78 public void writeToParcel(Parcel dest, int flags) {
79 dest.writeFloat(degrees);
80 dest.writeIntArray(colors);
81 dest.writeFloatArray(positions);
82 dest.writeFloat(dimLevelInDarkTheme);
83 }
84
85 @Override
86 public int describeContents() {
87 return 0;
88 }
89
90 private @NonNull Drawable buildDrawable() {
91 return new RotatableGradientDrawable(degrees, colors, positions);
92 }
93
94 @Override
95 public float getDimLevelForDarkTheme() {
96 return dimLevelInDarkTheme;
97 }
98
99 @Override
100 public void loadInto(@NonNull ImageView imageView) {
101 imageView.setImageDrawable(buildDrawable());
102 }
103
104 @Override
105 public boolean isSameSource(@NonNull ChatWallpaper chatWallpaper) {
106 if (this == chatWallpaper) return true;
107 if (getClass() != chatWallpaper.getClass()) return false;
108 GradientChatWallpaper that = (GradientChatWallpaper) chatWallpaper;
109
110 return Float.compare(that.degrees, degrees) == 0 &&
111 Arrays.equals(colors, that.colors) &&
112 Arrays.equals(positions, that.positions);
113 }
114
115 @Override
116 public @NonNull Wallpaper serialize() {
117 Wallpaper.LinearGradient.Builder builder = new Wallpaper.LinearGradient.Builder();
118
119 builder.rotation(degrees);
120
121 List<Integer> colors = new ArrayList<>(this.colors.length);
122 for (int color : this.colors) {
123 colors.add(color);
124 }
125 builder.colors(colors);
126
127 List<Float> positions = new ArrayList<>(this.positions.length);
128 for (float position : this.positions) {
129 positions.add(position);
130 }
131 builder.positions(positions);
132
133 return new Wallpaper.Builder()
134 .linearGradient(builder.build())
135 .dimLevelInDarkTheme(dimLevelInDarkTheme)
136 .build();
137 }
138
139 @Override
140 public boolean equals(Object o) {
141 if (this == o) return true;
142 if (o == null || getClass() != o.getClass()) return false;
143 GradientChatWallpaper that = (GradientChatWallpaper) o;
144 return Float.compare(that.degrees, degrees) == 0 &&
145 Arrays.equals(colors, that.colors) &&
146 Arrays.equals(positions, that.positions) &&
147 Float.compare(that.dimLevelInDarkTheme, dimLevelInDarkTheme) == 0;
148 }
149
150 @Override
151 public int hashCode() {
152 int result = Objects.hash(degrees, dimLevelInDarkTheme);
153 result = 31 * result + Arrays.hashCode(colors);
154 result = 31 * result + Arrays.hashCode(positions);
155 return result;
156 }
157
158 public static final Creator<GradientChatWallpaper> CREATOR = new Creator<GradientChatWallpaper>() {
159 @Override
160 public GradientChatWallpaper createFromParcel(Parcel in) {
161 return new GradientChatWallpaper(in);
162 }
163
164 @Override
165 public GradientChatWallpaper[] newArray(int size) {
166 return new GradientChatWallpaper[size];
167 }
168 };
169}