diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/StringResourceCache.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/StringResourceCache.kt index c1a25736f6..55430dd5f4 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/StringResourceCache.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/StringResourceCache.kt @@ -37,7 +37,7 @@ private val resourceCache = LruCache(300) private var resourceCacheLanguage: String? = null // Caches most common icons in the app to avoid using disk -private val iconCache = LruCache(30) +private val iconCache = LruCache>(30) fun checkLanguage(currentLanguage: String) { if (resourceCacheLanguage == null) { @@ -127,19 +127,29 @@ fun stringRes( /** * This cache can only be used if the painter is the only copy on the screen + * It should store a separate Painter for each size. It's safe to just assume + * Different compositions use different sizes. */ @Composable fun painterRes( - @DrawableRes id: Int, + @DrawableRes resourceId: Int, + sizeReference: Int, ): Painter { - val cached = iconCache.get(id) + val cached = iconCache.get(resourceId) if (cached != null) { - return cached + val composition = cached.get(sizeReference) + if (composition != null) { + return composition + } } - val loaded = painterResource(id) + val loaded = painterResource(resourceId) - iconCache.put(id, loaded) + if (cached == null) { + iconCache.put(resourceId, LruCache(10)) + } else { + cached.put(sizeReference, loaded) + } return loaded } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/EditPostView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/EditPostView.kt index 199e2d236a..557c8a8785 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/EditPostView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/EditPostView.kt @@ -175,7 +175,7 @@ fun EditPostView( onClick = { showRelaysDialog = true }, ) { Icon( - painter = painterRes(R.drawable.relays), + painter = painterRes(R.drawable.relays, 2), contentDescription = stringRes(id = R.string.relay_list_selector), modifier = Modifier.height(25.dp), tint = MaterialTheme.colorScheme.onBackground, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt index fb81e50822..9252a51dc9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt @@ -134,7 +134,7 @@ fun NewMediaView( onClick = { showRelaysDialog = true }, ) { Icon( - painter = painterRes(R.drawable.relays), + painter = painterRes(R.drawable.relays, 3), contentDescription = stringRes(id = R.string.relay_list_selector), modifier = Modifier.height(25.dp), tint = MaterialTheme.colorScheme.onBackground, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt index ea77ff3b9b..1b79f32b33 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt @@ -36,8 +36,11 @@ import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Report import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem +import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -86,13 +89,12 @@ import com.vitorpamplona.amethyst.ui.actions.CrossfadeIfEnabled import com.vitorpamplona.amethyst.ui.actions.InformationDialog import com.vitorpamplona.amethyst.ui.note.BlankNote import com.vitorpamplona.amethyst.ui.note.DownloadForOfflineIcon -import com.vitorpamplona.amethyst.ui.note.HashCheckFailedIcon -import com.vitorpamplona.amethyst.ui.note.HashCheckIcon +import com.vitorpamplona.amethyst.ui.painterRes import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.Size20dp import com.vitorpamplona.amethyst.ui.theme.Size24dp -import com.vitorpamplona.amethyst.ui.theme.Size30dp +import com.vitorpamplona.amethyst.ui.theme.Size30Modifier import com.vitorpamplona.amethyst.ui.theme.Size40dp import com.vitorpamplona.amethyst.ui.theme.Size6dp import com.vitorpamplona.amethyst.ui.theme.Size75dp @@ -837,7 +839,12 @@ private fun HashVerificationSymbol(verifiedHash: Boolean) { openDialogMsg.value = stringRes(localContext, R.string.hash_verification_passed) }, ) { - HashCheckIcon(Size30dp) + Icon( + painter = painterRes(R.drawable.original, 1), + contentDescription = stringRes(id = R.string.hash_verification_passed), + modifier = Size30Modifier, + tint = Color.Unspecified, + ) } } else { IconButton( @@ -846,7 +853,12 @@ private fun HashVerificationSymbol(verifiedHash: Boolean) { openDialogMsg.value = stringRes(localContext, R.string.hash_verification_failed) }, ) { - HashCheckFailedIcon(Size30dp) + Icon( + imageVector = Icons.Default.Report, + contentDescription = stringRes(id = R.string.hash_verification_failed), + modifier = Size30Modifier, + tint = Color.Red, + ) } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/ErrorList.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/ErrorList.kt index 89dabc657d..826f216876 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/ErrorList.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/multiline/ErrorList.kt @@ -140,7 +140,7 @@ fun ErrorRow( } ?: stringRes(R.string.error_dialog_talk_to_user) Icon( - painter = painterRes(R.drawable.ic_dm), + painter = painterRes(R.drawable.ic_dm, 2), contentDescription = descriptor, modifier = Size20Modifier, tint = MaterialTheme.colorScheme.primary, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/ChatHeaderLayout.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/ChatHeaderLayout.kt index 9cc2040462..204e28356d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/ChatHeaderLayout.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/ChatHeaderLayout.kt @@ -56,7 +56,7 @@ fun ChannelNamePreview() { ChatHeaderLayout( channelPicture = { Image( - painter = painterRes(R.drawable.github), + painter = painterRes(R.drawable.github, 1), contentDescription = stringRes(id = R.string.profile_banner), contentScale = ContentScale.FillWidth, ) @@ -89,7 +89,7 @@ fun ChannelNamePreview() { }, leadingContent = { Image( - painter = painterRes(R.drawable.github), + painter = painterRes(R.drawable.github, 2), contentDescription = stringRes(id = R.string.profile_banner), contentScale = ContentScale.FillWidth, modifier = Size55Modifier, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/LeftPictureLayout.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/LeftPictureLayout.kt index 51dac9e05d..50a4a6c6f8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/LeftPictureLayout.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/LeftPictureLayout.kt @@ -65,7 +65,7 @@ fun LeftPictureLayoutPreviewCard() { LeftPictureLayout( onImage = { Image( - painter = painterRes(R.drawable.github), + painter = painterRes(R.drawable.github, 3), contentDescription = stringRes(id = R.string.profile_banner), contentScale = ContentScale.FillWidth, modifier = Modifier.fillMaxSize().clip(QuoteBorder), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt index dd57aefdcf..2c6eed373d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt @@ -184,7 +184,7 @@ private fun NotifiableIcon( ) { Box(route.notifSize) { Icon( - painter = painterRes(id = route.icon), + painter = painterRes(resourceId = route.icon, 0), contentDescription = stringRes(route.contentDescriptor), modifier = route.iconSize, tint = if (selected) MaterialTheme.colorScheme.primary else Color.Unspecified, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/DrawerContent.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/DrawerContent.kt index 4a87c19704..7799af097b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/DrawerContent.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/DrawerContent.kt @@ -225,7 +225,7 @@ fun ProfileContentTemplate( ) } else { Image( - painter = painterRes(R.drawable.profile_banner), + painter = painterRes(R.drawable.profile_banner, 3), contentDescription = stringRes(R.string.profile_banner), contentScale = ContentScale.FillWidth, modifier = bannerModifier, @@ -480,6 +480,7 @@ fun ListContent( NavigationRow( title = R.string.privacy_options, icon = R.drawable.ic_tor, + iconReference = 1, tint = MaterialTheme.colorScheme.onBackground, nav = nav, route = Route.PrivacyOptions, @@ -567,6 +568,7 @@ private fun RenderRelayStatus(relayPool: RelayPool.RelayPoolStatus) { fun NavigationRow( title: Int, icon: Int, + iconReference: Int, tint: Color, nav: INav, route: Route, @@ -574,6 +576,7 @@ fun NavigationRow( IconRow( title, icon, + iconReference, tint, onClick = { nav.closeDrawer() @@ -622,6 +625,7 @@ fun NavigationRow( fun IconRow( title: Int, icon: Int, + iconReference: Int, tint: Color, onClick: () -> Unit, ) { @@ -638,7 +642,7 @@ fun IconRow( verticalAlignment = Alignment.CenterVertically, ) { Icon( - painter = painterRes(icon), + painter = painterRes(icon, iconReference), contentDescription = stringRes(title), modifier = Size22Modifier, tint = tint, @@ -724,8 +728,8 @@ fun IconRowRelays( verticalAlignment = Alignment.CenterVertically, ) { Icon( - painter = painterRes(R.drawable.relays), - null, + painter = painterRes(R.drawable.relays, 4), + contentDescription = stringRes(R.string.relay_setup), modifier = Modifier.size(22.dp), tint = MaterialTheme.colorScheme.onSurface, ) @@ -800,7 +804,7 @@ fun BottomContent( }, ) { Icon( - painter = painterRes(R.drawable.ic_qrcode), + painter = painterRes(R.drawable.ic_qrcode, 2), contentDescription = stringRes(id = R.string.show_npub_as_a_qr_code), modifier = Modifier.size(24.dp), tint = MaterialTheme.colorScheme.primary, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ErrorMessageDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ErrorMessageDialog.kt index 5f0f3292d7..cc9fb379f8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ErrorMessageDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ErrorMessageDialog.kt @@ -81,7 +81,7 @@ fun ErrorMessageDialog( onClickStartMessage?.let { TextButton(onClick = onClickStartMessage) { Icon( - painter = painterRes(R.drawable.ic_dm), + painter = painterRes(R.drawable.ic_dm, 3), contentDescription = null, ) Spacer(StdHorzSpacer) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/Icons.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/Icons.kt index abd01796a8..d331ef3544 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/Icons.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/Icons.kt @@ -31,13 +31,11 @@ import androidx.compose.material.icons.filled.Cancel import androidx.compose.material.icons.filled.Clear import androidx.compose.material.icons.filled.ContentCopy import androidx.compose.material.icons.filled.DownloadForOffline -import androidx.compose.material.icons.filled.Downloading import androidx.compose.material.icons.filled.ExpandLess import androidx.compose.material.icons.filled.ExpandMore import androidx.compose.material.icons.filled.Link import androidx.compose.material.icons.filled.MoreVert import androidx.compose.material.icons.filled.PushPin -import androidx.compose.material.icons.filled.Report import androidx.compose.material.icons.filled.Share import androidx.compose.material.icons.outlined.AddReaction import androidx.compose.material.icons.outlined.Close @@ -49,7 +47,6 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.res.painterResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import com.vitorpamplona.amethyst.R @@ -64,7 +61,6 @@ import com.vitorpamplona.amethyst.commons.icons.Repost import com.vitorpamplona.amethyst.commons.icons.Reposted import com.vitorpamplona.amethyst.commons.icons.Search import com.vitorpamplona.amethyst.commons.icons.Zap -import com.vitorpamplona.amethyst.ui.painterRes import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange import com.vitorpamplona.amethyst.ui.theme.Size19Modifier @@ -108,16 +104,6 @@ fun ArrowBackIcon(tint: Color = MaterialTheme.colorScheme.grayText) { ) } -@Composable -fun MessageIcon(modifier: Modifier) { - Icon( - painter = painterRes(R.drawable.ic_dm), - null, - modifier = modifier, - tint = MaterialTheme.colorScheme.primary, - ) -} - @Composable fun DownloadForOfflineIcon( iconSize: Dp, @@ -131,26 +117,6 @@ fun DownloadForOfflineIcon( ) } -@Composable -fun HashCheckIcon(iconSize: Dp) { - Icon( - painter = painterRes(R.drawable.original), - contentDescription = stringRes(id = R.string.hash_verification_passed), - modifier = remember(iconSize) { Modifier.size(iconSize) }, - tint = Color.Unspecified, - ) -} - -@Composable -fun HashCheckFailedIcon(iconSize: Dp) { - Icon( - imageVector = Icons.Default.Report, - contentDescription = stringRes(id = R.string.hash_verification_failed), - modifier = remember(iconSize) { Modifier.size(iconSize) }, - tint = Color.Red, - ) -} - @Composable fun LikedIcon( modifier: Modifier, @@ -361,26 +327,6 @@ fun CommentIcon( ) } -@Composable -fun PollIcon() { - Icon( - painter = painterRes(R.drawable.ic_poll), - contentDescription = stringRes(id = R.string.poll), - modifier = Size20Modifier, - tint = MaterialTheme.colorScheme.onBackground, - ) -} - -@Composable -fun RegularPostIcon() { - Icon( - painter = painterRes(R.drawable.ic_lists), - contentDescription = stringRes(id = R.string.disable_poll), - modifier = Size20Modifier, - tint = MaterialTheme.colorScheme.onBackground, - ) -} - @Composable fun CancelIcon() { Icon( @@ -482,59 +428,3 @@ fun VerticalDotsIcon() { tint = MaterialTheme.colorScheme.placeholderText, ) } - -@Composable -fun NIP05CheckingIcon(modifier: Modifier) { - Icon( - imageVector = Icons.Default.Downloading, - contentDescription = stringRes(id = R.string.nip05_checking), - modifier = modifier, - tint = Color.Yellow, - ) -} - -@Composable -fun NIP05VerifiedIcon(modifier: Modifier) { - Icon( - painter = painterRes(R.drawable.nip_05), - contentDescription = stringRes(id = R.string.nip05_verified), - modifier = modifier, - tint = Color.Unspecified, - ) -} - -@Composable -fun NIP05FailedVerification(modifier: Modifier) { - Icon( - imageVector = Icons.Default.Report, - contentDescription = stringRes(id = R.string.nip05_failed), - modifier = modifier, - tint = Color.Red, - ) -} - -@Composable -fun IncognitoIconOn( - modifier: Modifier, - tint: Color, -) { - Icon( - painter = painterResource(id = R.drawable.incognito), - contentDescription = stringRes(id = R.string.accessibility_turn_off_sealed_message), - modifier = modifier, - tint = tint, - ) -} - -@Composable -fun IncognitoIconOff( - modifier: Modifier, - tint: Color, -) { - Icon( - painter = painterResource(id = R.drawable.incognito_off), - contentDescription = stringRes(id = R.string.accessibility_turn_on_sealed_message), - modifier = modifier, - tint = tint, - ) -} diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/MessageSetCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/MessageSetCompose.kt index be83c4641f..92e50947d5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/MessageSetCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/MessageSetCompose.kt @@ -30,6 +30,8 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -37,9 +39,11 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.ui.navigation.INav import com.vitorpamplona.amethyst.ui.navigation.routeFor import com.vitorpamplona.amethyst.ui.note.elements.NoteDropDownMenu +import com.vitorpamplona.amethyst.ui.painterRes import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.MessageSetCard import com.vitorpamplona.amethyst.ui.theme.StdStartPadding @@ -116,6 +120,11 @@ fun MessageSetCompose( @Composable fun MessageIconBox() { Box(Modifier.width(55.dp).padding(top = 5.dp, end = 5.dp)) { - MessageIcon(Modifier.size(16.dp).align(Alignment.TopEnd)) + Icon( + painter = painterRes(R.drawable.ic_dm, 4), + null, + modifier = Modifier.size(16.dp).align(Alignment.TopEnd), + tint = MaterialTheme.colorScheme.primary, + ) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt index aca67bf2fd..b859a1d38c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt @@ -26,6 +26,8 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.OpenInNew +import androidx.compose.material.icons.filled.Downloading +import androidx.compose.material.icons.filled.Report import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.LocalTextStyle @@ -41,11 +43,13 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.commons.hashtags.CustomHashTagIcons import com.vitorpamplona.amethyst.commons.hashtags.Tunestr import com.vitorpamplona.amethyst.model.AddressableNote @@ -59,11 +63,10 @@ import com.vitorpamplona.amethyst.ui.actions.CrossfadeIfEnabled import com.vitorpamplona.amethyst.ui.navigation.INav import com.vitorpamplona.amethyst.ui.navigation.routeFor import com.vitorpamplona.amethyst.ui.note.LoadAddressableNote -import com.vitorpamplona.amethyst.ui.note.NIP05CheckingIcon -import com.vitorpamplona.amethyst.ui.note.NIP05FailedVerification -import com.vitorpamplona.amethyst.ui.note.NIP05VerifiedIcon import com.vitorpamplona.amethyst.ui.note.WatchAuthor +import com.vitorpamplona.amethyst.ui.painterRes import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel +import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.Font14SP import com.vitorpamplona.amethyst.ui.theme.NIP05IconSize import com.vitorpamplona.amethyst.ui.theme.Size15Modifier @@ -389,7 +392,7 @@ fun DisplayNIP05( ) } - NIP05VerifiedSymbol(nip05Verified, NIP05IconSize, accountViewModel) + NIP05VerifiedSymbol(nip05Verified, 1, NIP05IconSize, accountViewModel) ClickableTextPrimary( text = domain, @@ -404,14 +407,33 @@ fun DisplayNIP05( @Composable private fun NIP05VerifiedSymbol( nip05Verified: MutableState, + compositionSizeReference: Int, modifier: Modifier, accountViewModel: AccountViewModel, ) { CrossfadeIfEnabled(targetState = nip05Verified.value, accountViewModel = accountViewModel) { when (it) { - null -> NIP05CheckingIcon(modifier = modifier) - true -> NIP05VerifiedIcon(modifier = modifier) - false -> NIP05FailedVerification(modifier = modifier) + null -> + Icon( + imageVector = Icons.Default.Downloading, + contentDescription = stringRes(id = R.string.nip05_checking), + modifier = modifier, + tint = Color.Yellow, + ) + true -> + Icon( + painter = painterRes(R.drawable.nip_05, compositionSizeReference), + contentDescription = stringRes(id = R.string.nip05_verified), + modifier = modifier, + tint = Color.Unspecified, + ) + false -> + Icon( + imageVector = Icons.Default.Report, + contentDescription = stringRes(id = R.string.nip05_failed), + modifier = modifier, + tint = Color.Red, + ) } } } @@ -427,7 +449,7 @@ fun DisplayNip05ProfileStatus( if (nip05.split("@").size <= 2) { val nip05Verified = nip05VerificationAsAState(user.info!!, user.pubkeyHex, accountViewModel) Row(verticalAlignment = Alignment.CenterVertically) { - NIP05VerifiedSymbol(nip05Verified, Size16Modifier, accountViewModel) + NIP05VerifiedSymbol(nip05Verified, 2, Size16Modifier, accountViewModel) var domainPadStart = 5.dp val (user, domain) = diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt index 12db18fcba..f4652c99eb 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt @@ -528,6 +528,7 @@ fun QuickActionAlertDialog( title: String, textContent: String, buttonIconResource: Int, + buttonIconReference: Int, buttonText: String, buttonColors: ButtonColors = ButtonDefaults.buttonColors(), onClickDoOnce: () -> Unit, @@ -539,7 +540,7 @@ fun QuickActionAlertDialog( textContent = textContent, icon = { Icon( - painter = painterRes(buttonIconResource), + painter = painterRes(buttonIconResource, buttonIconReference), contentDescription = null, ) }, @@ -626,6 +627,7 @@ fun QuickActionAlertDialogOneButton( title: String, textContent: String, buttonIconResource: Int, + buttonIconReference: Int, buttonText: String, buttonColors: ButtonColors = ButtonDefaults.buttonColors(), onClickDoOnce: () -> Unit, @@ -636,7 +638,7 @@ fun QuickActionAlertDialogOneButton( textContent = textContent, icon = { Icon( - painter = painterRes(buttonIconResource), + painter = painterRes(buttonIconResource, buttonIconReference), contentDescription = null, ) }, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt index 8f3b353c55..34aa68b64f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt @@ -98,6 +98,7 @@ import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.ButtonBorder import com.vitorpamplona.amethyst.ui.theme.DividerThickness import com.vitorpamplona.amethyst.ui.theme.Font14SP +import com.vitorpamplona.amethyst.ui.theme.Size24Modifier import com.vitorpamplona.amethyst.ui.theme.placeholderText import com.vitorpamplona.quartz.nip01Core.core.toHexKey import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer @@ -460,9 +461,9 @@ fun UpdateZapAmountContent( }, ) { Icon( - painter = painterRes(R.drawable.alby), + painter = painterRes(R.drawable.alby, 1), contentDescription = stringRes(id = R.string.accessibility_navigate_to_alby), - modifier = Modifier.size(24.dp), + modifier = Size24Modifier, tint = Color.Unspecified, ) } @@ -475,14 +476,14 @@ fun UpdateZapAmountContent( Icon( Icons.Outlined.ContentPaste, contentDescription = stringRes(id = R.string.paste_from_clipboard), - modifier = Modifier.size(24.dp), + modifier = Size24Modifier, tint = MaterialTheme.colorScheme.primary, ) } IconButton(onClick = { qrScanning = true }) { Icon( - painter = painterRes(R.drawable.ic_qrcode), + painter = painterRes(R.drawable.ic_qrcode, 3), contentDescription = stringRes(id = R.string.accessibility_scan_qr_code), modifier = Modifier.size(24.dp), tint = MaterialTheme.colorScheme.primary, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/zappolls/PollField.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/zappolls/PollField.kt index 9bc2c30c71..1928d52943 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/zappolls/PollField.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/zappolls/PollField.kt @@ -65,7 +65,7 @@ fun PollField(postViewModel: ShortNotePostViewModel) { ), ) { Image( - painterRes(id = android.R.drawable.ic_input_add), + painter = painterRes(resourceId = android.R.drawable.ic_input_add, 1), contentDescription = "Add poll option button", modifier = Size18Modifier, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DefaultImageHeader.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DefaultImageHeader.kt index 61f5fd9bba..6c1427bf14 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DefaultImageHeader.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DefaultImageHeader.kt @@ -90,7 +90,7 @@ fun BannerImage( accountViewModel = accountViewModel, onError = { Image( - painter = painterRes(R.drawable.profile_banner), + painter = painterRes(R.drawable.profile_banner, 4), contentDescription = stringRes(R.string.profile_banner), contentScale = ContentScale.Crop, modifier = modifier, @@ -99,7 +99,7 @@ fun BannerImage( ) } else { Image( - painter = painterRes(R.drawable.profile_banner), + painter = painterRes(R.drawable.profile_banner, 5), contentDescription = stringRes(R.string.profile_banner), contentScale = ContentScale.Crop, modifier = modifier, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/GenericCommentPostScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/GenericCommentPostScreen.kt index fecbeabb1b..1fbdc21c77 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/GenericCommentPostScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/GenericCommentPostScreen.kt @@ -166,7 +166,7 @@ fun GenericCommentPostScreen( onClick = { postViewModel.showRelaysDialog = true }, ) { Icon( - painter = painterRes(R.drawable.relays), + painter = painterRes(R.drawable.relays, 5), contentDescription = stringRes(id = R.string.relay_list_selector), modifier = Modifier.height(25.dp), tint = MaterialTheme.colorScheme.onBackground, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/AppDefinition.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/AppDefinition.kt index c09bdf48d0..64533d9a88 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/AppDefinition.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/AppDefinition.kt @@ -122,7 +122,7 @@ fun RenderAppDefinition( } } else { Image( - painter = painterRes(R.drawable.profile_banner), + painter = painterRes(R.drawable.profile_banner, 6), contentDescription = stringRes(id = R.string.profile_banner), contentScale = ContentScale.FillWidth, modifier = diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/IncognitoBadge.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/IncognitoBadge.kt index 74f4217b28..a7f7444e8f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/IncognitoBadge.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/IncognitoBadge.kt @@ -27,8 +27,8 @@ import androidx.compose.runtime.Composable import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Note import com.vitorpamplona.amethyst.ui.painterRes +import com.vitorpamplona.amethyst.ui.theme.IncognitoIconModifier import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer -import com.vitorpamplona.amethyst.ui.theme.incognitoIconModifier import com.vitorpamplona.amethyst.ui.theme.placeholderText import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent import com.vitorpamplona.quartz.nip17Dm.base.NIP17Group @@ -37,17 +37,17 @@ import com.vitorpamplona.quartz.nip17Dm.base.NIP17Group fun IncognitoBadge(baseNote: Note) { if (baseNote.event is NIP17Group) { Icon( - painter = painterRes(id = R.drawable.incognito), + painter = painterRes(resourceId = R.drawable.incognito, 1), null, - modifier = incognitoIconModifier, + modifier = IncognitoIconModifier, tint = MaterialTheme.colorScheme.placeholderText, ) Spacer(modifier = StdHorzSpacer) } else if (baseNote.event is PrivateDmEvent) { Icon( - painter = painterRes(id = R.drawable.incognito_off), + painter = painterRes(resourceId = R.drawable.incognito_off, 1), null, - modifier = incognitoIconModifier, + modifier = IncognitoIconModifier, tint = MaterialTheme.colorScheme.placeholderText, ) Spacer(modifier = StdHorzSpacer) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ToggleNip17Button.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ToggleNip17Button.kt index d6a7770476..34912b7c51 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ToggleNip17Button.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ToggleNip17Button.kt @@ -20,9 +20,8 @@ */ package com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.privateDM.send -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width +import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable @@ -34,11 +33,11 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R -import com.vitorpamplona.amethyst.ui.note.IncognitoIconOff -import com.vitorpamplona.amethyst.ui.note.IncognitoIconOn import com.vitorpamplona.amethyst.ui.note.QuickActionAlertDialog +import com.vitorpamplona.amethyst.ui.painterRes import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.stringRes +import com.vitorpamplona.amethyst.ui.theme.IncognitoIconButtonModifier import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.coroutines.launch @@ -72,19 +71,17 @@ fun ToggleNip17Button( }, ) { if (channelScreenModel.nip17) { - IncognitoIconOn( - modifier = - Modifier - .padding(top = 2.dp) - .size(20.dp), + Icon( + painter = painterRes(R.drawable.incognito, 2), + contentDescription = stringRes(id = R.string.accessibility_turn_off_sealed_message), + modifier = IncognitoIconButtonModifier, tint = MaterialTheme.colorScheme.primary, ) } else { - IncognitoIconOff( - modifier = - Modifier - .padding(top = 2.dp) - .size(20.dp), + Icon( + painter = painterRes(R.drawable.incognito_off, 2), + contentDescription = stringRes(id = R.string.accessibility_turn_on_sealed_message), + modifier = IncognitoIconButtonModifier, tint = MaterialTheme.colorScheme.placeholderText, ) } @@ -103,6 +100,7 @@ fun NewFeatureNIP17AlertDialog( title = stringRes(R.string.new_feature_nip17_might_not_be_available_title), textContent = stringRes(R.string.new_feature_nip17_might_not_be_available_description), buttonIconResource = R.drawable.incognito, + buttonIconReference = 3, buttonText = stringRes(R.string.new_feature_nip17_activate), onClickDoOnce = { scope.launch { onConfirm() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/NewCommunityNoteButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/NewCommunityNoteButton.kt index 42f7023f00..67ea494ab7 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/NewCommunityNoteButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/NewCommunityNoteButton.kt @@ -20,15 +20,12 @@ */ package com.vitorpamplona.amethyst.ui.screen.loggedIn.communities -import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Note import com.vitorpamplona.amethyst.ui.components.LoadNote @@ -37,6 +34,7 @@ import com.vitorpamplona.amethyst.ui.navigation.Route import com.vitorpamplona.amethyst.ui.painterRes import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.stringRes +import com.vitorpamplona.amethyst.ui.theme.Size26Modifier import com.vitorpamplona.amethyst.ui.theme.Size55Modifier @Composable @@ -69,9 +67,9 @@ fun NewCommunityNoteButton( containerColor = MaterialTheme.colorScheme.primary, ) { Icon( - painter = painterRes(R.drawable.ic_compose), + painter = painterRes(R.drawable.ic_compose, 2), contentDescription = stringRes(id = R.string.new_community_note), - modifier = Modifier.size(26.dp), + modifier = Size26Modifier, tint = Color.White, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductScreen.kt index 2332b3f414..580f31de06 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductScreen.kt @@ -170,7 +170,7 @@ fun NewProductScreen( onClick = { showRelaysDialog = true }, ) { Icon( - painter = painterRes(R.drawable.relays), + painter = painterRes(R.drawable.relays, 1), contentDescription = stringRes(id = R.string.relay_list_selector), modifier = Modifier.height(25.dp), tint = MaterialTheme.colorScheme.onBackground, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/NewGeoNoteButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/NewGeoNoteButton.kt index 45a8f79e86..7a79446286 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/NewGeoNoteButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/NewGeoNoteButton.kt @@ -20,21 +20,19 @@ */ package com.vitorpamplona.amethyst.ui.screen.loggedIn.geohash -import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.ui.navigation.INav import com.vitorpamplona.amethyst.ui.navigation.Route import com.vitorpamplona.amethyst.ui.painterRes import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.stringRes +import com.vitorpamplona.amethyst.ui.theme.Size26Modifier import com.vitorpamplona.amethyst.ui.theme.Size55Modifier @Composable @@ -52,9 +50,9 @@ fun NewGeoPostButton( containerColor = MaterialTheme.colorScheme.primary, ) { Icon( - painter = painterRes(R.drawable.ic_compose), + painter = painterRes(R.drawable.ic_compose, 1), contentDescription = stringRes(id = R.string.new_community_note), - modifier = Modifier.size(26.dp), + modifier = Size26Modifier, tint = Color.White, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/NewHashtagNoteButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/NewHashtagNoteButton.kt index fa16b2a52e..77ea685235 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/NewHashtagNoteButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/NewHashtagNoteButton.kt @@ -20,21 +20,19 @@ */ package com.vitorpamplona.amethyst.ui.screen.loggedIn.hashtag -import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.ui.navigation.INav import com.vitorpamplona.amethyst.ui.navigation.Route import com.vitorpamplona.amethyst.ui.painterRes import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.stringRes +import com.vitorpamplona.amethyst.ui.theme.Size26Modifier import com.vitorpamplona.amethyst.ui.theme.Size55Modifier @Composable @@ -52,9 +50,9 @@ fun NewHashtagPostButton( containerColor = MaterialTheme.colorScheme.primary, ) { Icon( - painter = painterRes(R.drawable.ic_compose), + painter = painterRes(R.drawable.ic_compose, 3), contentDescription = stringRes(id = R.string.new_community_note), - modifier = Modifier.size(26.dp), + modifier = Size26Modifier, tint = Color.White, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/NewNoteButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/NewNoteButton.kt index 6a6a4f59cc..4478b6cf94 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/NewNoteButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/NewNoteButton.kt @@ -20,20 +20,18 @@ */ package com.vitorpamplona.amethyst.ui.screen.loggedIn.home -import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.ui.navigation.INav import com.vitorpamplona.amethyst.ui.navigation.Route import com.vitorpamplona.amethyst.ui.painterRes import com.vitorpamplona.amethyst.ui.stringRes +import com.vitorpamplona.amethyst.ui.theme.Size26Modifier import com.vitorpamplona.amethyst.ui.theme.Size55Modifier @Composable @@ -47,9 +45,9 @@ fun NewNoteButton(nav: INav) { containerColor = MaterialTheme.colorScheme.primary, ) { Icon( - painter = painterRes(R.drawable.ic_compose), + painter = painterRes(R.drawable.ic_compose, 4), contentDescription = stringRes(R.string.new_post), - modifier = Modifier.size(26.dp), + modifier = Size26Modifier, tint = Color.White, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostScreen.kt index 356bef90ce..1e22671f59 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostScreen.kt @@ -71,8 +71,6 @@ import com.vitorpamplona.amethyst.ui.components.getActivity import com.vitorpamplona.amethyst.ui.navigation.Nav import com.vitorpamplona.amethyst.ui.note.BaseUserPicture import com.vitorpamplona.amethyst.ui.note.NoteCompose -import com.vitorpamplona.amethyst.ui.note.PollIcon -import com.vitorpamplona.amethyst.ui.note.RegularPostIcon import com.vitorpamplona.amethyst.ui.note.buttons.CloseButton import com.vitorpamplona.amethyst.ui.note.buttons.PostButton import com.vitorpamplona.amethyst.ui.note.creators.contentWarning.ContentSensitivityExplainer @@ -100,6 +98,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.settings.SettingsRow import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.Size10dp +import com.vitorpamplona.amethyst.ui.theme.Size20Modifier import com.vitorpamplona.amethyst.ui.theme.Size35dp import com.vitorpamplona.amethyst.ui.theme.Size5dp import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer @@ -195,7 +194,7 @@ private fun NewPostScreenInner( onClick = { postViewModel.showRelaysDialog = true }, ) { Icon( - painter = painterRes(R.drawable.relays), + painter = painterRes(R.drawable.relays, 6), contentDescription = stringRes(id = R.string.relay_list_selector), modifier = Modifier.height(25.dp), tint = MaterialTheme.colorScheme.onBackground, @@ -530,9 +529,19 @@ private fun AddPollButton( onClick = { onClick() }, ) { if (!isPollActive) { - PollIcon() + Icon( + painter = painterRes(R.drawable.ic_poll, 1), + contentDescription = stringRes(id = R.string.poll), + modifier = Size20Modifier, + tint = MaterialTheme.colorScheme.onBackground, + ) } else { - RegularPostIcon() + Icon( + painter = painterRes(R.drawable.ic_lists, 1), + contentDescription = stringRes(id = R.string.disable_poll), + modifier = Size20Modifier, + tint = MaterialTheme.colorScheme.onBackground, + ) } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/keyBackup/AccountBackupDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/keyBackup/AccountBackupDialog.kt index a4cf57fc0e..4d6e95a212 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/keyBackup/AccountBackupDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/keyBackup/AccountBackupDialog.kt @@ -503,7 +503,7 @@ private fun QrCodeButtonBase( }, ) { Icon( - painter = painterRes(R.drawable.ic_qrcode), + painter = painterRes(R.drawable.ic_qrcode, 4), contentDescription = stringRes(id = contentDescription), modifier = Modifier.size(24.dp), tint = if (isEnabled) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.grayText, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DrawAdditionalInfo.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DrawAdditionalInfo.kt index 3ae75e8f42..9b5d3f74ba 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DrawAdditionalInfo.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DrawAdditionalInfo.kt @@ -146,7 +146,7 @@ fun DrawAdditionalInfo( onClick = { dialogOpen = true }, ) { Icon( - painter = painterRes(R.drawable.ic_qrcode), + painter = painterRes(R.drawable.ic_qrcode, 1), contentDescription = stringRes(id = R.string.show_npub_as_a_qr_code), modifier = Size15Modifier, tint = MaterialTheme.colorScheme.placeholderText, @@ -196,7 +196,7 @@ fun DrawAdditionalInfo( Row(verticalAlignment = Alignment.CenterVertically) { Icon( tint = Color.Unspecified, - painter = painterRes(id = getIdentityClaimIcon(identity)), + painter = painterRes(resourceId = getIdentityClaimIcon(identity), getIdentityClaimIconReference(identity)), contentDescription = stringRes(getIdentityClaimDescription(identity)), modifier = Modifier.size(16.dp), ) @@ -253,3 +253,12 @@ fun getIdentityClaimDescription(identity: IdentityClaimTag): Int = is GitHubIdentity -> R.string.github else -> R.drawable.github } + +fun getIdentityClaimIconReference(identity: IdentityClaimTag): Int = + when (identity) { + is TwitterIdentity -> 0 + is TelegramIdentity -> 0 + is MastodonIdentity -> 0 + is GitHubIdentity -> 0 + else -> 0 + } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DrawBanner.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DrawBanner.kt index c516c8aeae..fd87e10452 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DrawBanner.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DrawBanner.kt @@ -70,7 +70,7 @@ fun DrawBanner( model = banner, contentDescription = stringRes(id = R.string.profile_image), contentScale = ContentScale.FillWidth, - placeholder = painterRes(R.drawable.profile_banner), + placeholder = painterRes(R.drawable.profile_banner, 1), modifier = Modifier .fillMaxWidth() @@ -90,7 +90,7 @@ fun DrawBanner( } } else { Image( - painter = painterRes(R.drawable.profile_banner), + painter = painterRes(R.drawable.profile_banner, 2), contentDescription = stringRes(id = R.string.profile_banner), contentScale = ContentScale.FillWidth, modifier = diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/MessageButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/MessageButton.kt index b2b1f36b7d..9f161ddc8c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/MessageButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/MessageButton.kt @@ -59,7 +59,7 @@ fun MessageButton( contentPadding = ZeroPadding, ) { Icon( - painter = painterRes(R.drawable.ic_dm), + painter = painterRes(R.drawable.ic_dm, 1), stringRes(R.string.send_a_direct_message), modifier = Size20Modifier, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/RelayNameAndRemoveButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/RelayNameAndRemoveButton.kt index 773a8877e9..86622eba91 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/RelayNameAndRemoveButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/RelayNameAndRemoveButton.kt @@ -36,11 +36,11 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalClipboardManager -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R +import com.vitorpamplona.amethyst.ui.painterRes import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.WarningColor import com.vitorpamplona.amethyst.ui.theme.allGoodColor @@ -84,7 +84,7 @@ fun RelayNameAndRemoveButton( if (item.forcesTor) { Icon( - painter = painterResource(R.drawable.ic_tor), + painter = painterRes(R.drawable.ic_tor, 2), contentDescription = stringRes(id = R.string.tor_relay), modifier = Modifier diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt index 3f721fbc79..f4a333bdac 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt @@ -849,7 +849,7 @@ private fun RenderClassifiedsReaderForThread( verticalAlignment = Alignment.CenterVertically, ) { Icon( - painter = painterRes(R.drawable.ic_dm), + painter = painterRes(R.drawable.ic_dm, 5), stringRes(R.string.send_a_direct_message), modifier = Modifier.size(20.dp), tint = MaterialTheme.colorScheme.primary, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/NewImageButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/NewImageButton.kt index ce2a49a975..e04d5dd9aa 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/NewImageButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/NewImageButton.kt @@ -57,6 +57,7 @@ import com.vitorpamplona.amethyst.ui.navigation.INav import com.vitorpamplona.amethyst.ui.painterRes import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.stringRes +import com.vitorpamplona.amethyst.ui.theme.Size26Modifier import com.vitorpamplona.amethyst.ui.theme.Size55Modifier import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf @@ -178,7 +179,7 @@ fun NewImageButton( Icon( imageVector = Icons.Outlined.Close, contentDescription = stringRes(id = R.string.new_short), - modifier = Modifier.size(26.dp), + modifier = Size26Modifier, tint = Color.White, ) } @@ -189,9 +190,9 @@ fun NewImageButton( exit = fadeOut(), ) { Icon( - painter = painterRes(R.drawable.ic_compose), + painter = painterRes(R.drawable.ic_compose, 5), contentDescription = stringRes(id = R.string.new_short), - modifier = Modifier.size(26.dp), + modifier = Size26Modifier, tint = Color.White, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/LoginScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/LoginScreen.kt index a46c60fa67..4b442a304f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/LoginScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/LoginScreen.kt @@ -592,7 +592,7 @@ fun KeyTextField( } IconButton(onClick = { dialogOpen = true }) { Icon( - painter = painterRes(R.drawable.ic_qrcode), + painter = painterRes(R.drawable.ic_qrcode, 5), contentDescription = stringRes( R.string.login_with_qr_code, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt index b70d522d11..35231bc118 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt @@ -284,10 +284,8 @@ val inlinePlaceholder = placeholderVerticalAlign = PlaceholderVerticalAlign.Center, ) -val incognitoIconModifier = - Modifier - .padding(top = 1.dp) - .size(14.dp) +val IncognitoIconModifier = Modifier.padding(top = 1.dp).size(14.dp) +val IncognitoIconButtonModifier = Modifier.padding(top = 2.dp).size(20.dp) val hashVerifierMark = Modifier.width(40.dp).height(40.dp).padding(10.dp)