@@ -75,7 +75,7 @@ private void hookWallpaper() throws Exception {
7575 return ;
7676
7777 var clazz = XposedHelpers .findClass ("com.whatsapp.HomeActivity" , classLoader );
78- XposedHelpers .findAndHookMethod (clazz . getSuperclass () , "onCreate" , Bundle .class , new XC_MethodHook () {
78+ XposedHelpers .findAndHookMethod (clazz , "onCreate" , Bundle .class , new XC_MethodHook () {
7979 @ Override
8080 protected void afterHookedMethod (MethodHookParam param ) throws Throwable {
8181 var activity = (Activity ) param .thisObject ;
@@ -107,12 +107,9 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
107107 var colorfilters = XposedHelpers .getObjectField (background , "A01" );
108108 var fields = ReflectionUtils .getFieldsByType (colorfilters .getClass (), ColorStateList .class );
109109 var colorStateList = (ColorStateList ) fields .get (0 ).get (colorfilters );
110- if (colorStateList == null ) return ;
111- var color = IColors .toString (colorStateList .getDefaultColor ());
112- var newColor = navAlpha .get (color );
113- if (newColor != null ) {
114- background .setTint (IColors .parseColor (newColor ));
115- }
110+ var newColor = IColors .getFromIntColor (colorStateList .getDefaultColor (), navAlpha );
111+ if (newColor == colorStateList .getDefaultColor ()) return ;
112+ background .setTint (newColor );
116113 } catch (Throwable ignored ) {
117114 }
118115 }
@@ -257,7 +254,9 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
257254 private void replaceTransparency (HashMap <String , String > wallpaperColors , float mAlpha ) {
258255 var hexAlpha = Integer .toHexString ((int ) Math .ceil (mAlpha * 255 ));
259256 hexAlpha = hexAlpha .length () == 1 ? "0" + hexAlpha : hexAlpha ;
260- for (var c : List .of ("#ff0b141a" , "#ff10161a" , "#ff111b21" , "#ff000000" , "#ffffffff" , "#ff1b8755" , "#ff0a1014" , "#ff12181c" , "#ff10161a" , "#ff20272b" )) {
257+ for (var c : List .of ("#ff0b141a" , "#ff10161a" , "#ff111b21" , "#ff000000" ,
258+ "#ffffffff" , "#ff1b8755" , "#ff0a1014" , "#ff12181c" , "#ff20272b" , "#ff3a484f"
259+ )) {
261260 var oldColor = wallpaperColors .get (c );
262261 if (oldColor == null ) continue ;
263262 var newColor = "#" + hexAlpha + oldColor .substring (3 );
@@ -269,7 +268,8 @@ private void replaceTransparency(HashMap<String, String> wallpaperColors, float
269268 private void injectWallpaper (View view ) {
270269 var content = (ViewGroup ) view ;
271270 var rootView = (ViewGroup ) content .getChildAt (0 );
272- var header = (ViewGroup ) rootView .findViewById (Utils .getID ("header" , "id" ));
271+
272+ var header = content .findViewById (Utils .getID ("header" , "id" ));
273273 replaceColors (header , toolbarAlpha );
274274 var frameLayout = new WallpaperView (rootView .getContext (), prefs , properties );
275275 rootView .addView (frameLayout , 0 );
@@ -298,7 +298,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
298298 if (colorStateList != null ) {
299299 var mColors = (int []) XposedHelpers .getObjectField (colorStateList , "mColors" );
300300 for (int i = 0 ; i < mColors .length ; i ++) {
301- mColors [i ] = IColors .getFromIntColor (mColors [i ]);
301+ mColors [i ] = IColors .getFromIntColor (mColors [i ], IColors . colors );
302302 }
303303 XposedHelpers .setObjectField (colorStateList , "mColors" , mColors );
304304 param .args [0 ] = colorStateList ;
@@ -324,7 +324,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
324324 return ;
325325 }
326326 }
327- param .args [0 ] = IColors .getFromIntColor (color );
327+ param .args [0 ] = IColors .getFromIntColor (color , IColors . colors );
328328 }
329329 }
330330}
0 commit comments