mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
优化
This commit is contained in:
parent
c253ced3aa
commit
504b56f61b
@ -17,8 +17,10 @@ import io.legado.app.data.entities.Book
|
||||
import io.legado.app.databinding.DialogAddToBookshelfBinding
|
||||
import io.legado.app.exception.NoStackTraceException
|
||||
import io.legado.app.model.webBook.WebBook
|
||||
import io.legado.app.ui.book.read.ReadBookActivity
|
||||
import io.legado.app.utils.NetworkUtils
|
||||
import io.legado.app.utils.setLayout
|
||||
import io.legado.app.utils.startActivity
|
||||
import io.legado.app.utils.toastOnUi
|
||||
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
||||
|
||||
@ -66,7 +68,9 @@ class AddToBookshelfDialog() : BaseDialogFragment(R.layout.dialog_add_to_bookshe
|
||||
dismiss()
|
||||
}
|
||||
viewModel.load(bookUrl) {
|
||||
binding.tvMessage.text = "${it.name}(${it.author})"
|
||||
binding.tvName.text = it.name
|
||||
binding.tvAuthor.text = it.author
|
||||
binding.tvOrigin.text = it.originName
|
||||
}
|
||||
binding.tvCancel.setOnClickListener {
|
||||
dismiss()
|
||||
@ -76,6 +80,17 @@ class AddToBookshelfDialog() : BaseDialogFragment(R.layout.dialog_add_to_bookshe
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
binding.tvRead.setOnClickListener {
|
||||
viewModel.saveBook {
|
||||
viewModel.book?.let {
|
||||
startActivity<ReadBookActivity> {
|
||||
putExtra("bookUrl", it.bookUrl)
|
||||
putExtra("inBookshelf", false)
|
||||
}
|
||||
}
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ViewModel(application: Application) : BaseViewModel(application) {
|
||||
|
@ -8,7 +8,7 @@
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:padding="18dp"
|
||||
android:text="@string/add_book_url"
|
||||
android:textColor="@color/primaryText"
|
||||
android:textSize="16sp"
|
||||
@ -16,21 +16,34 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_message"
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:minLines="3"
|
||||
android:paddingHorizontal="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_author"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_origin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_author" />
|
||||
|
||||
<io.legado.app.ui.widget.anima.RotateLoading
|
||||
android:id="@+id/rotate_loading"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_message"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_message" />
|
||||
app:layout_constraintTop_toTopOf="@id/tv_name"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_origin" />
|
||||
|
||||
<io.legado.app.ui.widget.text.AccentTextView
|
||||
android:id="@+id/tv_ok"
|
||||
@ -38,7 +51,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:text="@string/ok"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_message"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_origin"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
@ -48,7 +61,17 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:text="@string/cancel"
|
||||
android:textColor="@color/secondaryText"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/tv_ok" />
|
||||
|
||||
<io.legado.app.ui.widget.text.AccentTextView
|
||||
android:id="@+id/tv_read"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:text="@string/reading"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue
Block a user