|
|
|
@ -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) |
|
|
|
|
message = bookmark.chapterName |
|
|
|
|
val alertBinding = DialogBookmarkBinding.inflate(layoutInflater).apply { |
|
|
|
|
editBookText.setText(bookmark.bookText) |
|
|
|
|
editView.setText(bookmark.content) |
|
|
|
|
}.root |
|
|
|
|
} |
|
|
|
|
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() |
|
|
|
|