Skip to content

Commit

Permalink
Use enhanced switch case
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmud0808 committed Oct 10, 2023
1 parent 2294402 commit 184cf0e
Showing 1 changed file with 31 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,30 +195,28 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
for (Object constant : constants) {
String enumVal = constant.toString();
switch (enumVal) {
case "KEYGUARD":
findAndHookMethod(constant.getClass(), "prepare", ScrimStateEnum, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (!lightQSHeaderEnabled) return;

boolean mClipQsScrim = (boolean) getObjectField(param.thisObject, "mClipQsScrim");
if (mClipQsScrim) {
callMethod(param.thisObject, "updateScrimColor", getObjectField(param.thisObject, "mScrimBehind"), 1f, Color.TRANSPARENT);
case "KEYGUARD" ->
findAndHookMethod(constant.getClass(), "prepare", ScrimStateEnum, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (!lightQSHeaderEnabled) return;

boolean mClipQsScrim = (boolean) getObjectField(param.thisObject, "mClipQsScrim");
if (mClipQsScrim) {
callMethod(param.thisObject, "updateScrimColor", getObjectField(param.thisObject, "mScrimBehind"), 1f, Color.TRANSPARENT);
}
}
}
});
break;
case "BOUNCER":
findAndHookMethod(constant.getClass(), "prepare", ScrimStateEnum, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (!lightQSHeaderEnabled) return;

setObjectField(param.thisObject, "mBehindTint", Color.TRANSPARENT);
}
});
break;
case "SHADE_LOCKED":
});
case "BOUNCER" ->
findAndHookMethod(constant.getClass(), "prepare", ScrimStateEnum, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (!lightQSHeaderEnabled) return;

setObjectField(param.thisObject, "mBehindTint", Color.TRANSPARENT);
}
});
case "SHADE_LOCKED" -> {
hookAllMethods(constant.getClass(), "prepare", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Expand All @@ -239,20 +237,18 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
param.setResult(Color.TRANSPARENT);
}
});
break;

case "UNLOCKED":
findAndHookMethod(constant.getClass(), "prepare", ScrimStateEnum, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (!lightQSHeaderEnabled) return;
}
case "UNLOCKED" ->
findAndHookMethod(constant.getClass(), "prepare", ScrimStateEnum, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (!lightQSHeaderEnabled) return;

setObjectField(param.thisObject, "mBehindTint", Color.TRANSPARENT);
setObjectField(param.thisObject, "mBehindTint", Color.TRANSPARENT);

callMethod(param.thisObject, "updateScrimColor", getObjectField(param.thisObject, "mScrimBehind"), 1f, Color.TRANSPARENT);
}
});
break;
callMethod(param.thisObject, "updateScrimColor", getObjectField(param.thisObject, "mScrimBehind"), 1f, Color.TRANSPARENT);
}
});
}
}
} catch (Throwable throwable) {
Expand Down

0 comments on commit 184cf0e

Please sign in to comment.