From f52c5c75314f00dd8d58aa9947a2fdb0a55391b1 Mon Sep 17 00:00:00 2001 From: Ketal Date: Tue, 20 Apr 2021 12:19:28 +0800 Subject: [PATCH] Update MainHook --- .../com/ketal/bcrfullscreen/MainHook.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/ketal/bcrfullscreen/MainHook.java b/app/src/main/java/com/ketal/bcrfullscreen/MainHook.java index ecbdc3e..fa20b8b 100644 --- a/app/src/main/java/com/ketal/bcrfullscreen/MainHook.java +++ b/app/src/main/java/com/ketal/bcrfullscreen/MainHook.java @@ -16,21 +16,19 @@ public class MainHook implements IXposedHookLoadPackage { public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable { if (!lpparam.packageName.equals(lpparam.processName)) return; - String packageName = lpparam.packageName; - if (packageName.equals("com.bilibili.priconne")) { - XC_MethodHook hook = new XC_MethodHook() { - @Override - protected void afterHookedMethod(MethodHookParam param) throws Throwable { - Activity act = (Activity) param.thisObject; - WindowManager.LayoutParams attributes = act.getWindow().getAttributes(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - attributes.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; - act.getWindow().setAttributes(attributes); - } + if (!lpparam.packageName.equals("com.bilibili.priconne")) + return; + Class actClass = lpparam.classLoader.loadClass("com.bilibili.priconne.MainActivity"); + XposedBridge.hookMethod(actClass.getDeclaredMethod("onResume"), new XC_MethodHook() { + @Override + protected void afterHookedMethod(MethodHookParam param) { + Activity act = (Activity) param.thisObject; + WindowManager.LayoutParams attributes = act.getWindow().getAttributes(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + attributes.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; + act.getWindow().setAttributes(attributes); } - }; - Class actClass = lpparam.classLoader.loadClass("com.bilibili.priconne.MainActivity"); - XposedBridge.hookMethod(actClass.getDeclaredMethod("onResume"), hook); - } + } + }); } }