More tweaks to delegated manga views
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package exh.ui.metadata.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Color
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -13,7 +14,6 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import exh.metadata.EX_DATE_FORMAT
|
||||
import exh.metadata.humanReadableByteCount
|
||||
import exh.metadata.metadata.EHentaiSearchMetadata
|
||||
import exh.ui.metadata.MetadataViewController
|
||||
@@ -25,7 +25,6 @@ import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import reactivecircus.flowbinding.android.view.clicks
|
||||
import reactivecircus.flowbinding.android.view.longClicks
|
||||
import java.util.Date
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class EHentaiDescriptionAdapter(
|
||||
@@ -77,19 +76,27 @@ class EHentaiDescriptionAdapter(
|
||||
binding.visible.text = itemView.context.getString(R.string.is_visible, meta.visible ?: itemView.context.getString(R.string.unknown))
|
||||
|
||||
binding.favorites.text = (meta.favorites ?: 0).toString()
|
||||
val drawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_book_24dp)
|
||||
drawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
binding.favorites.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
|
||||
|
||||
binding.whenPosted.text = EX_DATE_FORMAT.format(Date(meta.datePosted ?: 0))
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_book_24dp)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.favorites.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
binding.uploader.text = meta.uploader ?: itemView.context.getString(R.string.unknown)
|
||||
|
||||
binding.size.text = humanReadableByteCount(meta.size ?: 0, true)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_outline_sd_card_24)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.size.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
binding.pages.text = itemView.resources.getQuantityString(R.plurals.num_pages, meta.length ?: 0, meta.length ?: 0)
|
||||
val pagesDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_baseline_menu_book_24)
|
||||
pagesDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
binding.pages.setCompoundDrawablesWithIntrinsicBounds(pagesDrawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_baseline_menu_book_24)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.pages.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
val language = meta.language ?: itemView.context.getString(R.string.unknown)
|
||||
binding.language.text = if (meta.translated == true) {
|
||||
@@ -114,16 +121,14 @@ class EHentaiDescriptionAdapter(
|
||||
else -> R.string.no_rating
|
||||
}
|
||||
binding.ratingBar.rating = ratingFloat ?: 0F
|
||||
binding.rating.text = if (meta.ratingCount != null) {
|
||||
itemView.context.getString(R.string.rating_view, itemView.context.getString(name), (ratingFloat ?: 0F).toString(), meta.ratingCount ?: 0)
|
||||
} else {
|
||||
itemView.context.getString(R.string.rating_view_no_count, itemView.context.getString(name), (ratingFloat ?: 0F).toString())
|
||||
}
|
||||
@SuppressLint("SetTextI18n")
|
||||
binding.rating.text = (ratingFloat ?: 0F).toString() + " - " + itemView.context.getString(name)
|
||||
|
||||
val infoDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)
|
||||
infoDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
infoDrawable?.setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(infoDrawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
listOf(
|
||||
binding.favorites,
|
||||
@@ -131,10 +136,8 @@ class EHentaiDescriptionAdapter(
|
||||
binding.language,
|
||||
binding.pages,
|
||||
binding.rating,
|
||||
binding.size,
|
||||
binding.uploader,
|
||||
binding.visible,
|
||||
binding.whenPosted
|
||||
binding.visible
|
||||
).forEach { textView ->
|
||||
textView.longClicks()
|
||||
.onEach {
|
||||
|
||||
@@ -48,10 +48,11 @@ class EightMusesDescriptionAdapter(
|
||||
|
||||
binding.title.text = meta.title ?: itemView.context.getString(R.string.unknown)
|
||||
|
||||
val infoDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)
|
||||
infoDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
infoDrawable?.setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(infoDrawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
binding.title.longClicks()
|
||||
.onEach {
|
||||
|
||||
@@ -47,14 +47,17 @@ class HBrowseDescriptionAdapter(
|
||||
if (meta == null || meta !is HBrowseSearchMetadata) return
|
||||
|
||||
binding.pages.text = itemView.resources.getQuantityString(R.plurals.num_pages, meta.length ?: 0, meta.length ?: 0)
|
||||
val pagesDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_baseline_menu_book_24)
|
||||
pagesDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
binding.pages.setCompoundDrawablesWithIntrinsicBounds(pagesDrawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_baseline_menu_book_24)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.pages.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
val infoDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)
|
||||
infoDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
infoDrawable?.setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(infoDrawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
binding.pages.longClicks()
|
||||
.onEach {
|
||||
|
||||
@@ -48,10 +48,11 @@ class HentaiCafeDescriptionAdapter(
|
||||
|
||||
binding.artist.text = meta.artist ?: itemView.context.getString(R.string.unknown)
|
||||
|
||||
val infoDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)
|
||||
infoDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
infoDrawable?.setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(infoDrawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
binding.artist.longClicks()
|
||||
.onEach {
|
||||
|
||||
@@ -76,10 +76,11 @@ class HitomiDescriptionAdapter(
|
||||
binding.group.text = meta.group ?: itemView.context.getString(R.string.unknown)
|
||||
binding.language.text = meta.language ?: itemView.context.getString(R.string.unknown)
|
||||
|
||||
val infoDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)
|
||||
infoDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
infoDrawable?.setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(infoDrawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
listOf(
|
||||
binding.genre,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package exh.ui.metadata.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -21,6 +22,7 @@ import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import reactivecircus.flowbinding.android.view.clicks
|
||||
import reactivecircus.flowbinding.android.view.longClicks
|
||||
import kotlin.math.round
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class MangaDexDescriptionAdapter(
|
||||
@@ -63,17 +65,16 @@ class MangaDexDescriptionAdapter(
|
||||
10 -> R.string.rating10
|
||||
else -> R.string.no_rating
|
||||
}
|
||||
binding.ratingBar.rating = ratingFloat ?: 0F
|
||||
binding.rating.text = if (meta.users?.toIntOrNull() != null) {
|
||||
itemView.context.getString(R.string.rating_view, itemView.context.getString(name), (meta.rating?.toFloatOrNull() ?: 0F).toString(), meta.users?.toIntOrNull() ?: 0)
|
||||
} else {
|
||||
itemView.context.getString(R.string.rating_view_no_count, itemView.context.getString(name), (meta.rating?.toFloatOrNull() ?: 0F).toString())
|
||||
}
|
||||
|
||||
val infoDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)
|
||||
infoDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
infoDrawable?.setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(infoDrawable, null, null, null)
|
||||
binding.ratingBar.rating = ratingFloat ?: 0F
|
||||
@SuppressLint("SetTextI18n")
|
||||
binding.rating.text = (round((meta.rating?.toFloatOrNull() ?: 0F) * 100.0) / 100.0).toString() + " - " + itemView.context.getString(name)
|
||||
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
binding.rating.longClicks()
|
||||
.onEach {
|
||||
|
||||
@@ -82,26 +82,30 @@ class NHentaiDescriptionAdapter(
|
||||
if (it == 0L) return@let
|
||||
binding.favorites.text = it.toString()
|
||||
|
||||
val drawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_favorite_24dp)
|
||||
drawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
|
||||
binding.favorites.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_book_24dp)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.favorites.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
}
|
||||
|
||||
binding.whenPosted.text = EX_DATE_FORMAT.format(Date((meta.uploadDate ?: 0) * 1000))
|
||||
|
||||
binding.pages.text = itemView.resources.getQuantityString(R.plurals.num_pages, meta.pageImageTypes.size, meta.pageImageTypes.size)
|
||||
val pagesDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_baseline_menu_book_24)
|
||||
pagesDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
binding.pages.setCompoundDrawablesWithIntrinsicBounds(pagesDrawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_baseline_menu_book_24)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.pages.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
binding.id.text = "#" + (meta.nhId ?: 0)
|
||||
|
||||
val infoDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)
|
||||
infoDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
infoDrawable?.setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(infoDrawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
listOf(
|
||||
binding.favorites,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package exh.ui.metadata.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Color
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -24,6 +25,7 @@ import kotlinx.coroutines.flow.onEach
|
||||
import reactivecircus.flowbinding.android.view.clicks
|
||||
import reactivecircus.flowbinding.android.view.longClicks
|
||||
import java.util.Locale
|
||||
import kotlin.math.round
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class PervEdenDescriptionAdapter(
|
||||
@@ -88,12 +90,14 @@ class PervEdenDescriptionAdapter(
|
||||
else -> R.string.no_rating
|
||||
}
|
||||
binding.ratingBar.rating = meta.rating ?: 0F
|
||||
binding.rating.text = itemView.context.getString(R.string.rating_view_no_count, itemView.context.getString(name), (meta.rating ?: 0F).toString())
|
||||
@SuppressLint("SetTextI18n")
|
||||
binding.rating.text = (round((meta.rating ?: 0F) * 100.0) / 100.0).toString() + " - " + itemView.context.getString(name)
|
||||
|
||||
val infoDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)
|
||||
infoDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
infoDrawable?.setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(infoDrawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
listOf(
|
||||
binding.genre,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package exh.ui.metadata.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Color
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -24,6 +25,7 @@ import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import reactivecircus.flowbinding.android.view.clicks
|
||||
import reactivecircus.flowbinding.android.view.longClicks
|
||||
import kotlin.math.round
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class PururinDescriptionAdapter(
|
||||
@@ -69,12 +71,20 @@ class PururinDescriptionAdapter(
|
||||
} else binding.genre.setText(R.string.unknown)
|
||||
|
||||
binding.uploader.text = meta.uploaderDisp ?: meta.uploader ?: ""
|
||||
|
||||
binding.size.text = meta.fileSize ?: itemView.context.getString(R.string.unknown)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_outline_sd_card_24)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.size.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
binding.pages.text = itemView.resources.getQuantityString(R.plurals.num_pages, meta.pages ?: 0, meta.pages ?: 0)
|
||||
val pagesDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_baseline_menu_book_24)
|
||||
pagesDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
binding.pages.setCompoundDrawablesWithIntrinsicBounds(pagesDrawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_baseline_menu_book_24)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.pages.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
val ratingFloat = meta.averageRating?.toFloat()
|
||||
val name = when (((ratingFloat ?: 100F) * 2).roundToInt()) {
|
||||
@@ -92,17 +102,14 @@ class PururinDescriptionAdapter(
|
||||
else -> R.string.no_rating
|
||||
}
|
||||
binding.ratingBar.rating = ratingFloat ?: 0F
|
||||
binding.rating.text = if (meta.ratingCount != null) {
|
||||
itemView.context.getString(R.string.rating_view, itemView.context.getString(name), (ratingFloat ?: 0F).toString(), meta.ratingCount ?: 0)
|
||||
} else {
|
||||
itemView.context.getString(R.string.rating_view_no_count, itemView.context.getString(name), (ratingFloat ?: 0F).toString())
|
||||
@SuppressLint("SetTextI18n")
|
||||
binding.rating.text = (round((ratingFloat ?: 0F) * 100.0) / 100.0).toString() + " - " + itemView.context.getString(name)
|
||||
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
val infoDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)
|
||||
infoDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
infoDrawable?.setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(infoDrawable, null, null, null)
|
||||
|
||||
listOf(
|
||||
binding.genre,
|
||||
binding.pages,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package exh.ui.metadata.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Color
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -24,6 +25,7 @@ import kotlinx.coroutines.flow.onEach
|
||||
import reactivecircus.flowbinding.android.view.clicks
|
||||
import reactivecircus.flowbinding.android.view.longClicks
|
||||
import java.util.Date
|
||||
import kotlin.math.round
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class TsuminoDescriptionAdapter(
|
||||
@@ -68,18 +70,22 @@ class TsuminoDescriptionAdapter(
|
||||
} else binding.genre.setText(R.string.unknown)
|
||||
|
||||
binding.favorites.text = (meta.favorites ?: 0).toString()
|
||||
val drawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_favorite_24dp)
|
||||
drawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
binding.favorites.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_book_24dp)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.favorites.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
binding.whenPosted.text = TsuminoSearchMetadata.TSUMINO_DATE_FORMAT.format(Date(meta.uploadDate ?: 0))
|
||||
|
||||
binding.uploader.text = meta.uploader ?: itemView.context.getString(R.string.unknown)
|
||||
|
||||
binding.pages.text = itemView.resources.getQuantityString(R.plurals.num_pages, meta.length ?: 0, meta.length ?: 0)
|
||||
val pagesDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_baseline_menu_book_24)
|
||||
pagesDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
binding.pages.setCompoundDrawablesWithIntrinsicBounds(pagesDrawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_baseline_menu_book_24)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.pages.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
val name = when (((meta.averageRating ?: 100F) * 2).roundToInt()) {
|
||||
0 -> R.string.rating0
|
||||
@@ -96,16 +102,14 @@ class TsuminoDescriptionAdapter(
|
||||
else -> R.string.no_rating
|
||||
}
|
||||
binding.ratingBar.rating = meta.averageRating ?: 0F
|
||||
binding.rating.text = if (meta.userRatings != null) {
|
||||
itemView.context.getString(R.string.rating_view, itemView.context.getString(name), (meta.averageRating ?: 0F).toString(), meta.userRatings ?: 0L)
|
||||
} else {
|
||||
itemView.context.getString(R.string.rating_view_no_count, itemView.context.getString(name), (meta.averageRating ?: 0F).toString())
|
||||
}
|
||||
@SuppressLint("SetTextI18n")
|
||||
binding.rating.text = (round((meta.averageRating ?: 0F) * 100.0) / 100.0).toString() + " - " + itemView.context.getString(name)
|
||||
|
||||
val infoDrawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)
|
||||
infoDrawable?.setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
infoDrawable?.setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(infoDrawable, null, null, null)
|
||||
ContextCompat.getDrawable(itemView.context, R.drawable.ic_info_24dp)?.apply {
|
||||
setTint(itemView.context.getResourceColor(R.attr.colorAccent))
|
||||
setBounds(0, 0, 20.dpToPx, 20.dpToPx)
|
||||
binding.moreInfo.setCompoundDrawables(this, null, null, null)
|
||||
}
|
||||
|
||||
listOf(
|
||||
binding.favorites,
|
||||
|
||||
Reference in New Issue
Block a user