feat: 优化代码

pull/159/head
kunfei 5 years ago
parent 9588c1a622
commit 10d239cef5
  1. 2
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt
  2. 13
      app/src/main/res/layout/item_bookshelf_grid.xml

@ -21,7 +21,6 @@ class BooksAdapterGrid(context: Context, private val callBack: CallBack) :
if (bundle == null) { if (bundle == null) {
ATH.applyBackgroundTint(this) ATH.applyBackgroundTint(this)
tv_name.text = item.name tv_name.text = item.name
bv_author.text = item.author
iv_cover.load(item.getDisplayCover(), item.name, item.author) iv_cover.load(item.getDisplayCover(), item.name, item.author)
if (item.origin != BookType.local && callBack.isUpdate(item.bookUrl)) { if (item.origin != BookType.local && callBack.isUpdate(item.bookUrl)) {
bv_unread.invisible() bv_unread.invisible()
@ -35,7 +34,6 @@ class BooksAdapterGrid(context: Context, private val callBack: CallBack) :
bundle.keySet().map { bundle.keySet().map {
when (it) { when (it) {
"name" -> tv_name.text = item.name "name" -> tv_name.text = item.name
"author" -> bv_author.text = item.author
"cover" -> iv_cover.load(item.getDisplayCover(), item.name, item.author) "cover" -> iv_cover.load(item.getDisplayCover(), item.name, item.author)
"refresh" -> if (item.origin != BookType.local && callBack.isUpdate(item.bookUrl)) { "refresh" -> if (item.origin != BookType.local && callBack.isUpdate(item.bookUrl)) {
bv_unread.invisible() bv_unread.invisible()

@ -48,19 +48,6 @@
tools:ignore="RtlHardcoded" /> tools:ignore="RtlHardcoded" />
</FrameLayout> </FrameLayout>
<io.legado.app.ui.widget.text.BadgeView
android:id="@+id/bv_author"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:includeFontPadding="false"
android:singleLine="true"
app:radius="1dp"
app:up_flat_angle="true"
app:layout_constraintLeft_toLeftOf="@id/iv_cover"
app:layout_constraintBottom_toBottomOf="@id/iv_cover"
tools:ignore="RtlHardcoded" />
<TextView <TextView
android:id="@+id/tv_name" android:id="@+id/tv_name"
android:layout_width="0dp" android:layout_width="0dp"

Loading…
Cancel
Save