分组添加封面配置

pull/1222/head^2
gedoor 3 years ago
parent 2b6430a81f
commit f8e4f94f60
  1. 16
      app/src/main/java/io/legado/app/ui/book/group/GroupEditDialog.kt
  2. 1
      app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BooksAdapterGrid.kt
  3. 1
      app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BooksAdapterList.kt
  4. 3
      app/src/main/res/layout/dialog_book_group_edit.xml
  5. 3
      app/src/main/res/layout/item_bookshelf_grid.xml
  6. 3
      app/src/main/res/layout/item_bookshelf_grid_group.xml
  7. 8
      app/src/main/res/layout/item_bookshelf_list.xml
  8. 8
      app/src/main/res/layout/item_bookshelf_list_group.xml

@ -12,10 +12,8 @@ import io.legado.app.data.entities.BookGroup
import io.legado.app.databinding.DialogBookGroupEditBinding import io.legado.app.databinding.DialogBookGroupEditBinding
import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.primaryColor import io.legado.app.lib.theme.primaryColor
import io.legado.app.utils.gone import io.legado.app.utils.*
import io.legado.app.utils.toastOnUi
import io.legado.app.utils.viewbindingdelegate.viewBinding import io.legado.app.utils.viewbindingdelegate.viewBinding
import io.legado.app.utils.windowSize
import splitties.views.onClick import splitties.views.onClick
class GroupEditDialog : BaseDialogFragment() { class GroupEditDialog : BaseDialogFragment() {
@ -35,6 +33,15 @@ class GroupEditDialog : BaseDialogFragment() {
private val binding by viewBinding(DialogBookGroupEditBinding::bind) private val binding by viewBinding(DialogBookGroupEditBinding::bind)
private val viewModel by viewModels<GroupViewModel>() private val viewModel by viewModels<GroupViewModel>()
private var bookGroup: BookGroup? = null private var bookGroup: BookGroup? = null
val selectImage = registerForActivityResult(ActivityResultContractUtils.SelectImage()) {
it?.second?.let { uri ->
if (uri.isContentScheme()) {
binding.ivCover.load(uri.toString())
} else {
binding.ivCover.load(uri.path)
}
}
}
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
@ -64,6 +71,9 @@ class GroupEditDialog : BaseDialogFragment() {
binding.btnDelete.gone() binding.btnDelete.gone()
} }
binding.run { binding.run {
ivCover.onClick {
selectImage.launch(null)
}
btnCancel.onClick { btnCancel.onClick {
dismiss() dismiss()
} }

@ -56,6 +56,7 @@ class BooksAdapterGrid(context: Context, callBack: CallBack) :
binding.run { binding.run {
val item = callBack.getItem(position) as BookGroup val item = callBack.getItem(position) as BookGroup
tvName.text = item.groupName tvName.text = item.groupName
ivCover.load(item.cover)
} }
} }

@ -55,6 +55,7 @@ class BooksAdapterList(context: Context, callBack: CallBack) :
binding.run { binding.run {
val item = callBack.getItem(position) as BookGroup val item = callBack.getItem(position) as BookGroup
tvName.text = item.groupName tvName.text = item.groupName
ivCover.load(item.cover)
} }
} }

@ -30,7 +30,8 @@
android:src="@drawable/image_cover_default" android:src="@drawable/image_cover_default"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tool_bar" /> app:layout_constraintTop_toBottomOf="@+id/tool_bar"
tools:ignore="ImageContrastCheck" />
<io.legado.app.ui.widget.text.TextInputLayout <io.legado.app.ui.widget.text.TextInputLayout

@ -32,7 +32,8 @@
android:src="@drawable/image_cover_default" android:src="@drawable/image_cover_default"
android:transitionName="img_cover" android:transitionName="img_cover"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:ignore="UnusedAttribute" /> tools:ignore="UnusedAttribute,ImageContrastCheck"
tools:layout_editor_absoluteX="8dp" />
<io.legado.app.ui.widget.text.BadgeView <io.legado.app.ui.widget.text.BadgeView
android:id="@+id/bv_unread" android:id="@+id/bv_unread"

@ -32,7 +32,8 @@
android:src="@drawable/image_cover_default" android:src="@drawable/image_cover_default"
android:transitionName="img_cover" android:transitionName="img_cover"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:ignore="UnusedAttribute" /> tools:ignore="UnusedAttribute,ImageContrastCheck"
tools:layout_editor_absoluteX="8dp" />
<io.legado.app.ui.widget.text.BadgeView <io.legado.app.ui.widget.text.BadgeView
android:id="@+id/bv_unread" android:id="@+id/bv_unread"

@ -99,7 +99,7 @@
app:layout_constraintLeft_toRightOf="@+id/iv_author" app:layout_constraintLeft_toRightOf="@+id/iv_author"
app:layout_constraintRight_toRightOf="@id/fl_has_new" app:layout_constraintRight_toRightOf="@id/fl_has_new"
app:layout_constraintTop_toBottomOf="@+id/tv_name" app:layout_constraintTop_toBottomOf="@+id/tv_name"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry,TextContrastCheck" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_read" android:id="@+id/iv_read"
@ -127,7 +127,8 @@
app:layout_constraintBottom_toTopOf="@id/tv_last" app:layout_constraintBottom_toTopOf="@id/tv_last"
app:layout_constraintLeft_toRightOf="@+id/iv_read" app:layout_constraintLeft_toRightOf="@+id/iv_read"
app:layout_constraintRight_toRightOf="@+id/fl_has_new" app:layout_constraintRight_toRightOf="@+id/fl_has_new"
app:layout_constraintTop_toBottomOf="@+id/tv_author" /> app:layout_constraintTop_toBottomOf="@+id/tv_author"
tools:ignore="TextContrastCheck" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_last" android:id="@+id/iv_last"
@ -155,7 +156,8 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/iv_last" app:layout_constraintLeft_toRightOf="@+id/iv_last"
app:layout_constraintRight_toRightOf="@id/fl_has_new" app:layout_constraintRight_toRightOf="@id/fl_has_new"
app:layout_constraintTop_toBottomOf="@+id/tv_read" /> app:layout_constraintTop_toBottomOf="@+id/tv_read"
tools:ignore="TextContrastCheck" />
<View <View
android:id="@+id/vw_foreground" android:id="@+id/vw_foreground"

@ -99,7 +99,7 @@
app:layout_constraintLeft_toRightOf="@+id/iv_author" app:layout_constraintLeft_toRightOf="@+id/iv_author"
app:layout_constraintRight_toRightOf="@id/fl_has_new" app:layout_constraintRight_toRightOf="@id/fl_has_new"
app:layout_constraintTop_toBottomOf="@+id/tv_name" app:layout_constraintTop_toBottomOf="@+id/tv_name"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry,TextContrastCheck" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_read" android:id="@+id/iv_read"
@ -127,7 +127,8 @@
app:layout_constraintBottom_toTopOf="@id/tv_last" app:layout_constraintBottom_toTopOf="@id/tv_last"
app:layout_constraintLeft_toRightOf="@+id/iv_read" app:layout_constraintLeft_toRightOf="@+id/iv_read"
app:layout_constraintRight_toRightOf="@+id/fl_has_new" app:layout_constraintRight_toRightOf="@+id/fl_has_new"
app:layout_constraintTop_toBottomOf="@+id/tv_author" /> app:layout_constraintTop_toBottomOf="@+id/tv_author"
tools:ignore="TextContrastCheck" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_last" android:id="@+id/iv_last"
@ -155,7 +156,8 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/iv_last" app:layout_constraintLeft_toRightOf="@+id/iv_last"
app:layout_constraintRight_toRightOf="@id/fl_has_new" app:layout_constraintRight_toRightOf="@id/fl_has_new"
app:layout_constraintTop_toBottomOf="@+id/tv_read" /> app:layout_constraintTop_toBottomOf="@+id/tv_read"
tools:ignore="TextContrastCheck" />
<View <View
android:id="@+id/vw_foreground" android:id="@+id/vw_foreground"

Loading…
Cancel
Save