Merge pull request #290 from believethehype/main

simplified HashTagIcon code, new suggestions for #lightning and #zap
This commit is contained in:
Vitor Pamplona 2023-03-20 08:59:41 -04:00 committed by GitHub
commit fbf5fb4aab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 10 deletions

View File

@ -1,18 +1,15 @@
package com.vitorpamplona.amethyst.model
import androidx.compose.ui.graphics.Color
import com.vitorpamplona.amethyst.R
fun checkForHashtagWithIcon(tag: String): HashtagIcon? {
if (tag.lowercase() == "bitcoin" || tag.lowercase() == "btc") {
return HashtagIcon(R.drawable.ht_btc, "Bitcoin", Color.Unspecified)
} else if (tag.lowercase() == "nostr") {
return HashtagIcon(R.drawable.ht_nostr, "Nostr", Color.Unspecified)
} else if (tag.lowercase() == "zap" || tag.lowercase() == "zaps" || tag.lowercase() == "zapathon" || tag.lowercase() == "zapraiser" || tag.lowercase() == "zaplife" || tag.lowercase() == "lightning") {
return HashtagIcon(R.drawable.lightning, "Zap", Color.Unspecified)
} else if (tag.lowercase() == "amethyst") {
return HashtagIcon(R.drawable.amethyst, "Amethyst", Color.Unspecified)
when (tag.lowercase()) {
"bitcoin", "btc" -> return HashtagIcon(R.drawable.ht_btc, "Bitcoin", Color.Unspecified)
"nostr" -> return HashtagIcon(R.drawable.ht_nostr, "Nostr", Color.Unspecified)
"lightning", "lightningnetwork" -> return HashtagIcon(R.drawable.ht_lightning, "Lightning", Color.Unspecified)
"zap", "zaps", "zapathon", "zapraiser", "zaplife" -> return HashtagIcon(R.drawable.zap, "Zap", Color.Unspecified)
"amethyst" -> return HashtagIcon(R.drawable.amethyst, "Amethyst", Color.Unspecified)
else -> return null
}
return null
}
class HashtagIcon(
val icon: Int,

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="128dp"
android:height="128dp"
android:viewportWidth="128"
android:viewportHeight="128">
<path
android:fillColor="#ffc927"
android:strokeWidth="1"
android:pathData="M97 3C69.7119 22.6197 45.7508 46.6918 19 67C27.1406 70.4159 38.3826 67.0028 47 67C49.7247 66.9991 54.2659 66.2229 56.5733 68.0278C60.1981 70.8631 52.8246 79.2935 51.1998 82L35.6003 108C32.5028 113.163 28.8241 118.238 27 124C38.8349 118.579 49.4585 105.86 59 97.0856C69.6068 87.3314 80.5581 77.9729 91 68.0386C96.1811 63.1093 101.848 58.8943 106 53C91.9282 53 78.0109 53.3984 64 54C65.4064 48.5896 69.3227 44.4231 72.6258 40C78.044 32.7446 83.3124 25.3665 88.5787 18C91.4989 13.9152 97.4483 8.21129 97 3z" />
<path
android:fillColor="#feb804"
android:strokeWidth="1"
android:pathData="M98 3C91.3363 14.9574 82.2325 25.9879 74.1157 37C70.2355 42.2644 64.9711 47.3499 64 54C71.1423 53.7681 73.4873 49.6768 77.0502 44L91.9498 20C95.3452 14.5863 99.3309 9.49763 100 3L98 3z" />
<path
android:fillColor="#ffe567"
android:strokeWidth="1"
android:pathData="M76 24C69.7858 26.4075 64.9312 31.5726 60 35.9498C53.4472 41.7666 46.6333 47.2774 40 53C37.7761 54.9186 28.9583 60.5941 31.1759 64.3773C33.6194 68.5458 42.2348 59.4267 44 57.8302C50.9469 51.5476 57.3779 44.6221 64 38C68.3321 33.6679 73.3863 29.6048 76 24z" />
<path
android:fillColor="#feb804"
android:strokeWidth="1"
android:pathData="M27 126C35.5276 124.86 42.7133 116.423 49 111L92 74.1304C96.8972 69.9137 102.519 65.7843 106.771 60.9105C108 59.5015 110.28 56.6478 108.863 54.662C107.34 52.527 104.271 55.0975 102.999 56.1528C98.1856 60.1473 93.508 64.6668 89 69.0108C75.0876 82.4169 60.3109 94.9448 46 107.925C39.8942 113.463 31.1237 118.823 27 126M17 73L33 73L44 73C47.6311 73 52.2692 73.7558 55.7708 72.6821C57.7569 72.0731 59.3314 69.6974 57.3526 68.0231C55.192 66.195 50.6083 67.0002 48 67C41.9437 66.9996 36.0247 67.9245 30 67.9961C26.7877 68.0344 22.3066 67.2039 19.3179 68.5988C17.3817 69.5024 17.3095 71.1456 17 73z" />
<path
android:fillColor="#ffe567"
android:strokeWidth="1"
android:pathData="M42 106C50.7922 101.262 57.4345 87.9404 63.3735 80C66.3159 76.0659 69.1217 73.0312 68 68C63.0939 70.3377 60.6187 74.5745 57.6667 79C52.3304 86.9998 43.8454 96.4569 42 106z" />
</vector>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="128dp"
android:height="128dp"
android:viewportWidth="128"
android:viewportHeight="128">
<path
android:fillColor="#9C59FF"
android:strokeWidth="1"
android:pathData="M97 3C69.7119 22.6197 45.7508 46.6918 19 67C27.1406 70.4159 38.3826 67.0028 47 67C49.7247 66.9991 54.2659 66.2229 56.5733 68.0278C60.1981 70.8631 52.8246 79.2935 51.1998 82L35.6003 108C32.5028 113.163 28.8241 118.238 27 124C38.8349 118.579 49.4585 105.86 59 97.0856C69.6068 87.3314 80.5581 77.9729 91 68.0386C96.1811 63.1093 101.848 58.8943 106 53C91.9282 53 78.0109 53.3984 64 54C65.4064 48.5896 69.3227 44.4231 72.6258 40C78.044 32.7446 83.3124 25.3665 88.5787 18C91.4989 13.9152 97.4483 8.21129 97 3z" />
<path
android:fillColor="#feb804"
android:strokeWidth="1"
android:pathData="M98 3C91.3363 14.9574 82.2325 25.9879 74.1157 37C70.2355 42.2644 64.9711 47.3499 64 54C71.1423 53.7681 73.4873 49.6768 77.0502 44L91.9498 20C95.3452 14.5863 99.3309 9.49763 100 3L98 3z" />
<path
android:fillColor="#9C59FF"
android:strokeWidth="1"
android:pathData="M76 24C69.7858 26.4075 64.9312 31.5726 60 35.9498C53.4472 41.7666 46.6333 47.2774 40 53C37.7761 54.9186 28.9583 60.5941 31.1759 64.3773C33.6194 68.5458 42.2348 59.4267 44 57.8302C50.9469 51.5476 57.3779 44.6221 64 38C68.3321 33.6679 73.3863 29.6048 76 24z" />
<path
android:fillColor="#feb804"
android:strokeWidth="1"
android:pathData="M27 126C35.5276 124.86 42.7133 116.423 49 111L92 74.1304C96.8972 69.9137 102.519 65.7843 106.771 60.9105C108 59.5015 110.28 56.6478 108.863 54.662C107.34 52.527 104.271 55.0975 102.999 56.1528C98.1856 60.1473 93.508 64.6668 89 69.0108C75.0876 82.4169 60.3109 94.9448 46 107.925C39.8942 113.463 31.1237 118.823 27 126M17 73L33 73L44 73C47.6311 73 52.2692 73.7558 55.7708 72.6821C57.7569 72.0731 59.3314 69.6974 57.3526 68.0231C55.192 66.195 50.6083 67.0002 48 67C41.9437 66.9996 36.0247 67.9245 30 67.9961C26.7877 68.0344 22.3066 67.2039 19.3179 68.5988C17.3817 69.5024 17.3095 71.1456 17 73z" />
<path
android:fillColor="#9C59FF"
android:strokeWidth="1"
android:pathData="M42 106C50.7922 101.262 57.4345 87.9404 63.3735 80C66.3159 76.0659 69.1217 73.0312 68 68C63.0939 70.3377 60.6187 74.5745 57.6667 79C52.3304 86.9998 43.8454 96.4569 42 106z" />
</vector>