mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 08:27:04 +00:00
Fixes icon size cache on the User Profile
This commit is contained in:
@@ -37,7 +37,7 @@ private val resourceCache = LruCache<Int, String>(300)
|
||||
private var resourceCacheLanguage: String? = null
|
||||
|
||||
// Caches most common icons in the app to avoid using disk
|
||||
private val iconCache = LruCache<Int, Painter>(30)
|
||||
private val iconCache = LruCache<Int, LruCache<Int, Painter>>(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<Int, Painter>(10))
|
||||
} else {
|
||||
cached.put(sizeReference, loaded)
|
||||
}
|
||||
|
||||
return loaded
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
+17
-5
@@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+30
-8
@@ -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<Boolean?>,
|
||||
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) =
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
|
||||
+1
-1
@@ -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,
|
||||
)
|
||||
|
||||
+2
-2
@@ -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,
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
@@ -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 =
|
||||
|
||||
+5
-5
@@ -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)
|
||||
|
||||
+12
-14
@@ -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() }
|
||||
|
||||
+3
-5
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
+3
-5
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
+3
-5
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
+3
-5
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
+14
-5
@@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
+11
-2
@@ -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
|
||||
}
|
||||
|
||||
+2
-2
@@ -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 =
|
||||
|
||||
+1
-1
@@ -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,
|
||||
)
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
+4
-3
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user