commit d217e2e86d78a23c9b67857ad86733ef7074a5e6
parent f9d1c9ea33d1e4d40ae7e7a722c1d1a74e7c5943
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Sat, 18 Jan 2025 18:35:56 +0100

fix(ui): debug chat context menu

Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>

Diffstat:
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/ui/menu/MenuViewInjector.kt | 20++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/menu/MenuViewInjector.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/menu/MenuViewInjector.kt @@ -1,10 +1,10 @@ package me.rhunk.snapenhance.core.ui.menu import android.annotation.SuppressLint +import android.view.Gravity import android.view.View import android.view.ViewGroup import android.widget.FrameLayout -import android.widget.LinearLayout import me.rhunk.snapenhance.core.event.events.impl.AddViewEvent import me.rhunk.snapenhance.core.features.Feature import me.rhunk.snapenhance.core.features.impl.COFOverride @@ -58,13 +58,17 @@ class MenuViewInjector : Feature("MenuViewInjector") { val viewGroup: ViewGroup = event.parent val childView: View = event.view - if (viewGroup !is LinearLayout && childView.id == chatActionMenu && context.isDeveloper) { - event.view = LinearLayout(childView.context).apply { - orientation = LinearLayout.VERTICAL - addView( - (menuMap[NewChatActionMenu::class]!! as NewChatActionMenu).createDebugInfoView(childView.context) - ) - addView(event.view) + if (childView.javaClass.name.endsWith("ActionMenuChatItemContainer") && context.isDeveloper) { + childView.post { + (event.parent.parent as ViewGroup).addView( + (menuMap[NewChatActionMenu::class] as NewChatActionMenu).createDebugInfoView(context.mainActivity!!).apply { + layoutParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT + ).apply { + gravity = Gravity.TOP or Gravity.START + } + }, 0) } }