From 5f710b7304a742f5709fe518965807ff286cdb6d Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 29 Jun 2023 12:29:08 -0400 Subject: [PATCH] Adds #tunestr icon --- .../amethyst/model/HashtagIcon.kt | 3 +- .../amethyst/ui/components/RichTextViewer.kt | 3 +- app/src/main/res/drawable/tunestr.xml | 31 +++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/drawable/tunestr.xml diff --git a/app/src/main/java/com/vitorpamplona/amethyst/model/HashtagIcon.kt b/app/src/main/java/com/vitorpamplona/amethyst/model/HashtagIcon.kt index 8ffeb9d71..f2a8cfb14 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/model/HashtagIcon.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/model/HashtagIcon.kt @@ -5,7 +5,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R -fun checkForHashtagWithIcon(tag: String): HashtagIcon? { +fun checkForHashtagWithIcon(tag: String, primary: Color): HashtagIcon? { return when (tag.lowercase()) { "bitcoin", "btc", "timechain" -> HashtagIcon(R.drawable.ht_btc, "Bitcoin", Color.Unspecified, Modifier.padding(2.dp, 2.dp, 0.dp, 0.dp)) "nostr", "nostrich", "nostriches" -> HashtagIcon(R.drawable.ht_nostr, "Nostr", Color.Unspecified, Modifier.padding(1.dp, 2.dp, 0.dp, 0.dp)) @@ -18,6 +18,7 @@ fun checkForHashtagWithIcon(tag: String): HashtagIcon? { "skullofsatoshi" -> HashtagIcon(R.drawable.skull, "SkullofSatoshi", Color.Unspecified, Modifier.padding(2.dp, 1.dp, 0.dp, 0.dp)) "grownostr", "gardening", "garden" -> HashtagIcon(R.drawable.grownostr, "GrowNostr", Color.Unspecified, Modifier.padding(0.dp, 1.dp, 0.dp, 1.dp)) "footstr" -> HashtagIcon(R.drawable.footstr, "Footstr", Color.Unspecified, Modifier.padding(1.dp, 1.dp, 0.dp, 0.dp)) + "tunestr", "music", "nowplaying" -> HashtagIcon(R.drawable.tunestr, "Tunestr", primary, Modifier.padding(1.dp, 1.dp, 0.dp, 0.dp)) "weed", "weedstr", "420", "cannabis", "marijuana" -> HashtagIcon(R.drawable.weed, "Weed", Color.Unspecified, Modifier.padding(0.dp, 0.dp, 0.dp, 0.dp)) else -> null } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt index 4b1f5a72d..93adc5f6d 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/RichTextViewer.kt @@ -835,7 +835,8 @@ private fun RenderHashtag( tagPair: HashWordWithExtra, nav: (String) -> Unit ) { - val hashtagIcon = remember(tagPair.hashtag) { checkForHashtagWithIcon(tagPair.hashtag) } + val primary = MaterialTheme.colors.primary + val hashtagIcon = remember(tagPair.hashtag) { checkForHashtagWithIcon(tagPair.hashtag, primary) } ClickableText( text = buildAnnotatedString { withStyle( diff --git a/app/src/main/res/drawable/tunestr.xml b/app/src/main/res/drawable/tunestr.xml new file mode 100644 index 000000000..7a352ffea --- /dev/null +++ b/app/src/main/res/drawable/tunestr.xml @@ -0,0 +1,31 @@ + + + + + + +