From ffdeb954be72147be8a6c5f271dc5904708f8184 Mon Sep 17 00:00:00 2001 From: Art_Chen Date: Sun, 27 Oct 2024 18:22:22 +0800 Subject: [PATCH] HomeHandleAnim: Fixes Home Handle not hidden and semi-trans remove Signed-off-by: Art_Chen --- .../systemui/HomeHandleAnimatorHooker.kt | 33 +++++++++---------- app/src/main/res/xml/chen_preferences.xml | 5 --- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/moe/chenxy/miuiextra/hooker/entity/systemui/HomeHandleAnimatorHooker.kt b/app/src/main/java/moe/chenxy/miuiextra/hooker/entity/systemui/HomeHandleAnimatorHooker.kt index 440a05f..34b9921 100644 --- a/app/src/main/java/moe/chenxy/miuiextra/hooker/entity/systemui/HomeHandleAnimatorHooker.kt +++ b/app/src/main/java/moe/chenxy/miuiextra/hooker/entity/systemui/HomeHandleAnimatorHooker.kt @@ -676,7 +676,7 @@ object HomeHandleAnimatorHooker : YukiBaseHooker() { ) && orientationFor == 0 ) { inset = if (isAboveU) { - Insets.of(inset.left, 0, inset.right, 0) + Insets.of(inset.left, 0, inset.right, 1) } else { Insets.of(inset.left, lp.height, inset.right, 0) } @@ -782,25 +782,22 @@ object HomeHandleAnimatorHooker : YukiBaseHooker() { } } - if (mainPrefs.getBoolean("home_handle_wa_no_space_not_hide", false)) { - // Workaround immersive mode can not hide the handle - "com.android.systemui.navigationbar.NavigationBar".toClass().method { - name("setWindowState") - param(IntType, IntType, IntType) - }.hook { - after { - isHidden = XposedHelpers.getBooleanField( - this.instance, - "mShowOrientedHandleForImmersiveMode" - ) - if (lastIsHidden == isHidden) return@after + if (mainPrefs.getBoolean("chen_home_handle_no_space", false)) { + val statusBarCls = "com.android.systemui.statusbar.phone.PhoneStatusBarTransitions".toClass() + "com.android.systemui.statusbar.phone.BarTransitions".toClass().apply { + method { + name = "applyModeBackground" + paramCount = 2 + }.hook { + before { + // ignored status bar transition + if (statusBarCls.isInstance(this.instance)) return@before - if (isHidden) { - opacityTo(0f, 300) - } else { - opacityHomeHandle(EventType.NORMAL) + val mode = this.args[0] + when (mode) { + 1, 2, 3, 4 -> this.args[0] = 0 + } } - lastIsHidden = isHidden } } } diff --git a/app/src/main/res/xml/chen_preferences.xml b/app/src/main/res/xml/chen_preferences.xml index cfe8212..6ffcb9a 100644 --- a/app/src/main/res/xml/chen_preferences.xml +++ b/app/src/main/res/xml/chen_preferences.xml @@ -161,11 +161,6 @@ app:title="@string/chen_home_handle_no_space_title" app:summary="@string/chen_home_handle_no_space_summary"/> - -