commit 5836c2e35d93efa189fe36e698ab46957767b423 parent 6fed85b4a6334a776569372fba14392f4c452ddc Author: rhunk <101876869+rhunk@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:39:23 +0100 fix(core/ui): chat input bar Diffstat:
M | core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/UITweaks.kt | | | 11 | ++++++++--- |
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/UITweaks.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/UITweaks.kt @@ -19,12 +19,17 @@ import me.rhunk.snapenhance.core.util.hook.hook import me.rhunk.snapenhance.core.util.ktx.getIdentifier fun getChatInputBar(event: AddViewEvent): Lazy<ViewGroup?>? { - if (!event.parent.javaClass.name.endsWith("ChatInputLayout") || !event.viewClassName.endsWith("ViewSwitcher")) return null + if (!event.parent.javaClass.name.endsWith("ChatInputLayout")) return null + val isViewSwitcher = event.viewClassName.endsWith("ViewSwitcher") return lazy { // get the first linear layout in the view switcher - val firstLinearLayout = (event.view as ViewGroup).children() - .firstOrNull { it is LinearLayout } as? ViewGroup ?: return@lazy null + val firstLinearLayout = if (isViewSwitcher) { + (event.view as ViewGroup).children() + .firstOrNull { it is LinearLayout } as? ViewGroup ?: return@lazy null + } else { + event.view as? ViewGroup ?: return@lazy null + } // get the first linear layout with at least 3 children firstLinearLayout.children() .firstOrNull { v -> v is LinearLayout && v.childCount > 2 } as? LinearLayout