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