|
1 | 1 | package com.wmods.wppenhacer.xposed.features.customization; |
2 | 2 |
|
3 | 3 | import static com.wmods.wppenhacer.utils.ColorReplacement.replaceColors; |
| 4 | +import static com.wmods.wppenhacer.utils.DrawableColors.replaceColor; |
4 | 5 | import static com.wmods.wppenhacer.utils.IColors.alphacolors; |
5 | 6 | import static com.wmods.wppenhacer.utils.IColors.backgroundColors; |
6 | 7 | import static com.wmods.wppenhacer.utils.IColors.primaryColors; |
|
24 | 25 | import androidx.annotation.NonNull; |
25 | 26 | import androidx.core.content.ContextCompat; |
26 | 27 |
|
27 | | -import com.wmods.wppenhacer.utils.DrawableColors; |
28 | 28 | import com.wmods.wppenhacer.utils.IColors; |
29 | 29 | import com.wmods.wppenhacer.views.WallpaperView; |
30 | 30 | import com.wmods.wppenhacer.xposed.core.Feature; |
|
34 | 34 | import com.wmods.wppenhacer.xposed.utils.ReflectionUtils; |
35 | 35 | import com.wmods.wppenhacer.xposed.utils.Utils; |
36 | 36 |
|
37 | | -import java.lang.reflect.Method; |
38 | 37 | import java.util.HashMap; |
39 | 38 | import java.util.Objects; |
40 | 39 | import java.util.Properties; |
@@ -62,8 +61,8 @@ private static void processColors(String color, HashMap<String, String> mapColor |
62 | 61 | if (color.length() == 7) { // #RRGGBB |
63 | 62 | inputColorFull = "#ff" + color.substring(1); |
64 | 63 | } else if (color.length() == 9) { // #AARRGGBB |
65 | | - // Base the color on input, but force FF alpha |
66 | | - inputColorFull = "#ff" + color.substring(3); |
| 64 | + // Base the color on input, but force FF alpha |
| 65 | + inputColorFull = "#ff" + color.substring(3); |
67 | 66 | } else { |
68 | 67 | // Invalid format, ignore |
69 | 68 | return; |
@@ -209,15 +208,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { |
209 | 208 | var viewGroup = (ViewGroup) param.thisObject; |
210 | 209 | if (checkNotHomeActivity()) return; |
211 | 210 | var background = viewGroup.getBackground(); |
212 | | - try { |
213 | | - var colorfilters = XposedHelpers.getObjectField(background, "A01"); |
214 | | - var fields = ReflectionUtils.getFieldsByType(colorfilters.getClass(), ColorStateList.class); |
215 | | - var colorStateList = (ColorStateList) fields.get(0).get(colorfilters); |
216 | | - var newColor = IColors.getFromIntColor(colorStateList.getDefaultColor(), navAlpha); |
217 | | - if (newColor == colorStateList.getDefaultColor()) return; |
218 | | - background.setTint(newColor); |
219 | | - } catch (Throwable ignored) { |
220 | | - } |
| 211 | + replaceColor(background, navAlpha); |
221 | 212 | } |
222 | 213 | }); |
223 | 214 |
|
@@ -247,7 +238,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { |
247 | 238 | @Override |
248 | 239 | protected void afterHookedMethod(MethodHookParam param) throws Throwable { |
249 | 240 | var drawable = (Drawable) param.getResult(); |
250 | | - DrawableColors.replaceColor(drawable, IColors.colors); |
| 241 | + replaceColor(drawable, IColors.colors); |
251 | 242 | } |
252 | 243 | }); |
253 | 244 |
|
|
0 commit comments