pull/783/head
gedoor 4 years ago
parent 39fc040286
commit f7f1c880f5
  1. 24
      app/src/main/java/io/legado/app/ui/book/toc/BookmarkFragment.kt

@ -13,8 +13,9 @@ import io.legado.app.App
import io.legado.app.R
import io.legado.app.base.VMBaseFragment
import io.legado.app.data.entities.Bookmark
import io.legado.app.databinding.DialogEditTextBinding
import io.legado.app.databinding.DialogBookmarkBinding
import io.legado.app.databinding.FragmentBookmarkBinding
import io.legado.app.help.coroutine.Coroutine
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.ATH
import io.legado.app.ui.widget.recycler.VerticalDivider
@ -84,18 +85,19 @@ class BookmarkFragment : VMBaseFragment<ChapterListViewModel>(R.layout.fragment_
@SuppressLint("InflateParams")
override fun onLongClick(bookmark: Bookmark) {
requireContext().alert(R.string.bookmark) {
val alertBinding = DialogEditTextBinding.inflate(layoutInflater)
message = bookmark.bookText
customView {
alertBinding.apply {
editView.setHint(R.string.note_content)
editView.setText(bookmark.content)
}.root
message = bookmark.chapterName
val alertBinding = DialogBookmarkBinding.inflate(layoutInflater).apply {
editBookText.setText(bookmark.bookText)
editView.setText(bookmark.content)
}
customView = alertBinding.root
yesButton {
alertBinding.editView.text?.toString()?.let { editContent ->
bookmark.content = editContent
App.db.bookmarkDao.update(bookmark)
alertBinding.apply {
Coroutine.async {
bookmark.bookText = editBookText.text.toString()
bookmark.content = editView.text.toString()
App.db.bookmarkDao.insert(bookmark)
}
}
}
noButton()

Loading…
Cancel
Save