kunfei 4 년 전
부모
커밋
8815928c89

+ 4 - 1
app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt

@@ -3,6 +3,7 @@ package io.legado.app.ui.book.search
 import android.content.Context
 import android.content.Context
 import android.os.Bundle
 import android.os.Bundle
 import android.view.ViewGroup
 import android.view.ViewGroup
+import androidx.core.view.isVisible
 import androidx.recyclerview.widget.DiffUtil
 import androidx.recyclerview.widget.DiffUtil
 import io.legado.app.R
 import io.legado.app.R
 import io.legado.app.base.adapter.DiffRecyclerAdapter
 import io.legado.app.base.adapter.DiffRecyclerAdapter
@@ -78,6 +79,8 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
         binding.run {
         binding.run {
             tvName.text = searchBook.name
             tvName.text = searchBook.name
             tvAuthor.text = context.getString(R.string.author_show, searchBook.author)
             tvAuthor.text = context.getString(R.string.author_show, searchBook.author)
+            ivInBookshelf.isVisible =
+                callBack.isInBookshelf(searchBook.name, searchBook.author)
             bvOriginCount.setBadgeCount(searchBook.origins.size)
             bvOriginCount.setBadgeCount(searchBook.origins.size)
             upLasted(binding, searchBook.latestChapterTitle)
             upLasted(binding, searchBook.latestChapterTitle)
             tvIntroduce.text = searchBook.trimIntro(context)
             tvIntroduce.text = searchBook.trimIntro(context)
@@ -100,7 +103,7 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
                     "last" -> upLasted(binding, searchBook.latestChapterTitle)
                     "last" -> upLasted(binding, searchBook.latestChapterTitle)
                     "intro" -> tvIntroduce.text = searchBook.trimIntro(context)
                     "intro" -> tvIntroduce.text = searchBook.trimIntro(context)
                     "kind" -> upKind(binding, searchBook.getKindList())
                     "kind" -> upKind(binding, searchBook.getKindList())
-                    "isInBookshelf" -> // todo 添加标志view
+                    "isInBookshelf" -> ivInBookshelf.isVisible =
                         callBack.isInBookshelf(searchBook.name, searchBook.author)
                         callBack.isInBookshelf(searchBook.name, searchBook.author)
                     "cover" -> ivCover.load(
                     "cover" -> ivCover.load(
                         searchBook.coverUrl,
                         searchBook.coverUrl,

+ 3 - 0
app/src/main/java/io/legado/app/ui/widget/text/BevelLabelView.kt

@@ -13,6 +13,9 @@ import androidx.annotation.IntDef
 import io.legado.app.R
 import io.legado.app.R
 import io.legado.app.lib.theme.accentColor
 import io.legado.app.lib.theme.accentColor
 
 
+/**
+ * 斜角标签
+ */
 @Suppress("unused")
 @Suppress("unused")
 class BevelLabelView @JvmOverloads constructor(
 class BevelLabelView @JvmOverloads constructor(
     context: Context,
     context: Context,

+ 10 - 0
app/src/main/res/layout/item_search.xml

@@ -19,6 +19,16 @@
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         tools:ignore="UnusedAttribute" />
         tools:ignore="UnusedAttribute" />
 
 
+    <io.legado.app.ui.widget.image.CircleImageView
+        android:id="@+id/iv_in_bookshelf"
+        android:layout_width="8dp"
+        android:layout_height="8dp"
+        android:layout_margin="8dp"
+        android:scaleType="centerCrop"
+        android:src="@color/md_green_600"
+        app:layout_constraintRight_toRightOf="@id/iv_cover"
+        app:layout_constraintTop_toTopOf="@id/iv_cover" />
+
     <io.legado.app.ui.widget.text.BadgeView
     <io.legado.app.ui.widget.text.BadgeView
         android:id="@+id/bv_originCount"
         android:id="@+id/bv_originCount"
         android:layout_width="wrap_content"
         android:layout_width="wrap_content"