From 7af2b7ade0a365765c531b607ad2abce8d3b71f3 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 24 Feb 2020 08:21:43 +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 --- .../legado/app/ui/book/read/ReadBookActivity.kt | 16 +++++----------- 1 file changed, 5 insertions(+), 11 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 a081b33a3..5cbd9bac9 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 @@ -7,6 +7,7 @@ import android.net.Uri import android.os.Bundle import android.os.Handler import android.view.* +import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import androidx.appcompat.view.menu.MenuItemImpl import androidx.core.view.get import androidx.core.view.isVisible @@ -379,20 +380,13 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo textActionMenu ?: let { textActionMenu = TextActionMenu(this, this) } + val x = cursor_left.x.toInt() + cursor_left.width + val y = (page_view.height - cursor_left.y + ReadBookConfig.textSize.dp * 1.5).toInt() textActionMenu?.let { popup -> if (!popup.isShowing) { - popup.showAtLocation( - cursor_left, - Gravity.BOTTOM or Gravity.START, - cursor_left.x.toInt() + cursor_left.width, - page_view.height - cursor_left.y.toInt() + ReadBookConfig.textSize.dp + popup.height - ) + popup.showAtLocation(cursor_left, Gravity.BOTTOM or Gravity.START, x, y) } else { - popup.update( - cursor_left.x.toInt() + cursor_left.width, - page_view.height - cursor_left.y.toInt() + ReadBookConfig.textSize.dp + popup.height, - ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT - ) + popup.update(x, y, WRAP_CONTENT, WRAP_CONTENT) } } }