pull/1705/head
kunfei 3 years ago
parent 475957715e
commit 49785f97a1
  1. 12
      app/src/main/java/io/legado/app/ui/book/toc/BookmarkDialog.kt
  2. 5
      app/src/main/res/layout/dialog_bookmark.xml

@ -11,14 +11,16 @@ import io.legado.app.databinding.DialogBookmarkBinding
import io.legado.app.lib.theme.primaryColor
import io.legado.app.utils.setLayout
import io.legado.app.utils.viewbindingdelegate.viewBinding
import io.legado.app.utils.visible
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class BookmarkDialog() : BaseDialogFragment(R.layout.dialog_bookmark) {
constructor(bookmark: Bookmark) : this() {
constructor(bookmark: Bookmark, editPos: Int = -1) : this() {
arguments = Bundle().apply {
putInt("editPos", editPos)
putParcelable("bookmark", bookmark)
}
}
@ -32,11 +34,17 @@ class BookmarkDialog() : BaseDialogFragment(R.layout.dialog_bookmark) {
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
val bookmark = arguments?.getParcelable<Bookmark>("bookmark")
val arguments = arguments ?: let {
dismiss()
return
}
val bookmark = arguments.getParcelable<Bookmark>("bookmark")
bookmark ?: let {
dismiss()
return
}
val editPos = arguments.getInt("editPos", -1)
binding.tvFooterLeft.visible(editPos >= 0)
binding.run {
tvChapterName.text = bookmark.chapterName
editBookText.setText(bookmark.bookText)

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
@ -11,8 +11,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="?attr/actionBarStyle"
app:title="@string/bookmark"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:title="@string/bookmark"
app:titleTextAppearance="@style/ToolbarTitle" />
<TextView
@ -80,6 +80,7 @@
android:layout_height="wrap_content"
android:padding="12dp"
android:text="@string/delete"
android:visibility="invisible"
tools:ignore="RtlHardcoded" />
<LinearLayout

Loading…
Cancel
Save