mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-24 06:41:03 +00:00
fix: manga/anime page noti icon updating
This commit is contained in:
@@ -283,6 +283,9 @@ class AnimeFragment : Fragment() {
|
||||
binding.root.requestApplyInsets()
|
||||
binding.root.requestLayout()
|
||||
}
|
||||
if (this::animePageAdapter.isInitialized && _binding != null) {
|
||||
animePageAdapter.updateNotificationCount()
|
||||
}
|
||||
super.onResume()
|
||||
}
|
||||
}
|
||||
@@ -215,6 +215,14 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
||||
}
|
||||
}
|
||||
|
||||
fun updateNotificationCount() {
|
||||
if (this::binding.isInitialized) {
|
||||
binding.animeNotificationCount.visibility =
|
||||
if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
|
||||
binding.animeNotificationCount.text = Anilist.unreadNotificationCount.toString()
|
||||
}
|
||||
}
|
||||
|
||||
inner class AnimePageViewHolder(val binding: ItemAnimePageBinding) :
|
||||
RecyclerView.ViewHolder(binding.root)
|
||||
}
|
||||
|
||||
@@ -258,6 +258,9 @@ class MangaFragment : Fragment() {
|
||||
binding.root.requestApplyInsets()
|
||||
binding.root.requestLayout()
|
||||
}
|
||||
if (this::mangaPageAdapter.isInitialized && _binding != null) {
|
||||
mangaPageAdapter.updateNotificationCount()
|
||||
}
|
||||
super.onResume()
|
||||
}
|
||||
|
||||
|
||||
@@ -200,6 +200,14 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
||||
}
|
||||
}
|
||||
|
||||
fun updateNotificationCount() {
|
||||
if (this::binding.isInitialized) {
|
||||
binding.mangaNotificationCount.visibility =
|
||||
if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
|
||||
binding.mangaNotificationCount.text = Anilist.unreadNotificationCount.toString()
|
||||
}
|
||||
}
|
||||
|
||||
inner class MangaPageViewHolder(val binding: ItemMangaPageBinding) :
|
||||
RecyclerView.ViewHolder(binding.root)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user