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