@@ -184,8 +184,8 @@ private void hookColors() throws Exception {
184184 switch (c ) {
185185 case "0b141a" , "0a1014" ->
186186 IColors .colors .put (c , backgroundColor .substring (3 ));
187- case "#ff0b141a" , "#ff111b21" , "#ff000000" , "#ff0a1014" , "#ff10161a" ->
188- IColors .colors .put (c , backgroundColor );
187+ case "#ff0b141a" , "#ff111b21" , "#ff000000" , "#ff0a1014" , "#ff10161a" ,
188+ "#ff12181c" , "#ff20272b" -> IColors .colors .put (c , backgroundColor );
189189 }
190190 }
191191
@@ -256,7 +256,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
256256 private void replaceTransparency (HashMap <String , String > wallpaperColors , float mAlpha ) {
257257 var hexAlpha = Integer .toHexString ((int ) Math .ceil (mAlpha * 255 ));
258258 hexAlpha = hexAlpha .length () == 1 ? "0" + hexAlpha : hexAlpha ;
259- for (var c : List .of ("#ff0b141a" , "#ff10161a" , "#ff111b21" , "#ff000000" , "#ffffffff" , "#ff1b8755" , "#ff0a1014" , "#ff12181c" )) {
259+ for (var c : List .of ("#ff0b141a" , "#ff10161a" , "#ff111b21" , "#ff000000" , "#ffffffff" , "#ff1b8755" , "#ff0a1014" , "#ff12181c" , "#ff10161a" , "#ff20272b" )) {
260260 var oldColor = wallpaperColors .get (c );
261261 if (oldColor == null ) continue ;
262262 var newColor = "#" + hexAlpha + oldColor .substring (3 );
@@ -293,24 +293,11 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
293293 public static class ColorStateListHook extends XC_MethodHook {
294294 @ Override
295295 protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
296- var colors = IColors .colors ;
297296 var colorStateList = param .args [0 ];
298297 if (colorStateList != null ) {
299298 var mColors = (int []) XposedHelpers .getObjectField (colorStateList , "mColors" );
300299 for (int i = 0 ; i < mColors .length ; i ++) {
301- var sColor = IColors .toString (mColors [i ]);
302- var newColor = colors .get (sColor );
303- if (newColor != null && newColor .length () == 9 ) {
304- mColors [i ] = IColors .parseColor (newColor );
305- } else {
306- if (!sColor .equals ("#0" ) && !sColor .startsWith ("#ff" )) {
307- var sColorSub = sColor .substring (0 , 3 );
308- newColor = colors .get (sColor .substring (3 ));
309- if (newColor != null ) {
310- mColors [i ] = IColors .parseColor (sColorSub + newColor );
311- }
312- }
313- }
300+ mColors [i ] = IColors .getFromIntColor (mColors [i ]);
314301 }
315302 XposedHelpers .setObjectField (colorStateList , "mColors" , mColors );
316303 param .args [0 ] = colorStateList ;
@@ -321,28 +308,22 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
321308 public static class IntBgColorHook extends XC_MethodHook {
322309 @ Override
323310 protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
324- var colors = IColors .colors ;
325311 var color = (int ) param .args [0 ];
326312 var sColor = IColors .toString (color );
313+
327314 if (param .thisObject instanceof TextView textView ) {
328315 var id = Utils .getID ("conversations_row_message_count" , "id" );
329316 if (textView .getId () == id ) {
330317 param .args [0 ] = IColors .parseColor ("#ff" + sColor .substring (sColor .length () == 9 ? 3 : 1 ));
331318 return ;
332319 }
333- }
334- var newColor = colors .get (sColor );
335- if (newColor != null && newColor .length () == 9 ) {
336- param .args [0 ] = IColors .parseColor (newColor );
337- } else {
338- if (!sColor .equals ("#0" ) && !sColor .startsWith ("#ff" )) {
339- var sColorSub = sColor .substring (0 , 3 );
340- newColor = colors .get (sColor .substring (3 ));
341- if (newColor != null ) {
342- param .args [0 ] = IColors .parseColor (sColorSub + newColor );
343- }
320+ } else if (param .thisObject instanceof Paint ) {
321+ // This fixes the issue with background colors affecting chat bubbles
322+ if (ReflectionUtils .isCalledFromStrings ("getValue" )) {
323+ return ;
344324 }
345325 }
326+ param .args [0 ] = IColors .getFromIntColor (color );
346327 }
347328 }
348329}
0 commit comments