pull/1319/head
gedoor 3 years ago
parent 5cfad9b229
commit eac2e52150
  1. 4
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 14
      app/src/main/java/io/legado/app/ui/book/toc/BookmarkDialog.kt
  3. 3
      app/src/main/java/io/legado/app/ui/book/toc/BookmarkFragment.kt

@ -251,7 +251,7 @@ class ReadBookActivity : ReadBookBaseActivity(),
chapterName = page.title chapterName = page.title
bookText = page.text.trim() bookText = page.text.trim()
} }
BookmarkDialog.start(supportFragmentManager, bookmark) supportFragmentManager.showDialog(BookmarkDialog(bookmark))
} }
} }
R.id.menu_copy_text -> R.id.menu_copy_text ->
@ -512,7 +512,7 @@ class ReadBookActivity : ReadBookBaseActivity(),
if (bookmark == null) { if (bookmark == null) {
toastOnUi(R.string.create_bookmark_error) toastOnUi(R.string.create_bookmark_error)
} else { } else {
BookmarkDialog.start(supportFragmentManager, bookmark) supportFragmentManager.showDialog(BookmarkDialog(bookmark))
} }
return true return true
} }

@ -4,29 +4,23 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.data.appDb import io.legado.app.data.appDb
import io.legado.app.data.entities.Bookmark import io.legado.app.data.entities.Bookmark
import io.legado.app.databinding.DialogBookmarkBinding import io.legado.app.databinding.DialogBookmarkBinding
import io.legado.app.lib.theme.primaryColor import io.legado.app.lib.theme.primaryColor
import io.legado.app.utils.showDialog
import io.legado.app.utils.viewbindingdelegate.viewBinding import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
class BookmarkDialog : BaseDialogFragment() { class BookmarkDialog() : BaseDialogFragment() {
companion object { constructor(bookmark: Bookmark) : this() {
arguments = Bundle().apply {
fun start(fragmentManager: FragmentManager, bookmark: Bookmark) { putParcelable("bookmark", bookmark)
fragmentManager.showDialog<BookmarkDialog> {
putParcelable("bookmark", bookmark)
}
} }
} }
private val binding by viewBinding(DialogBookmarkBinding::bind) private val binding by viewBinding(DialogBookmarkBinding::bind)

@ -13,6 +13,7 @@ import io.legado.app.data.entities.Bookmark
import io.legado.app.databinding.FragmentBookmarkBinding import io.legado.app.databinding.FragmentBookmarkBinding
import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ATH
import io.legado.app.ui.widget.recycler.VerticalDivider import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.showDialog
import io.legado.app.utils.viewbindingdelegate.viewBinding import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.collect
@ -67,6 +68,6 @@ class BookmarkFragment : VMBaseFragment<TocViewModel>(R.layout.fragment_bookmark
} }
override fun onLongClick(bookmark: Bookmark) { override fun onLongClick(bookmark: Bookmark) {
BookmarkDialog.start(childFragmentManager, bookmark) childFragmentManager.showDialog(BookmarkDialog(bookmark))
} }
} }
Loading…
Cancel
Save