From f4bbe3ad6e239129efe5fcaed78e82344bc2135b Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 10 Mar 2020 10:51:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/book/read/ReadBookActivity.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 c6294c290..43c6ef541 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 @@ -406,8 +406,15 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo } } textActionMenu?.let { popup -> + val popupHeight = popup.contentView.measuredHeight val x = text_menu_position.x.toInt() - val y = text_menu_position.y.toInt() - popup.contentView.measuredHeight + var y = text_menu_position.y.toInt() - popupHeight + if (y < statusBarHeight) { + y = (cursor_left.y + cursor_left.height).toInt() + } + if (cursor_right.y > y && cursor_right.y < y + popupHeight) { + y = (cursor_right.y + cursor_right.height).toInt() + } if (!popup.isShowing) { popup.showAtLocation(text_menu_position, Gravity.TOP or Gravity.START, x, y) } else {