Skip to content

Commit 3c39ab7

Browse files
committed
Improve and fix bugs in CustomThemeV2
Signed-off-by: Dev4Mod <[email protected]>
1 parent 72676cc commit 3c39ab7

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/CustomThemeV2.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@
44
import static com.wmods.wppenhacer.utils.IColors.backgroundColors;
55
import static com.wmods.wppenhacer.utils.IColors.primaryColors;
66
import static com.wmods.wppenhacer.utils.IColors.secondaryColors;
7+
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
78

89
import android.Manifest;
910
import android.app.Activity;
1011
import android.content.pm.PackageManager;
1112
import android.content.res.AssetManager;
1213
import android.content.res.ColorStateList;
14+
import android.graphics.Paint;
1315
import android.graphics.drawable.Drawable;
1416
import android.os.Bundle;
1517
import android.util.TypedValue;
1618
import android.view.View;
1719
import android.view.ViewGroup;
1820
import android.widget.FrameLayout;
21+
import android.widget.TextView;
1922

2023
import androidx.annotation.NonNull;
2124
import androidx.core.content.ContextCompat;
@@ -240,6 +243,8 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
240243
}
241244
}
242245
});
246+
var intBgHook = new IntBgColorHook();
247+
findAndHookMethod(Paint.class, "setColor", int.class, intBgHook);
243248

244249
}
245250

@@ -299,4 +304,25 @@ public String getPluginName() {
299304
return "Custom Theme V2";
300305
}
301306

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+
302328
}

0 commit comments

Comments
 (0)