Moves the Following Vector to a native composable.

pull/819/head
Vitor Pamplona 2024-03-25 16:41:38 -04:00
rodzic 1f60d39cbf
commit 38e701a363
7 zmienionych plików z 151 dodań i 39 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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,

Wyświetl plik

@ -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,

Wyświetl plik

@ -1,19 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#FF000000"
android:pathData="m480,190.27c-60.64,0 -115.3,16.8 -162.53,49.12l36.21,36.52c37.13,-23.2 80.03,-35.1 126.94,-35.1 66.3,0 122.62,23.21 168.98,69.61 46.37,46.4 69.57,102.76 69.57,169.06 0,47.69 -16.31,88.53 -40.31,126.09l36.29,36.64c28.23,-40.58 48.88,-84.84 53.2,-136.95L917.19,505.27v-50.55L768.36,454.73C762.19,380.26 731.62,317.56 676.64,266.64 621.67,215.72 556.12,190.27 480,190.27ZM282.81,267.38c-54.53,50.8 -85.03,113.2 -91.17,187.34L42.81,454.73v50.55h148.83c6.17,74.46 36.74,137.17 91.72,188.09 54.98,50.92 120.52,76.37 196.64,76.37 76.12,0 141.67,-25.45 196.64,-76.37 5.56,-5.15 7.91,-11.84 12.97,-17.23l-34.77,-34.92c-2.23,2.42 -2.92,5.48 -5.27,7.85 -46.4,46.73 -102.76,70.12 -169.06,70.12 -66.3,0 -122.84,-23.39 -169.57,-70.16 -46.73,-46.77 -70.12,-103.34 -70.12,-169.65 0,-66.3 23.39,-122.62 70.16,-168.98 2.64,-2.62 6.05,-3.43 8.75,-5.9zM479.57,288.4c-23.2,0 -42.85,8.47 -58.91,25.43 -5.41,5.71 -8.56,12.32 -12.15,18.75l25.59,25.86c2.44,-7.74 2.96,-16.25 8.87,-22.58 10.05,-10.77 22.37,-16.17 36.95,-16.17 14.58,0 26.92,5.4 37.03,16.17 10.11,10.77 15.16,23.58 15.16,38.44v42.7h-40l115.2,116.33v-75.7c0,-11.45 -3.89,-21.1 -11.68,-28.91 -7.79,-7.81 -17.43,-11.72 -28.95,-11.72h-3.28v-41.41c0,-23.54 -7.99,-43.96 -23.98,-61.25 -15.99,-17.29 -35.94,-25.94 -59.84,-25.94zM396.6,381.72v35.27h-3.28c-11.56,0 -21.13,3.89 -28.75,11.64 -7.62,7.75 -11.45,17.34 -11.45,28.79v128.95c0,11.45 3.87,21.03 11.56,28.71 7.7,7.68 17.3,11.52 28.83,11.52h173.01c11.53,0 21.2,-3.83 29.02,-11.45 6.49,-6.32 8.66,-14.76 9.77,-23.71L431.68,416.99h-3.79v-3.83zM480,489.41c9.09,0 16.77,3.18 23.09,9.49 6.31,6.31 9.49,14 9.49,23.09 0,9.09 -3.18,16.81 -9.49,23.13 -6.31,6.31 -14,9.45 -23.09,9.45 -9.09,0 -16.77,-3.14 -23.09,-9.45 -6.31,-6.31 -9.49,-14.04 -9.49,-23.13 0,-9.09 3.18,-16.77 9.49,-23.09 6.31,-6.31 14,-9.49 23.09,-9.49z"
android:strokeWidth="1.11437"/>
<path
android:pathData="m130.61,152.81 l657.62,662.75"
android:strokeWidth="57.2302"
android:fillColor="#000000"
android:strokeColor="#000000"/>
<path
android:pathData="m103.8,46.95 l792.46,796.27"
android:strokeWidth="57.2302"
android:fillColor="#ffffff"/>
</vector>

Wyświetl plik

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#FF000000"
android:pathData="m480,769.74q-114.18,0 -196.64,-76.38 -82.46,-76.38 -91.72,-188.07L42.82,505.29v-50.57L191.64,454.71q9.26,-111.69 91.72,-188.07 82.46,-76.38 196.64,-76.38 114.18,0 196.64,76.38 82.46,76.38 91.72,188.07h148.81v50.57L768.36,505.29q-9.26,111.69 -91.72,188.07 -82.46,76.38 -196.64,76.38zM480.49,719.16q99.46,0 169.06,-70.1 69.6,-70.1 69.6,-169.56 0,-99.46 -69.55,-169.06 -69.55,-69.6 -169,-69.6 -99.46,0 -169.61,69.55 -70.16,69.55 -70.16,169 0,99.46 70.1,169.61 70.1,70.16 169.56,70.16zM393.51,626.58h173.03q17.29,0 29.02,-11.42 11.73,-11.42 11.73,-28.6v-128.96q0,-17.18 -11.68,-28.89 -11.68,-11.71 -28.95,-11.71h-3.26v-41.4q0,-35.3 -23.99,-61.24 -23.99,-25.94 -59.85,-25.94 -34.8,0 -58.89,25.43 -24.09,25.43 -24.09,60.46v42.69h-3.26q-17.33,0 -28.77,11.62 -11.43,11.62 -11.43,28.8v128.96q0,17.18 11.54,28.7 11.54,11.52 28.84,11.52zM480,554.58q-13.63,0 -23.1,-9.47 -9.47,-9.47 -9.47,-23.1 0,-13.63 9.47,-23.1 9.47,-9.47 23.1,-9.47 13.63,0 23.1,9.47 9.47,9.47 9.47,23.1 0,13.63 -9.47,23.1 -9.47,9.47 -23.1,9.47zM427.88,416.99v-42.69q0,-22.29 15.08,-38.45 15.08,-16.16 36.95,-16.16 21.88,0 37.04,16.16 15.17,16.16 15.17,38.45v42.69zM480,522z"
android:strokeWidth="1.11437"/>
</vector>

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 3.0 KiB

Wyświetl plik

@ -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!!
}