mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
优化
This commit is contained in:
parent
475957715e
commit
49785f97a1
@ -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…
Reference in New Issue
Block a user