More consistent usage of visibility extensions

This commit is contained in:
arkon
2020-03-09 18:42:41 -04:00
parent e195257d2a
commit d5ff5fd6f8
13 changed files with 57 additions and 41 deletions
@@ -5,6 +5,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.util.view.visibleIf
import kotlinx.android.synthetic.main.catalogue_grid_item.download_text
import kotlinx.android.synthetic.main.catalogue_grid_item.local_text
import kotlinx.android.synthetic.main.catalogue_grid_item.thumbnail
@@ -37,16 +38,16 @@ class LibraryGridHolder(
// Update the unread count and its visibility.
with(unread_text) {
visibility = if (item.manga.unread > 0) View.VISIBLE else View.GONE
visibleIf { item.manga.unread > 0 }
text = item.manga.unread.toString()
}
// Update the download count and its visibility.
with(download_text) {
visibility = if (item.downloadCount > 0) View.VISIBLE else View.GONE
visibleIf { item.downloadCount > 0 }
text = item.downloadCount.toString()
}
// set local visibility if its local manga
local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE
local_text.visibleIf { item.manga.source == LocalSource.ID }
// Update the cover.
GlideApp.with(view.context).clear(thumbnail)
@@ -5,6 +5,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.util.view.visibleIf
import kotlinx.android.synthetic.main.catalogue_list_item.download_text
import kotlinx.android.synthetic.main.catalogue_list_item.local_text
import kotlinx.android.synthetic.main.catalogue_list_item.thumbnail
@@ -38,16 +39,16 @@ class LibraryListHolder(
// Update the unread count and its visibility.
with(unread_text) {
visibility = if (item.manga.unread > 0) View.VISIBLE else View.GONE
visibleIf { item.manga.unread > 0 }
text = item.manga.unread.toString()
}
// Update the download count and its visibility.
with(download_text) {
visibility = if (item.downloadCount > 0) View.VISIBLE else View.GONE
visibleIf { item.downloadCount > 0 }
text = "${item.downloadCount}"
}
// show local text badge if local manga
local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE
local_text.visibleIf { item.manga.source == LocalSource.ID }
// Create thumbnail onclick to simulate long click
thumbnail.setOnClickListener {