diff --git a/app/src/main/java/it/dhd/oxygencustomizer/xposed/hooks/settings/CustomShortcut.java b/app/src/main/java/it/dhd/oxygencustomizer/xposed/hooks/settings/CustomShortcut.java index 91dca29e6..61a1611e5 100644 --- a/app/src/main/java/it/dhd/oxygencustomizer/xposed/hooks/settings/CustomShortcut.java +++ b/app/src/main/java/it/dhd/oxygencustomizer/xposed/hooks/settings/CustomShortcut.java @@ -3,6 +3,7 @@ import static de.robv.android.xposed.XposedBridge.hookAllConstructors; import static de.robv.android.xposed.XposedBridge.hookAllMethods; import static de.robv.android.xposed.XposedHelpers.callMethod; +import static de.robv.android.xposed.XposedHelpers.callStaticMethod; import static de.robv.android.xposed.XposedHelpers.findAndHookConstructor; import static de.robv.android.xposed.XposedHelpers.findClass; import static de.robv.android.xposed.XposedHelpers.getObjectField; @@ -12,6 +13,7 @@ import android.content.Context; import android.content.Intent; +import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.ShapeDrawable; @@ -81,7 +83,8 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { } } }); - + Class COUITintUtil = findClass("com.coui.appcompat.tintimageview.COUITintUtil", lpparam.classLoader); + Class ThemeUtils = findClass("com.oplus.settings.utils.ThemeUtils", lpparam.classLoader); hookAllMethods(TopLevelSettingsClass, "onCreateAdapter", new XC_MethodHook() { @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable { @@ -92,10 +95,17 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { Object mWallpaperCategory = callMethod(param.args[0], "findPreference", "notification_settings_category"); + Drawable OCIcon = ResourcesCompat.getDrawable(ResourceManager.modRes, + R.drawable.pref_icon, + mContext.getTheme()); + Drawable tinted; + try { + tinted = (Drawable) callStaticMethod(ThemeUtils, "getApplyCOUITintDrawable", c, OCIcon, true); + } catch (Throwable t) { + tinted = OCIcon; + } callMethod(OCPreference, "setIcon", - ResourcesCompat.getDrawable(ResourceManager.modRes, - R.drawable.pref_icon, - mContext.getTheme())); + tinted); callMethod(OCPreference, "setTitle", "Oxygen Customizer"); callMethod(OCPreference, "setOrder", 1); callMethod(OCPreference, "setKey", "oxygen_customizer"); @@ -105,6 +115,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { } + @Override public boolean listensTo(String packageName) { return packageName.equals(this.packageName);