Skip to content

Commit

Permalink
QS Transparency: Remove parameterized condition from hook method
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmud0808 committed Sep 15, 2023
1 parent c29c9ae commit fd150d9
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import static com.drdisagree.iconify.common.Preferences.QSALPHA_LEVEL;
import static com.drdisagree.iconify.common.Preferences.QS_TRANSPARENCY_SWITCH;
import static com.drdisagree.iconify.config.XPrefs.Xprefs;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import static de.robv.android.xposed.XposedBridge.hookAllMethods;
import static de.robv.android.xposed.XposedHelpers.findClass;
import static de.robv.android.xposed.XposedHelpers.findField;
import static de.robv.android.xposed.XposedHelpers.getObjectField;

import android.content.Context;
import android.view.View;

import com.drdisagree.iconify.xposed.ModPack;

Expand Down Expand Up @@ -42,9 +41,9 @@ public void updatePrefs(String... Key) {
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpParam) {
if (!lpParam.packageName.equals(SYSTEMUI_PACKAGE)) return;

final Class<?> ScrimController = findClass(SYSTEMUI_PACKAGE + ".statusbar.phone.ScrimController", lpParam.classLoader);
final Class<?> ScrimControllerClass = findClass(SYSTEMUI_PACKAGE + ".statusbar.phone.ScrimController", lpParam.classLoader);

findAndHookMethod(ScrimController, "updateScrimColor", View.class, Integer.TYPE, Float.TYPE, new XC_MethodHook() {
hookAllMethods(ScrimControllerClass, "updateScrimColor", new XC_MethodHook() {
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (!qsTransparencyActive && !onlyNotifTransparencyActive) return;

Expand All @@ -57,11 +56,11 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
} else {
String scrimName = "unknown_scrim";

if (findField(ScrimController, "mScrimInFront").get(param.thisObject).equals(param.args[0])) {
if (findField(ScrimControllerClass, "mScrimInFront").get(param.thisObject).equals(param.args[0])) {
scrimName = "front_scrim";
} else if (findField(ScrimController, "mScrimBehind").get(param.thisObject).equals(param.args[0])) {
} else if (findField(ScrimControllerClass, "mScrimBehind").get(param.thisObject).equals(param.args[0])) {
scrimName = "behind_scrim";
} else if (findField(ScrimController, "mNotificationsScrim").get(param.thisObject).equals(param.args[0])) {
} else if (findField(ScrimControllerClass, "mNotificationsScrim").get(param.thisObject).equals(param.args[0])) {
scrimName = "notifications_scrim";
}

Expand Down

1 comment on commit fd150d9

@HiFIi
Copy link

@HiFIi HiFIi commented on fd150d9 Sep 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're on itttt boiiii

Please sign in to comment.