Use the text itself as a color identifier
This commit is contained in:
parent
1ad529067d
commit
ea6261c975
@ -80,7 +80,9 @@ class ItemCardAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (itm.getIcon(repository.baseUrl).isEmpty()) {
|
if (itm.getIcon(repository.baseUrl).isEmpty()) {
|
||||||
binding.sourceImage.setBackgroundAndText(itm.title.getHtmlDecoded(), itm.title.getHtmlDecoded().toTextDrawableString())
|
binding.sourceImage.setBackgroundAndText(
|
||||||
|
itm.sourcetitle.getHtmlDecoded().toTextDrawableString()
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
c.circularDrawable(itm.getIcon(repository.baseUrl), binding.sourceImage)
|
c.circularDrawable(itm.getIcon(repository.baseUrl), binding.sourceImage)
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,9 @@ class ItemListAdapter(
|
|||||||
if (itm.getThumbnail(repository.baseUrl).isEmpty()) {
|
if (itm.getThumbnail(repository.baseUrl).isEmpty()) {
|
||||||
|
|
||||||
if (itm.getIcon(repository.baseUrl).isEmpty()) {
|
if (itm.getIcon(repository.baseUrl).isEmpty()) {
|
||||||
binding.itemImage.setBackgroundAndText(itm.title.getHtmlDecoded(), itm.title.getHtmlDecoded().toTextDrawableString())
|
binding.itemImage.setBackgroundAndText(
|
||||||
|
itm.sourcetitle.getHtmlDecoded().toTextDrawableString()
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
c.circularDrawable(itm.getIcon(repository.baseUrl), binding.itemImage)
|
c.circularDrawable(itm.getIcon(repository.baseUrl), binding.itemImage)
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,9 @@ class SourcesListAdapter(
|
|||||||
val itm = items[position]
|
val itm = items[position]
|
||||||
|
|
||||||
if (itm.getIcon(repository.baseUrl).isEmpty()) {
|
if (itm.getIcon(repository.baseUrl).isEmpty()) {
|
||||||
binding.itemImage.setBackgroundAndText(itm.title.getHtmlDecoded(), itm.title.getHtmlDecoded().toTextDrawableString())
|
binding.itemImage.setBackgroundAndText(
|
||||||
|
itm.title.getHtmlDecoded().toTextDrawableString()
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
c.circularDrawable(itm.getIcon(repository.baseUrl), binding.itemImage)
|
c.circularDrawable(itm.getIcon(repository.baseUrl), binding.itemImage)
|
||||||
}
|
}
|
||||||
|
@ -46,9 +46,9 @@ class CircleImageView @JvmOverloads constructor(
|
|||||||
textView = view.findViewById(R.id.circleText)
|
textView = view.findViewById(R.id.circleText)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setBackgroundAndText(colorIdentifier: String, text: String) {
|
fun setBackgroundAndText(text: String) {
|
||||||
val circleDrawable = GradientDrawable()
|
val circleDrawable = GradientDrawable()
|
||||||
val color = colorFromIdentifier(colorIdentifier)
|
val color = colorFromIdentifier(text)
|
||||||
circleDrawable.setColor(color)
|
circleDrawable.setColor(color)
|
||||||
imageView.setImageDrawable(circleDrawable)
|
imageView.setImageDrawable(circleDrawable)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user