mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -134,7 +134,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
val textActionMenu: TextActionMenu by lazy {
|
||||
TextActionMenu(this, this)
|
||||
}
|
||||
private val popupAction by lazy {
|
||||
override val imagePopupAction: PopupAction by lazy {
|
||||
PopupAction(this)
|
||||
}
|
||||
override val isInitFinish: Boolean get() = viewModel.isInitFinish
|
||||
@@ -960,26 +960,26 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
* 长按图片
|
||||
*/
|
||||
override fun onImageLongPress(x: Float, y: Float, src: String) {
|
||||
popupAction.setItems(
|
||||
imagePopupAction.setItems(
|
||||
listOf(
|
||||
SelectItem("查看", "show"),
|
||||
SelectItem("刷新", "refresh")
|
||||
)
|
||||
)
|
||||
popupAction.onActionClick = {
|
||||
imagePopupAction.onActionClick = {
|
||||
when (it) {
|
||||
"show" -> showDialogFragment(PhotoDialog(src))
|
||||
"refresh" -> {
|
||||
ImageProvider.bitmapLruCache.remove(src)
|
||||
}
|
||||
}
|
||||
popupAction.dismiss()
|
||||
imagePopupAction.dismiss()
|
||||
}
|
||||
val navigationBarHeight =
|
||||
if (!ReadBookConfig.hideNavigationBar && navigationBarGravity == Gravity.BOTTOM)
|
||||
navigationBarHeight else 0
|
||||
popupAction.showAtLocation(
|
||||
binding.readView, Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL, x.toInt(),
|
||||
imagePopupAction.showAtLocation(
|
||||
binding.readView, Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL, 0,
|
||||
binding.root.height + navigationBarHeight - y.toInt()
|
||||
)
|
||||
}
|
||||
@@ -1102,7 +1102,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
textActionMenu.dismiss()
|
||||
popupAction.dismiss()
|
||||
imagePopupAction.dismiss()
|
||||
binding.readView.onDestroy()
|
||||
ReadBook.msg = null
|
||||
ReadBook.callBack = null
|
||||
|
||||
@@ -25,6 +25,7 @@ import io.legado.app.ui.book.read.page.entities.TextChapter
|
||||
import io.legado.app.ui.book.read.page.entities.TextPos
|
||||
import io.legado.app.ui.book.read.page.provider.ChapterProvider
|
||||
import io.legado.app.ui.book.read.page.provider.TextPageFactory
|
||||
import io.legado.app.ui.widget.PopupAction
|
||||
import io.legado.app.utils.activity
|
||||
import io.legado.app.utils.screenshot
|
||||
import java.text.BreakIterator
|
||||
@@ -206,6 +207,10 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
||||
if (!pressDown) return true
|
||||
pressDown = false
|
||||
if (!isMove) {
|
||||
if (!longPressed && callBack.imagePopupAction.isShowing) {
|
||||
callBack.imagePopupAction.dismiss()
|
||||
return true
|
||||
}
|
||||
if (!longPressed && !pressOnTextSelected) {
|
||||
onSingleTapUp()
|
||||
return true
|
||||
@@ -539,6 +544,7 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
||||
val isInitFinish: Boolean
|
||||
val isAutoPage: Boolean
|
||||
val autoPageProgress: Int
|
||||
val imagePopupAction: PopupAction
|
||||
fun showActionMenu()
|
||||
fun screenOffTimerStart()
|
||||
fun showTextActionMenu()
|
||||
|
||||
@@ -23,7 +23,7 @@ class PopupAction(private val context: Context) :
|
||||
contentView = binding.root
|
||||
|
||||
isTouchable = true
|
||||
isOutsideTouchable = true
|
||||
isOutsideTouchable = false
|
||||
isFocusable = false
|
||||
|
||||
binding.recyclerView.adapter = adapter
|
||||
|
||||
Reference in New Issue
Block a user