Refactoring to use #158.
This commit is contained in:
parent
b51ae58a97
commit
1a4bc1b301
@ -26,6 +26,7 @@ import apps.amine.bou.readerforselfoss.utils.openItemUrl
|
|||||||
import apps.amine.bou.readerforselfoss.utils.shareLink
|
import apps.amine.bou.readerforselfoss.utils.shareLink
|
||||||
import apps.amine.bou.readerforselfoss.utils.sourceAndDateText
|
import apps.amine.bou.readerforselfoss.utils.sourceAndDateText
|
||||||
import apps.amine.bou.readerforselfoss.utils.succeeded
|
import apps.amine.bou.readerforselfoss.utils.succeeded
|
||||||
|
import apps.amine.bou.readerforselfoss.utils.toTextDrawableString
|
||||||
import com.amulyakhare.textdrawable.TextDrawable
|
import com.amulyakhare.textdrawable.TextDrawable
|
||||||
import com.amulyakhare.textdrawable.util.ColorGenerator
|
import com.amulyakhare.textdrawable.util.ColorGenerator
|
||||||
import com.crashlytics.android.Crashlytics
|
import com.crashlytics.android.Crashlytics
|
||||||
@ -92,14 +93,13 @@ class ItemListAdapter(
|
|||||||
|
|
||||||
if (itm.getIcon(c).isEmpty()) {
|
if (itm.getIcon(c).isEmpty()) {
|
||||||
val color = generator.getColor(itm.sourcetitle)
|
val color = generator.getColor(itm.sourcetitle)
|
||||||
val textDrawable = StringBuilder()
|
|
||||||
for (s in itm.sourcetitle.split(" ".toRegex()).filter { it.isEmpty() }.toTypedArray()) {
|
|
||||||
textDrawable.append(s[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
val builder = TextDrawable.builder().round()
|
val drawable =
|
||||||
|
TextDrawable
|
||||||
|
.builder()
|
||||||
|
.round()
|
||||||
|
.build(itm.sourcetitle.toTextDrawableString(), color)
|
||||||
|
|
||||||
val drawable = builder.build(textDrawable.toString(), color)
|
|
||||||
holder.mView.itemImage.setImageDrawable(drawable)
|
holder.mView.itemImage.setImageDrawable(drawable)
|
||||||
} else {
|
} else {
|
||||||
c.circularBitmapDrawable(itm.getIcon(c), holder.mView.itemImage)
|
c.circularBitmapDrawable(itm.getIcon(c), holder.mView.itemImage)
|
||||||
|
Loading…
Reference in New Issue
Block a user