diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/Icons.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/Icons.kt index 471235002..0233622a3 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/Icons.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/Icons.kt @@ -20,6 +20,7 @@ */ package com.vitorpamplona.amethyst.ui.note +import Following import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -63,6 +64,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R +import com.vitorpamplona.amethyst.commons.hashtags.Amethyst import com.vitorpamplona.amethyst.commons.hashtags.Cashu import com.vitorpamplona.amethyst.commons.hashtags.CustomHashTagIcons import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange @@ -72,11 +74,12 @@ import com.vitorpamplona.amethyst.ui.theme.Size30Modifier import com.vitorpamplona.amethyst.ui.theme.grayText import com.vitorpamplona.amethyst.ui.theme.placeholderText import com.vitorpamplona.amethyst.ui.theme.subtleButton +import kotlin.time.measureTimedValue @Composable fun AmethystIcon(iconSize: Dp) { Icon( - painter = painterResource(R.drawable.amethyst), + imageVector = CustomHashTagIcons.Amethyst, contentDescription = stringResource(id = R.string.app_logo), modifier = Modifier.size(iconSize), tint = Color.Unspecified, @@ -85,12 +88,16 @@ fun AmethystIcon(iconSize: Dp) { @Composable fun FollowingIcon(iconSize: Dp) { - Icon( - painter = painterResource(R.drawable.following), - contentDescription = stringResource(id = R.string.following), - modifier = Modifier.size(iconSize), - tint = Color.Unspecified, - ) + val (value, elapsed) = + measureTimedValue { + Icon( + imageVector = Following, + contentDescription = stringResource(id = R.string.following), + modifier = Modifier.size(iconSize), + tint = Color.Unspecified, + ) + } + println("FollowingIcon $elapsed") } @Composable diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/LoginScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/LoginScreen.kt index 936251823..de25e75d4 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/LoginScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/LoginScreen.kt @@ -89,6 +89,8 @@ import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.Amethyst import com.vitorpamplona.amethyst.R +import com.vitorpamplona.amethyst.commons.hashtags.Amethyst +import com.vitorpamplona.amethyst.commons.hashtags.CustomHashTagIcons import com.vitorpamplona.amethyst.service.PackageUtils import com.vitorpamplona.amethyst.ui.MainActivity import com.vitorpamplona.amethyst.ui.actions.LoadingAnimation @@ -245,7 +247,7 @@ fun LoginPage( horizontalAlignment = Alignment.CenterHorizontally, ) { Image( - painterResource(id = R.drawable.amethyst), + imageVector = CustomHashTagIcons.Amethyst, contentDescription = stringResource(R.string.app_logo), modifier = Modifier.size(150.dp), contentScale = ContentScale.Inside, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/SignUpScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/SignUpScreen.kt index b92faa5be..d15789244 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/SignUpScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/SignUpScreen.kt @@ -54,7 +54,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalUriHandler -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString @@ -66,6 +65,8 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.R +import com.vitorpamplona.amethyst.commons.hashtags.Amethyst +import com.vitorpamplona.amethyst.commons.hashtags.CustomHashTagIcons import com.vitorpamplona.amethyst.service.PackageUtils import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.ConnectOrbotDialog @@ -116,7 +117,7 @@ fun SignUpPage( horizontalAlignment = Alignment.CenterHorizontally, ) { Image( - painterResource(id = R.drawable.amethyst), + imageVector = CustomHashTagIcons.Amethyst, contentDescription = stringResource(R.string.app_logo), modifier = Modifier.size(150.dp), contentScale = ContentScale.Inside, diff --git a/app/src/main/res/drawable/giftwrap_off.xml b/app/src/main/res/drawable/giftwrap_off.xml deleted file mode 100644 index f3348f8ca..000000000 --- a/app/src/main/res/drawable/giftwrap_off.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/giftwrap_on.xml b/app/src/main/res/drawable/giftwrap_on.xml deleted file mode 100644 index 6ee6d4274..000000000 --- a/app/src/main/res/drawable/giftwrap_on.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/verified_follow_shield.png b/app/src/main/res/drawable/verified_follow_shield.png deleted file mode 100644 index 0aa45cd5f..000000000 Binary files a/app/src/main/res/drawable/verified_follow_shield.png and /dev/null differ diff --git a/commons/src/main/java/com/vitorpamplona/amethyst/commons/labels/Following.kt b/commons/src/main/java/com/vitorpamplona/amethyst/commons/labels/Following.kt new file mode 100644 index 000000000..057dd7a68 --- /dev/null +++ b/commons/src/main/java/com/vitorpamplona/amethyst/commons/labels/Following.kt @@ -0,0 +1,131 @@ +/** + * Copyright (c) 2024 Vitor Pamplona + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +import androidx.compose.foundation.Image +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap +import androidx.compose.ui.graphics.StrokeJoin +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.path +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp + +@Preview +@Composable +private fun VectorPreview() { + Image(Following, null) +} + +private var labelsFollowing: ImageVector? = null + +public val Following: ImageVector + get() { + if (labelsFollowing != null) { + return labelsFollowing!! + } + labelsFollowing = + ImageVector.Builder( + name = "Following", + defaultWidth = 30.dp, + defaultHeight = 30.dp, + viewportWidth = 30f, + viewportHeight = 30f, + ).apply { + path( + fill = SolidColor(Color(0xFF7F2EFF)), + fillAlpha = 1.0f, + stroke = null, + strokeAlpha = 1.0f, + strokeLineWidth = 1.0f, + strokeLineCap = StrokeCap.Butt, + strokeLineJoin = StrokeJoin.Miter, + strokeLineMiter = 1.0f, + pathFillType = PathFillType.NonZero, + ) { + moveTo(27.8f, 12.8f) + lineTo(27.8f, 12.8f) + curveTo(27.8f, 5f, 27.2f, 0f, 24.4f, 0f) + reflectiveCurveTo(15f, 0f, 15f, 0f) + reflectiveCurveTo(8.4f, 0f, 5.6f, 0f) + curveTo(2.8f, 0f, 2.2f, 5f, 2.2f, 12.8f) + verticalLineToRelative(0f) + lineToRelative(0f, 0f) + curveToRelative(0f, 0f, 0f, 0f, 0f, 0f) + curveTo(2.2f, 24.9f, 15f, 30f, 15f, 30f) + reflectiveCurveTo(27.8f, 24.9f, 27.8f, 12.8f) + curveTo(27.8f, 12.8f, 27.8f, 12.8f, 27.8f, 12.8f) + lineTo(27.8f, 12.8f) + close() + } + path( + fill = SolidColor(Color(0xFFFFFFFF)), + fillAlpha = 1.0f, + stroke = SolidColor(Color(0xFF7F2EFF)), + strokeAlpha = 1.0f, + strokeLineWidth = 0.5f, + strokeLineCap = StrokeCap.Butt, + strokeLineJoin = StrokeJoin.Miter, + strokeLineMiter = 1.0f, + pathFillType = PathFillType.NonZero, + ) { + moveTo(15.1f, 24f) + lineToRelative(-0.5f, -0.2f) + curveToRelative(-0.2f, -0.1f, -4.5f, -2f, -6.8f, -6.4f) + curveToRelative(-0.3f, -0.6f, -0.1f, -1.4f, 0.6f, -1.7f) + curveToRelative(0.6f, -0.3f, 1.4f, -0.1f, 1.7f, 0.6f) + curveToRelative(1.4f, 2.8f, 3.9f, 4.4f, 5f, 4.9f) + curveToRelative(1.1f, -0.6f, 3.6f, -2.2f, 5f, -4.9f) + curveToRelative(0.3f, -0.6f, 1.1f, -0.9f, 1.7f, -0.6f) + curveToRelative(0.6f, 0.3f, 0.9f, 1.1f, 0.6f, 1.7f) + curveToRelative(-2.2f, 4.4f, -6.6f, 6.3f, -6.8f, 6.4f) + lineTo(15.1f, 24f) + close() + } + path( + fill = SolidColor(Color(0xFFFFFFFF)), + fillAlpha = 1.0f, + stroke = SolidColor(Color(0xFF7F2EFF)), + strokeAlpha = 1.0f, + strokeLineWidth = 0.5f, + strokeLineCap = StrokeCap.Butt, + strokeLineJoin = StrokeJoin.Miter, + strokeLineMiter = 1.0f, + pathFillType = PathFillType.NonZero, + ) { + moveTo(15f, 15f) + curveToRelative(-2.9f, 0f, -5.2f, -2.3f, -5.2f, -5.2f) + reflectiveCurveToRelative(2.3f, -5.2f, 5.2f, -5.2f) + reflectiveCurveToRelative(5.2f, 2.3f, 5.2f, 5.2f) + reflectiveCurveTo(17.8f, 15f, 15f, 15f) + close() + moveTo(15f, 7.2f) + curveToRelative(-1.4f, 0f, -2.6f, 1.2f, -2.6f, 2.6f) + reflectiveCurveToRelative(1.2f, 2.6f, 2.6f, 2.6f) + reflectiveCurveToRelative(2.6f, -1.2f, 2.6f, -2.6f) + reflectiveCurveTo(16.4f, 7.2f, 15f, 7.2f) + close() + } + }.build() + + return labelsFollowing!! + }