列表模式时,未读章节为0时不显示
This commit is contained in:
+8
-7
@@ -2,13 +2,14 @@ package io.legato.kazusa.ui.main.bookshelf.books.styleDefalut
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import io.legato.kazusa.base.adapter.ItemViewHolder
|
||||
import io.legato.kazusa.data.entities.Book
|
||||
import io.legato.kazusa.databinding.ItemBookshelfGridBinding
|
||||
import io.legato.kazusa.help.book.isLocal
|
||||
import io.legato.kazusa.help.config.AppConfig
|
||||
import io.legato.kazusa.utils.gone
|
||||
import io.legato.kazusa.utils.visible
|
||||
|
||||
class BooksAdapterGrid(context: Context, private val callBack: CallBack) :
|
||||
BaseBooksAdapter<ItemBookshelfGridBinding>(context) {
|
||||
@@ -44,20 +45,20 @@ class BooksAdapterGrid(context: Context, private val callBack: CallBack) :
|
||||
|
||||
private fun upRefresh(binding: ItemBookshelfGridBinding, item: Book) {
|
||||
if (!item.isLocal && callBack.isUpdate(item.bookUrl)) {
|
||||
binding.cdUnread.visibility = View.GONE
|
||||
binding.rlLoading.visibility = View.VISIBLE
|
||||
binding.cdUnread.gone()
|
||||
binding.rlLoading.visible()
|
||||
} else {
|
||||
binding.rlLoading.visibility = View.GONE
|
||||
binding.rlLoading.gone()
|
||||
if (AppConfig.showUnread) {
|
||||
val unreadCount = item.getUnreadChapterNum()
|
||||
if (unreadCount > 0) {
|
||||
binding.cdUnread.visibility = View.VISIBLE
|
||||
binding.cdUnread.visible()
|
||||
binding.tvUnread.text = unreadCount.toString()
|
||||
} else {
|
||||
binding.cdUnread.visibility = View.GONE
|
||||
binding.cdUnread.gone()
|
||||
}
|
||||
} else {
|
||||
binding.cdUnread.visibility = View.GONE
|
||||
binding.cdUnread.gone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-4
@@ -11,7 +11,9 @@ import io.legato.kazusa.data.entities.Book
|
||||
import io.legato.kazusa.databinding.ItemBookshelfListBinding
|
||||
import io.legato.kazusa.help.book.isLocal
|
||||
import io.legato.kazusa.help.config.AppConfig
|
||||
import io.legato.kazusa.utils.gone
|
||||
import io.legato.kazusa.utils.toTimeAgo
|
||||
import io.legato.kazusa.utils.visible
|
||||
import splitties.views.onLongClick
|
||||
|
||||
class BooksAdapterList(
|
||||
@@ -74,11 +76,15 @@ class BooksAdapterList(
|
||||
} else {
|
||||
binding.rlLoading.isVisible = false
|
||||
if (AppConfig.showUnread) {
|
||||
//binding.tvUnread.setHighlight(item.lastCheckCount > 0)
|
||||
binding.tvUnread.isVisible = true
|
||||
binding.tvUnread.text = item.getUnreadChapterNum().toString()
|
||||
val unreadCount = item.getUnreadChapterNum()
|
||||
if (unreadCount > 0) {
|
||||
binding.cdUnread.visible()
|
||||
binding.tvUnread.text = unreadCount.toString()
|
||||
} else {
|
||||
binding.cdUnread.gone()
|
||||
}
|
||||
} else {
|
||||
binding.tvUnread.isVisible = false
|
||||
binding.cdUnread.gone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-4
@@ -12,7 +12,9 @@ import io.legato.kazusa.data.entities.Book
|
||||
import io.legato.kazusa.databinding.ItemBookshelfListCompactBinding
|
||||
import io.legato.kazusa.help.book.isLocal
|
||||
import io.legato.kazusa.help.config.AppConfig
|
||||
import io.legato.kazusa.utils.gone
|
||||
import io.legato.kazusa.utils.toTimeAgo
|
||||
import io.legato.kazusa.utils.visible
|
||||
import splitties.views.onLongClick
|
||||
|
||||
class BooksAdapterListCompact(
|
||||
@@ -78,11 +80,15 @@ class BooksAdapterListCompact(
|
||||
} else {
|
||||
binding.rlLoading.isVisible = false
|
||||
if (AppConfig.showUnread) {
|
||||
//binding.tvUnread.setHighlight(item.lastCheckCount > 0)
|
||||
binding.tvUnread.isVisible = true
|
||||
binding.tvUnread.text = item.getUnreadChapterNum().toString()
|
||||
val unreadCount = item.getUnreadChapterNum()
|
||||
if (unreadCount > 0) {
|
||||
binding.cdUnread.visible()
|
||||
binding.tvUnread.text = unreadCount.toString()
|
||||
} else {
|
||||
binding.cdUnread.gone()
|
||||
}
|
||||
} else {
|
||||
binding.tvUnread.isVisible = false
|
||||
binding.cdUnread.gone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-4
@@ -128,11 +128,15 @@ class BooksAdapterList(context: Context, callBack: CallBack) :
|
||||
} else {
|
||||
binding.rlLoading.isVisible = false
|
||||
if (AppConfig.showUnread) {
|
||||
//binding.tvUnread.setHighlight(item.lastCheckCount > 0)
|
||||
binding.tvUnread.isVisible = true
|
||||
binding.tvUnread.text = item.getUnreadChapterNum().toString()
|
||||
val unreadCount = item.getUnreadChapterNum()
|
||||
if (unreadCount > 0) {
|
||||
binding.cdUnread.visible()
|
||||
binding.tvUnread.text = unreadCount.toString()
|
||||
} else {
|
||||
binding.cdUnread.gone()
|
||||
}
|
||||
} else {
|
||||
binding.tvUnread.isVisible = false
|
||||
binding.cdUnread.gone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-4
@@ -126,11 +126,15 @@ class BooksAdapterListCompact(context: Context, callBack: CallBack) :
|
||||
} else {
|
||||
binding.rlLoading.isVisible = false
|
||||
if (AppConfig.showUnread) {
|
||||
//binding.tvUnread.setHighlight(item.lastCheckCount > 0)
|
||||
binding.tvUnread.isVisible = true
|
||||
binding.tvUnread.text = item.getUnreadChapterNum().toString()
|
||||
val unreadCount = item.getUnreadChapterNum()
|
||||
if (unreadCount > 0) {
|
||||
binding.cdUnread.visible()
|
||||
binding.tvUnread.text = unreadCount.toString()
|
||||
} else {
|
||||
binding.cdUnread.gone()
|
||||
}
|
||||
} else {
|
||||
binding.tvUnread.isVisible = false
|
||||
binding.cdUnread.gone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user