|
4 | 4 | import static com.wmods.wppenhacer.utils.IColors.backgroundColors; |
5 | 5 | import static com.wmods.wppenhacer.utils.IColors.primaryColors; |
6 | 6 | import static com.wmods.wppenhacer.utils.IColors.secondaryColors; |
| 7 | +import static de.robv.android.xposed.XposedHelpers.findAndHookMethod; |
7 | 8 |
|
8 | 9 | import android.Manifest; |
9 | 10 | import android.app.Activity; |
10 | 11 | import android.content.pm.PackageManager; |
11 | 12 | import android.content.res.AssetManager; |
12 | 13 | import android.content.res.ColorStateList; |
| 14 | +import android.graphics.Paint; |
13 | 15 | import android.graphics.drawable.Drawable; |
14 | 16 | import android.os.Bundle; |
15 | 17 | import android.util.TypedValue; |
16 | 18 | import android.view.View; |
17 | 19 | import android.view.ViewGroup; |
18 | 20 | import android.widget.FrameLayout; |
| 21 | +import android.widget.TextView; |
19 | 22 |
|
20 | 23 | import androidx.annotation.NonNull; |
21 | 24 | import androidx.core.content.ContextCompat; |
@@ -240,6 +243,8 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { |
240 | 243 | } |
241 | 244 | } |
242 | 245 | }); |
| 246 | + var intBgHook = new IntBgColorHook(); |
| 247 | + findAndHookMethod(Paint.class, "setColor", int.class, intBgHook); |
243 | 248 |
|
244 | 249 | } |
245 | 250 |
|
@@ -299,4 +304,25 @@ public String getPluginName() { |
299 | 304 | return "Custom Theme V2"; |
300 | 305 | } |
301 | 306 |
|
| 307 | + |
| 308 | + public static class IntBgColorHook extends XC_MethodHook { |
| 309 | + |
| 310 | + |
| 311 | + @Override |
| 312 | + protected void beforeHookedMethod(MethodHookParam param) throws Throwable { |
| 313 | + var color = (int) param.args[0]; |
| 314 | + |
| 315 | + if (param.thisObject instanceof TextView textView) { |
| 316 | + var id = Utils.getID("conversations_row_message_count", "id"); |
| 317 | + if (textView.getId() == id) { |
| 318 | + return; |
| 319 | + } |
| 320 | + } else if (param.thisObject instanceof Paint && ReflectionUtils.isCalledFromStrings("getValue")) { |
| 321 | + return; |
| 322 | + } |
| 323 | + param.args[0] = IColors.getFromIntColor(color, IColors.colors); |
| 324 | + } |
| 325 | + } |
| 326 | + |
| 327 | + |
302 | 328 | } |
0 commit comments