From 2bb315d4bd56996a5a3500805c8262ea8c6c2024 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 7 Jul 2021 14:47:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/ReadBookActivity.kt | 11 ++++++----- app/src/main/res/layout/popup_action_menu.xml | 5 +---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index ce1f7e710..d0f138e1f 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -105,7 +105,12 @@ class ReadBookActivity : ReadBookBaseActivity(), } private var menu: Menu? = null private val textActionMenu: TextActionMenu by lazy { - TextActionMenu(this, this) + TextActionMenu(this, this).apply { + contentView.measure( + View.MeasureSpec.UNSPECIFIED, + View.MeasureSpec.UNSPECIFIED + ) + } } override val scope: CoroutineScope get() = this @@ -469,10 +474,6 @@ class ReadBookActivity : ReadBookBaseActivity(), * 显示文本操作菜单 */ override fun showTextActionMenu() = binding.run { - textActionMenu.contentView.measure( - View.MeasureSpec.UNSPECIFIED, - View.MeasureSpec.UNSPECIFIED - ) val popupHeight = textActionMenu.contentView.measuredHeight val x = textMenuPosition.x.toInt() var y = textMenuPosition.y.toInt() - popupHeight diff --git a/app/src/main/res/layout/popup_action_menu.xml b/app/src/main/res/layout/popup_action_menu.xml index 12b5ebfc5..238593f51 100644 --- a/app/src/main/res/layout/popup_action_menu.xml +++ b/app/src/main/res/layout/popup_action_menu.xml @@ -7,7 +7,4 @@ android:background="@drawable/shape_card_view" android:padding="5dp" android:orientation="horizontal" - app:layoutManager="com.google.android.flexbox.FlexboxLayoutManager"> - - - + app:layoutManager="com.google.android.flexbox.FlexboxLayoutManager" /> \ No newline at end of file