pull/1110/head
gedoor 3 years ago
parent 279355cf24
commit 2bb315d4bd
  1. 11
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 5
      app/src/main/res/layout/popup_action_menu.xml

@ -105,7 +105,12 @@ class ReadBookActivity : ReadBookBaseActivity(),
} }
private var menu: Menu? = null private var menu: Menu? = null
private val textActionMenu: TextActionMenu by lazy { 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 override val scope: CoroutineScope get() = this
@ -469,10 +474,6 @@ class ReadBookActivity : ReadBookBaseActivity(),
* 显示文本操作菜单 * 显示文本操作菜单
*/ */
override fun showTextActionMenu() = binding.run { override fun showTextActionMenu() = binding.run {
textActionMenu.contentView.measure(
View.MeasureSpec.UNSPECIFIED,
View.MeasureSpec.UNSPECIFIED
)
val popupHeight = textActionMenu.contentView.measuredHeight val popupHeight = textActionMenu.contentView.measuredHeight
val x = textMenuPosition.x.toInt() val x = textMenuPosition.x.toInt()
var y = textMenuPosition.y.toInt() - popupHeight var y = textMenuPosition.y.toInt() - popupHeight

@ -7,7 +7,4 @@
android:background="@drawable/shape_card_view" android:background="@drawable/shape_card_view"
android:padding="5dp" android:padding="5dp"
android:orientation="horizontal" android:orientation="horizontal"
app:layoutManager="com.google.android.flexbox.FlexboxLayoutManager"> app:layoutManager="com.google.android.flexbox.FlexboxLayoutManager" />
</androidx.recyclerview.widget.RecyclerView>
Loading…
Cancel
Save