|
|
|
@ -83,27 +83,25 @@ class BookmarkFragment : VMBaseFragment<ChapterListViewModel>(R.layout.fragment_ |
|
|
|
|
|
|
|
|
|
@SuppressLint("InflateParams") |
|
|
|
|
override fun onLongClick(bookmark: Bookmark) { |
|
|
|
|
viewModel.book?.let { book -> |
|
|
|
|
requireContext().alert(R.string.bookmark) { |
|
|
|
|
val alertBinding = DialogEditTextBinding.inflate(layoutInflater) |
|
|
|
|
message = book.name + " • " + bookmark.chapterName |
|
|
|
|
customView { |
|
|
|
|
alertBinding.apply { |
|
|
|
|
editView.setHint(R.string.note_content) |
|
|
|
|
editView.setText(bookmark.content) |
|
|
|
|
}.root |
|
|
|
|
} |
|
|
|
|
yesButton { |
|
|
|
|
alertBinding.editView.text?.toString()?.let { editContent -> |
|
|
|
|
bookmark.content = editContent |
|
|
|
|
App.db.bookmarkDao.update(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 |
|
|
|
|
} |
|
|
|
|
yesButton { |
|
|
|
|
alertBinding.editView.text?.toString()?.let { editContent -> |
|
|
|
|
bookmark.content = editContent |
|
|
|
|
App.db.bookmarkDao.update(bookmark) |
|
|
|
|
} |
|
|
|
|
noButton() |
|
|
|
|
neutralButton(R.string.delete) { |
|
|
|
|
App.db.bookmarkDao.delete(bookmark) |
|
|
|
|
} |
|
|
|
|
}.show().requestInputMethod() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
noButton() |
|
|
|
|
neutralButton(R.string.delete) { |
|
|
|
|
App.db.bookmarkDao.delete(bookmark) |
|
|
|
|
} |
|
|
|
|
}.show().requestInputMethod() |
|
|
|
|
} |
|
|
|
|
} |