Просмотр исходного кода

Revert "书架动画与性能优化 #291"

HapeLee 11 месяцев назад
Родитель
Сommit
7c7cf88ce1

+ 4 - 0
app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt

@@ -124,7 +124,9 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
     }
 
     private fun initRecyclerView() {
+        //binding.rvBookshelf.setEdgeEffectColor(primaryColor)
         upFastScrollerBar()
+        //binding.refreshLayout.setColorSchemeColors(accentColor)
         binding.refreshLayout.setOnRefreshListener {
             val books = booksAdapter.getItems()
             val refreshList = if (AppConfig.bookshelfRefreshingLimit > 0) {
@@ -281,6 +283,8 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
         /**
          * 将 RecyclerView 中的视图全部回收到 RecycledViewPool 中
          */
+        upLastUpdateTimeJob?.cancel()
+        booksFlowJob?.cancel()
         binding.rvBookshelf.setItemViewCacheSize(0)
         binding.rvBookshelf.adapter = null
     }

+ 1 - 1
app/src/main/java/io/legado/app/ui/main/bookshelf/books/styleDefalut/BaseBooksAdapter.kt

@@ -84,7 +84,7 @@ abstract class BaseBooksAdapter<VB : ViewBinding>(context: Context) :
     fun notification(bookUrl: String) {
         getItems().forEachIndexed { i, it ->
             if (it.bookUrl == bookUrl) {
-                notifyItemChanged(i, bundleOf(Pair("refresh", null), Pair("lastUpdateTime", null)))
+                notifyItemChanged(i, bundleOf("refresh" to true, "lastUpdateTime" to true))
                 return
             }
         }

+ 7 - 8
app/src/main/java/io/legado/app/ui/main/bookshelf/books/styleDefalut/BooksAdapterGrid.kt

@@ -9,7 +9,6 @@ import io.legado.app.databinding.ItemBookshelfGridBinding
 import io.legado.app.help.book.isLocal
 import io.legado.app.help.config.AppConfig
 import io.legado.app.utils.gone
-import io.legado.app.utils.invisible
 import io.legado.app.utils.visible
 
 class BooksAdapterGrid(context: Context, private val callBack: CallBack) :
@@ -45,7 +44,7 @@ class BooksAdapterGrid(context: Context, private val callBack: CallBack) :
 
     private fun upRefresh(binding: ItemBookshelfGridBinding, item: Book) {
         if (!item.isLocal && callBack.isUpdate(item.bookUrl)) {
-            binding.cdUnread.invisible()
+            binding.cdUnread.gone()
             binding.rlLoading.visible()
         } else {
             binding.rlLoading.gone()
@@ -55,25 +54,25 @@ class BooksAdapterGrid(context: Context, private val callBack: CallBack) :
                     binding.cdUnread.visible()
                     binding.tvUnread.text = unreadCount.toString()
                 } else {
-                    binding.cdUnread.invisible()
+                    binding.cdUnread.gone()
                 }
             } else {
-                binding.cdUnread.invisible()
+                binding.cdUnread.gone()
             }
         }
     }
 
     override fun registerListener(holder: ItemViewHolder, binding: ItemBookshelfGridBinding) {
 
-        holder.itemView.setOnClickListener {
+        binding.cvContent.setOnClickListener {
             getItem(holder.layoutPosition)?.let {
-                callBack.open(it, binding.root)
+                callBack.open(it, binding.cdCover)
             }
         }
 
-        holder.itemView.setOnLongClickListener {
+        binding.cvContent.setOnLongClickListener {
             getItem(holder.layoutPosition)?.let {
-                callBack.openBookInfo(it, binding.root)
+                callBack.openBookInfo(it, binding.cdCover)
             }
             true
         }

+ 4 - 4
app/src/main/java/io/legado/app/ui/main/bookshelf/books/styleDefalut/BooksAdapterGridCompact.kt

@@ -73,15 +73,15 @@ class BooksAdapterGridCompact(context: Context, private val callBack: CallBack)
         binding: ItemBookshelfGridCompactBinding
     ) {
 
-        holder.itemView.setOnClickListener {
+        binding.cvContent.setOnClickListener {
             getItem(holder.layoutPosition)?.let {
-                callBack.open(it, binding.root)
+                callBack.open(it, binding.cvContent)
             }
         }
 
-        holder.itemView.setOnLongClickListener {
+        binding.cvContent.setOnLongClickListener {
             getItem(holder.layoutPosition)?.let {
-                callBack.openBookInfo(it, binding.root)
+                callBack.openBookInfo(it, binding.cvContent)
             }
             true
         }

+ 4 - 4
app/src/main/java/io/legado/app/ui/main/bookshelf/books/styleDefalut/BooksAdapterGridCover.kt

@@ -74,15 +74,15 @@ class BooksAdapterGridCover(context: Context, private val callBack: CallBack) :
         binding: ItemBookshelfGridCompactBinding
     ) {
 
-        holder.itemView.setOnClickListener {
+        binding.cvContent.setOnClickListener {
             getItem(holder.layoutPosition)?.let {
-                callBack.open(it, binding.root)
+                callBack.open(it, binding.cvContent)
             }
         }
 
-        holder.itemView.setOnLongClickListener {
+        binding.cvContent.setOnLongClickListener {
             getItem(holder.layoutPosition)?.let {
-                callBack.openBookInfo(it, binding.root)
+                callBack.openBookInfo(it, binding.cvContent)
             }
             true
         }

+ 2 - 2
app/src/main/java/io/legado/app/ui/main/bookshelf/books/styleDefalut/BooksAdapterListCompact.kt

@@ -108,13 +108,13 @@ class BooksAdapterListCompact(
         holder.itemView.apply {
             binding.cvContent.setOnClickListener {
                 getItem(holder.layoutPosition)?.let {
-                    callBack.open(it, binding.cvContent)
+                    callBack.open(it, binding.cdCover)
                 }
             }
 
             binding.cvContent.onLongClick {
                 getItem(holder.layoutPosition)?.let {
-                    callBack.openBookInfo(it, binding.cvContent)
+                    callBack.openBookInfo(it, binding.cdCover)
                 }
             }
         }

+ 2 - 2
app/src/main/java/io/legado/app/ui/main/bookshelf/books/styleFold/BooksAdapterListCompact.kt

@@ -111,10 +111,10 @@ class BooksAdapterListCompact(context: Context, callBack: CallBack) :
 
         fun registerListener(item: Any) {
             binding.cvContent.setOnClickListener {
-                callBack.onItemClick(item, binding.cvContent)
+                callBack.onItemClick(item, binding.cdCover)
             }
             binding.cvContent.onLongClick {
-                callBack.onItemLongClick(item, binding.cvContent)
+                callBack.onItemLongClick(item, binding.cdCover)
             }
         }
 

+ 2 - 2
app/src/main/res/layout/dialog_read_book_style.xml

@@ -170,7 +170,6 @@
                 android:layout_height="wrap_content"
                 android:layout_marginHorizontal="16dp"
                 android:layout_marginTop="8dp"
-                android:layout_marginBottom="4dp"
                 android:text="@string/page_anim"
                 android:textStyle="bold"
                 android:textSize="12sp" />
@@ -269,6 +268,7 @@
                     style="@style/Widget.Material3Expressive.Button.TonalButton"
                     android:checkable="true"
                     android:clickable="true"
+                    android:layout_marginVertical="2dp"
                     app:icon="@drawable/ic_share_layout"
                     app:iconGravity="textStart"
                     app:iconPadding="0dp"
@@ -293,7 +293,7 @@
 
                 <ImageView
                     android:layout_width="16dp"
-                    android:layout_height="44dp"
+                    android:layout_height="48dp"
                     app:layout_constraintStart_toEndOf="@id/cb_share_layout"
                     app:layout_constraintTop_toTopOf="parent"
                     app:layout_constraintBottom_toBottomOf="parent"

+ 89 - 65
app/src/main/res/layout/item_bookshelf_grid.xml

@@ -1,82 +1,106 @@
 <?xml version="1.0" encoding="utf-8"?>
-<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.constraintlayout.widget.ConstraintLayout 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"
-    android:clickable="true"
-    android:focusable="true"
-    app:strokeWidth="0dp">
+    android:layout_height="wrap_content">
 
-    <androidx.constraintlayout.widget.ConstraintLayout
+    <com.google.android.material.card.MaterialCardView
         android:id="@+id/cv_content"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_margin="8dp"
-        app:strokeWidth="0dp">
+        app:cardBackgroundColor="@android:color/transparent"
+        android:layout_marginBottom="4dp"
+        android:clickable="true"
+        android:focusable="true"
+        app:strokeWidth="0dp"
+        app:layout_constraintTop_toTopOf="parent">
 
-        <io.legado.app.ui.widget.image.CoverImageView
-            android:id="@+id/iv_cover"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:scaleType="centerCrop"
-            android:src="@drawable/image_cover_default"
-            tools:ignore="ImageContrastCheck" />
-
-        <com.google.android.material.progressindicator.LinearProgressIndicator
-            android:id="@+id/rl_loading"
+        <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginVertical="4dp"
-            android:layout_marginHorizontal="12dp"
-            android:indeterminate="true"
-            android:visibility="invisible"
-            android:layout_gravity="top"
-            app:layout_constraintEnd_toEndOf="@id/iv_cover"
-            app:layout_constraintStart_toStartOf="@id/iv_cover"
-            app:layout_constraintTop_toTopOf="@id/iv_cover" />
+            android:orientation="vertical">
 
-        <com.google.android.material.card.MaterialCardView
-            android:id="@+id/cd_unread"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_margin="4dp"
-            android:visibility="visible"
-            app:cardCornerRadius="4dp"
-            app:strokeWidth="0dp"
-            app:cardBackgroundColor="?attr/colorSecondaryVariant"
-            app:layout_constraintEnd_toEndOf="@id/iv_cover"
-            app:layout_constraintTop_toTopOf="@id/iv_cover">
+            <com.google.android.material.card.MaterialCardView
+                android:id="@+id/cd_cover"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                app:cardCornerRadius="6dp"
+                android:layout_marginHorizontal="8dp"
+                android:layout_marginTop="8dp"
+                android:transitionName="img_cover"
+                app:strokeWidth="0dp">
 
-            <TextView
-                android:id="@+id/tv_unread"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="?attr/colorOnSecondary"
-                android:textSize="10sp"
-                android:padding="4dp"
-                android:textStyle="bold"
-                android:includeFontPadding="false"
-                tools:text="5"
-                tools:ignore="SmallSp" />
+                <androidx.constraintlayout.widget.ConstraintLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content">
 
-        </com.google.android.material.card.MaterialCardView>
+                    <io.legado.app.ui.widget.image.CoverImageView
+                        android:id="@+id/iv_cover"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:scaleType="centerCrop"
+                        android:src="@drawable/image_cover_default"
+                        tools:ignore="ImageContrastCheck" />
 
-        <!-- 书名 -->
-        <TextView
-            android:id="@+id/tv_name"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="4dp"
-            android:layout_marginBottom="6dp"
-            android:ellipsize="end"
-            android:lines="2"
-            android:text="@string/book_name"
-            android:textSize="12sp"
-            android:textStyle="bold"
-            tools:ignore="RtlHardcoded"
-            app:layout_constraintTop_toBottomOf="@id/iv_cover"/>
+                    <com.google.android.material.progressindicator.LinearProgressIndicator
+                        android:id="@+id/rl_loading"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_marginVertical="4dp"
+                        android:layout_marginHorizontal="12dp"
+                        android:indeterminate="true"
+                        android:visibility="invisible"
+                        android:layout_gravity="top"
+                        app:layout_constraintEnd_toEndOf="parent"
+                        app:layout_constraintStart_toStartOf="parent"
+                        app:layout_constraintTop_toTopOf="parent" />
 
-    </androidx.constraintlayout.widget.ConstraintLayout>
+                    <com.google.android.material.card.MaterialCardView
+                        android:id="@+id/cd_unread"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_margin="4dp"
+                        android:visibility="visible"
+                        app:cardCornerRadius="4dp"
+                        app:strokeWidth="0dp"
+                        app:cardBackgroundColor="?attr/colorSecondaryVariant"
+                        app:layout_constraintEnd_toEndOf="parent"
+                        app:layout_constraintTop_toTopOf="parent">
 
-</com.google.android.material.card.MaterialCardView>
+                        <TextView
+                            android:id="@+id/tv_unread"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:textColor="?attr/colorOnSecondary"
+                            android:textSize="10sp"
+                            android:padding="4dp"
+                            android:textStyle="bold"
+                            android:includeFontPadding="false"
+                            tools:text="5"
+                            tools:ignore="SmallSp" />
+
+                    </com.google.android.material.card.MaterialCardView>
+
+                </androidx.constraintlayout.widget.ConstraintLayout>
+
+            </com.google.android.material.card.MaterialCardView>
+
+            <!-- 书名 -->
+            <TextView
+                android:id="@+id/tv_name"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="4dp"
+                android:layout_marginBottom="6dp"
+                android:layout_marginHorizontal="8dp"
+                android:ellipsize="end"
+                android:gravity="left"
+                android:lines="2"
+                android:text="@string/book_name"
+                android:textSize="12sp"
+                android:textStyle="bold"
+                tools:ignore="RtlHardcoded" />
+        </LinearLayout>
+    </com.google.android.material.card.MaterialCardView>
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 71 - 66
app/src/main/res/layout/item_bookshelf_grid_compact.xml

@@ -4,84 +4,89 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:clickable="true"
-    android:focusable="true"
-    app:strokeWidth="0dp"
-    app:cardCornerRadius="8dp"
-    android:layout_margin="8dp">
+    app:cardBackgroundColor="@android:color/transparent"
+    app:strokeWidth="0dp">
 
-    <androidx.constraintlayout.widget.ConstraintLayout
-        android:id="@+id/cv_content"
+    <FrameLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        app:strokeWidth="0dp">
+        android:paddingHorizontal="8dp"
+        android:paddingTop="2dp"
+        android:paddingBottom="12dp">
 
-        <io.legado.app.ui.widget.image.CoverImageView
-            android:id="@+id/iv_cover"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:scaleType="centerCrop"
-            android:src="@drawable/image_cover_default"
-            tools:ignore="ImageContrastCheck" />
-
-        <com.google.android.material.progressindicator.LinearProgressIndicator
-            android:id="@+id/rl_loading"
+        <com.google.android.material.card.MaterialCardView
+            android:id="@+id/cv_content"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginVertical="4dp"
-            android:layout_marginHorizontal="12dp"
-            android:indeterminate="true"
-            android:visibility="invisible"
-            android:layout_gravity="top"
-            app:layout_constraintEnd_toEndOf="@id/iv_cover"
-            app:layout_constraintStart_toStartOf="@id/iv_cover"
-            app:layout_constraintTop_toTopOf="@id/iv_cover" />
+            android:clickable="true"
+            android:focusable="true"
+            android:background="?attr/selectableItemBackground"
+            app:cardCornerRadius="6dp"
+            app:layout_constraintTop_toTopOf="parent"
+            app:strokeWidth="0dp">
 
-        <com.google.android.material.card.MaterialCardView
-            android:id="@+id/cd_unread"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_margin="4dp"
-            android:visibility="visible"
-            app:cardCornerRadius="4dp"
-            app:strokeWidth="0dp"
-            app:cardBackgroundColor="?attr/colorSecondaryVariant"
-            app:layout_constraintEnd_toEndOf="@id/iv_cover"
-            app:layout_constraintTop_toTopOf="@id/iv_cover">
+            <io.legado.app.ui.widget.image.CoverImageView
+                android:id="@+id/iv_cover"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:scaleType="centerCrop"
+                android:src="@drawable/image_cover_default"
+                android:transitionName="img_cover"
+                tools:ignore="ImageContrastCheck" />
 
-            <TextView
-                android:id="@+id/tv_unread"
+            <com.google.android.material.progressindicator.LinearProgressIndicator
+                android:id="@+id/rl_loading"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_gravity="top"
+                android:layout_marginHorizontal="12dp"
+                android:layout_marginVertical="4dp"
+                android:indeterminate="true"
+                android:visibility="invisible" />
+
+            <com.google.android.material.card.MaterialCardView
+                android:id="@+id/cd_unread"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:textColor="?attr/colorOnSecondary"
-                android:textSize="10sp"
-                android:padding="4dp"
-                android:textStyle="bold"
-                android:includeFontPadding="false"
-                tools:text="5"
-                tools:ignore="SmallSp" />
+                android:layout_gravity="top|end"
+                android:layout_margin="4dp"
+                android:visibility="visible"
+                app:cardBackgroundColor="?attr/colorSecondaryVariant"
+                app:cardCornerRadius="4dp"
+                app:strokeWidth="0dp">
 
-        </com.google.android.material.card.MaterialCardView>
+                <TextView
+                    android:id="@+id/tv_unread"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:includeFontPadding="false"
+                    android:padding="4dp"
+                    android:textColor="?attr/colorOnSecondary"
+                    android:textSize="10sp"
+                    android:textStyle="bold"
+                    tools:ignore="SmallSp"
+                    tools:text="5" />
+            </com.google.android.material.card.MaterialCardView>
 
-        <!-- 书名 -->
-        <TextView
-            android:id="@+id/tv_name"
-            android:layout_width="match_parent"
-            android:layout_height="60dp"
-            android:layout_gravity="bottom"
-            android:background="@drawable/bg_gradient_black"
-            android:ellipsize="end"
-            android:gravity="bottom|start"
-            android:lines="2"
-            android:paddingHorizontal="6dp"
-            android:paddingVertical="6dp"
-            android:text="@string/book_name"
-            android:textColor="@android:color/white"
-            android:textSize="12sp"
-            android:textStyle="bold"
-            tools:ignore="RtlHardcoded"
-            app:layout_constraintBottom_toBottomOf="@id/iv_cover"/>
+            <TextView
+                android:id="@+id/tv_name"
+                android:layout_width="match_parent"
+                android:layout_height="60dp"
+                android:layout_gravity="bottom"
+                android:background="@drawable/bg_gradient_black"
+                android:ellipsize="end"
+                android:gravity="bottom|start"
+                android:lines="2"
+                android:paddingHorizontal="6dp"
+                android:paddingVertical="6dp"
+                android:text="@string/book_name"
+                android:textColor="@android:color/white"
+                android:textSize="12sp"
+                android:textStyle="bold"
+                tools:ignore="RtlHardcoded" />
+        </com.google.android.material.card.MaterialCardView>
 
-    </androidx.constraintlayout.widget.ConstraintLayout>
+    </FrameLayout>
 
 </com.google.android.material.card.MaterialCardView>
+

+ 64 - 47
app/src/main/res/layout/item_bookshelf_list_compact.xml

@@ -15,58 +15,75 @@
         android:layout_height="wrap_content"
         tools:ignore="UnusedAttribute">
 
-        <io.legado.app.ui.widget.image.CoverImageView
-            android:id="@+id/iv_cover"
-            android:layout_width="55dp"
-            android:layout_height="77dp"
-            android:scaleType="centerCrop"
-            android:layout_margin="8dp"
-            android:src="@drawable/image_cover_default"
-            app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintBottom_toBottomOf="parent"
-            tools:ignore="ImageContrastCheck" />
-
-        <com.google.android.material.progressindicator.LinearProgressIndicator
-            android:id="@+id/rl_loading"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_marginVertical="4dp"
-            android:layout_marginHorizontal="6dp"
-            android:indeterminate="true"
-            android:visibility="invisible"
-            android:layout_gravity="top"
-            app:layout_constraintTop_toTopOf="@id/iv_cover"
-            app:layout_constraintStart_toStartOf="@id/iv_cover"
-            app:layout_constraintEnd_toEndOf="@id/iv_cover" />
-
         <com.google.android.material.card.MaterialCardView
-            android:id="@+id/cd_unread"
+            android:id="@+id/cd_cover"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_margin="4dp"
-            android:visibility="visible"
-            app:cardCornerRadius="4dp"
+            app:cardCornerRadius="6dp"
             app:strokeWidth="0dp"
-            app:cardBackgroundColor="?attr/colorSecondaryVariant"
-            app:layout_constraintTop_toTopOf="@id/iv_cover"
-            app:layout_constraintEnd_toEndOf="@id/iv_cover">
-
-            <TextView
-                android:id="@+id/tv_unread"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="?attr/colorOnSecondary"
-                android:textSize="9sp"
-                android:padding="3dp"
-                android:textStyle="bold"
-                android:includeFontPadding="false"
-                tools:text="5"
-                tools:ignore="SmallSp" />
-
+            android:layout_margin="8dp"
+            android:transitionName="img_cover"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent">
+            <androidx.constraintlayout.widget.ConstraintLayout
+                android:id="@+id/cl_cover"
+                android:layout_width="55dp"
+                android:layout_height="77dp">
+
+                <io.legado.app.ui.widget.image.CoverImageView
+                    android:id="@+id/iv_cover"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:scaleType="centerCrop"
+                    android:src="@drawable/image_cover_default"
+                    app:layout_constraintTop_toTopOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    tools:ignore="ImageContrastCheck" />
+
+                <com.google.android.material.progressindicator.LinearProgressIndicator
+                    android:id="@+id/rl_loading"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginVertical="4dp"
+                    android:layout_marginHorizontal="6dp"
+                    android:indeterminate="true"
+                    android:visibility="invisible"
+                    android:layout_gravity="top"
+                    app:layout_constraintTop_toTopOf="@id/iv_cover"
+                    app:layout_constraintStart_toStartOf="@id/iv_cover"
+                    app:layout_constraintEnd_toEndOf="@id/iv_cover" />
+
+                <com.google.android.material.card.MaterialCardView
+                    android:id="@+id/cd_unread"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_margin="4dp"
+                    android:visibility="visible"
+                    app:cardCornerRadius="4dp"
+                    app:strokeWidth="0dp"
+                    app:cardBackgroundColor="?attr/colorSecondaryVariant"
+                    app:layout_constraintTop_toTopOf="@id/iv_cover"
+                    app:layout_constraintEnd_toEndOf="@id/iv_cover">
+
+                    <TextView
+                        android:id="@+id/tv_unread"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:textColor="?attr/colorOnSecondary"
+                        android:textSize="9sp"
+                        android:padding="3dp"
+                        android:textStyle="bold"
+                        android:includeFontPadding="false"
+                        tools:text="5"
+                        tools:ignore="SmallSp" />
+
+                </com.google.android.material.card.MaterialCardView>
+
+            </androidx.constraintlayout.widget.ConstraintLayout>
         </com.google.android.material.card.MaterialCardView>
 
-
         <LinearLayout
             android:layout_width="0dp"
             android:layout_height="wrap_content"
@@ -75,7 +92,7 @@
             android:gravity="center_vertical"
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintStart_toEndOf="@id/iv_cover"
+            app:layout_constraintStart_toEndOf="@id/cd_cover"
             app:layout_constraintEnd_toEndOf="parent">
 
             <TextView

+ 1 - 1
app/src/main/res/layout/item_read_style.xml

@@ -13,7 +13,7 @@
         app:cardCornerRadius="8dp"
         app:strokeColor="?attr/colorOutlineVariant"
         app:strokeWidth="2dp"
-        android:layout_marginHorizontal="4dp"
+        android:layout_margin="4dp"
         android:foreground="?android:attr/selectableItemBackground">
 
         <ImageView