diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/CrossfadeIfEnabled.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/CrossfadeIfEnabled.kt index 145dcd44f..c0f20510c 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/CrossfadeIfEnabled.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/CrossfadeIfEnabled.kt @@ -23,6 +23,7 @@ package com.vitorpamplona.amethyst.ui.actions import androidx.compose.animation.Crossfade import androidx.compose.animation.core.FiniteAnimationSpec import androidx.compose.animation.core.tween +import androidx.compose.foundation.layout.Box import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import com.vitorpamplona.amethyst.model.FeatureSetType @@ -38,7 +39,9 @@ fun CrossfadeIfEnabled( content: @Composable (T) -> Unit, ) { if (accountViewModel.settings.featureSet == FeatureSetType.PERFORMANCE) { - content(targetState) + Box(modifier) { + content(targetState) + } } else { Crossfade(targetState, modifier, animationSpec, label, content) } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/layouts/RepostLayout.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/layouts/RepostLayout.kt index 4539b0d8f..bf570842d 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/layouts/RepostLayout.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/layouts/RepostLayout.kt @@ -29,7 +29,7 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import com.vitorpamplona.amethyst.ui.note.RepostedIcon +import com.vitorpamplona.amethyst.ui.note.RepostIcon import com.vitorpamplona.amethyst.ui.theme.Size18Modifier import com.vitorpamplona.amethyst.ui.theme.Size35Modifier import com.vitorpamplona.amethyst.ui.theme.Size55Modifier @@ -55,7 +55,7 @@ fun GenericRepostLayout( Box( remember { Size18Modifier.align(Alignment.BottomStart).padding(1.dp) }, ) { - RepostedIcon(modifier = Size18Modifier, MaterialTheme.colorScheme.placeholderText) + RepostIcon(modifier = Size18Modifier, MaterialTheme.colorScheme.placeholderText) } Box( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/Routes.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/Routes.kt index 5f6361890..fce43bfe8 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/Routes.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/Routes.kt @@ -77,8 +77,7 @@ sealed class Route( nullable = true defaultValue = null }, - ) - .toImmutableList(), + ).toImmutableList(), contentDescriptor = R.string.route_home, hasNewItems = { accountViewModel, newNotes -> HomeLatestItem.hasNewItems(accountViewModel, newNotes) @@ -95,7 +94,7 @@ sealed class Route( object Search : Route( route = "Search", - icon = R.drawable.ic_search, + icon = R.drawable.ic_moments, contentDescriptor = R.string.route_search, ) @@ -212,8 +211,7 @@ sealed class Route( nullable = true defaultValue = null }, - ) - .toImmutableList(), + ).toImmutableList(), ) object RoomByAuthor : @@ -256,9 +254,7 @@ sealed class Route( open class LatestItem { var newestItemPerAccount: Map = mapOf() - fun getNewestItem(account: Account): Note? { - return newestItemPerAccount[account.userProfile().pubkeyHex] - } + fun getNewestItem(account: Account): Note? = newestItemPerAccount[account.userProfile().pubkeyHex] fun clearNewestItem(account: Account) { val userHex = account.userProfile().pubkeyHex @@ -279,9 +275,10 @@ open class LatestItem { if (newestItem == null || !account.isAcceptable(newestItem)) { filterMore(filter.feed(), account).firstOrNull { it.createdAt() != null && account.isAcceptable(it) } } else { - filter.sort( - filterMore(filter.applyFilter(newNotes), account) + newestItem, - ).firstOrNull { it.createdAt() != null && account.isAcceptable(it) } + filter + .sort( + filterMore(filter.applyFilter(newNotes), account) + newestItem, + ).firstOrNull { it.createdAt() != null && account.isAcceptable(it) } } newestItemPerAccount = newestItemPerAccount + Pair(account.userProfile().pubkeyHex, newNewest) @@ -292,16 +289,12 @@ open class LatestItem { open fun filterMore( newItems: Set, account: Account, - ): Set { - return newItems - } + ): Set = newItems open fun filterMore( newItems: List, account: Account, - ): List { - return newItems - } + ): List = newItems } object HomeLatestItem : LatestItem() { @@ -382,16 +375,12 @@ object MessagesLatestItem : LatestItem() { override fun filterMore( newItems: Set, account: Account, - ): Set { - return newItems.filter { isNew(it, account) }.toSet() - } + ): Set = newItems.filter { isNew(it, account) }.toSet() override fun filterMore( newItems: List, account: Account, - ): List { - return newItems.filter { isNew(it, account) } - } + ): List = newItems.filter { isNew(it, account) } } fun getRouteWithArguments(navController: NavHostController): String? { @@ -399,9 +388,7 @@ fun getRouteWithArguments(navController: NavHostController): String? { return getRouteWithArguments(currentEntry.destination, currentEntry.arguments) } -fun getRouteWithArguments(navState: State): String? { - return navState.value?.let { getRouteWithArguments(it.destination, it.arguments) } -} +fun getRouteWithArguments(navState: State): String? = navState.value?.let { getRouteWithArguments(it.destination, it.arguments) } private fun getRouteWithArguments( destination: NavDestination, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomHeaderCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomHeaderCompose.kt index 5c0b685d5..5e736214f 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomHeaderCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomHeaderCompose.kt @@ -137,7 +137,7 @@ private fun ChatroomPrivateMessages( } } - CrossfadeIfEnabled(userRoom, label = "ChatroomPrivateMessages", accountViewModel = accountViewModel) { room -> + CrossfadeIfEnabled(targetState = userRoom, label = "ChatroomPrivateMessages", accountViewModel = accountViewModel) { room -> if (room != null) { UserRoomCompose(baseNote, room, accountViewModel, nav) } else { 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 b193661e0..ccaff8826 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 @@ -29,6 +29,7 @@ import androidx.compose.foundation.layout.width import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.automirrored.filled.OpenInNew +import androidx.compose.material.icons.automirrored.filled.Reply import androidx.compose.material.icons.automirrored.filled.VolumeOff import androidx.compose.material.icons.automirrored.filled.VolumeUp import androidx.compose.material.icons.filled.Bolt @@ -43,8 +44,6 @@ 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.materialIcon -import androidx.compose.material.icons.materialPath import androidx.compose.material.icons.outlined.ArrowForwardIos import androidx.compose.material.icons.outlined.BarChart import androidx.compose.material.icons.outlined.Bolt @@ -56,7 +55,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.graphics.vector.ImageVector import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview @@ -66,7 +64,14 @@ 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.commons.labels.Following +import com.vitorpamplona.amethyst.commons.icons.Following +import com.vitorpamplona.amethyst.commons.icons.Like +import com.vitorpamplona.amethyst.commons.icons.Liked +import com.vitorpamplona.amethyst.commons.icons.Reply +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.ZapSplit import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange import com.vitorpamplona.amethyst.ui.theme.Size18Modifier import com.vitorpamplona.amethyst.ui.theme.Size20Modifier @@ -153,12 +158,15 @@ fun HashCheckFailedIcon(iconSize: Dp) { } @Composable -fun LikedIcon(modifier: Modifier) { +fun LikedIcon( + modifier: Modifier, + tint: Color = Color.Unspecified, +) { Icon( - painter = painterResource(R.drawable.ic_liked), - null, + imageVector = Liked, + stringResource(id = R.string.like_description), modifier = modifier, - tint = Color.Unspecified, + tint = tint, ) } @@ -168,20 +176,33 @@ fun LikeIcon( grayTint: Color, ) { Icon( - painter = painterResource(R.drawable.ic_like), + imageVector = Like, contentDescription = stringResource(id = R.string.like_description), modifier = iconSizeModifier, tint = grayTint, ) } +@Composable +fun RepostIcon( + modifier: Modifier, + tint: Color = Color.Unspecified, +) { + Icon( + imageVector = Repost, + contentDescription = stringResource(id = R.string.boost_or_quote_description), + modifier = modifier, + tint = tint, + ) +} + @Composable fun RepostedIcon( modifier: Modifier, tint: Color = Color.Unspecified, ) { Icon( - painter = painterResource(R.drawable.ic_retweeted), + imageVector = Reposted, contentDescription = stringResource(id = R.string.boost_or_quote_description), modifier = modifier, tint = tint, @@ -305,7 +326,7 @@ fun CommentIcon( tint: Color, ) { Icon( - painter = painterResource(R.drawable.ic_comment), + imageVector = Reply, contentDescription = stringResource(id = R.string.reply_description), modifier = iconSizeModifier, tint = tint, @@ -390,7 +411,7 @@ fun SearchIcon( tint: Color = Color.Unspecified, ) { Icon( - painter = painterResource(R.drawable.ic_search), + imageVector = Search, contentDescription = stringResource(id = R.string.search_button), modifier = modifier, tint = tint, @@ -542,7 +563,7 @@ fun ZapSplitIcon( tint: Color = BitcoinOrange, ) { Icon( - imageVector = ZapSplitVector, + imageVector = ZapSplit, contentDescription = stringResource(id = R.string.zap_split_title), modifier = modifier, tint = tint, @@ -580,38 +601,3 @@ fun ZapSplitPreview() { ZapSplitIcon(tint = BitcoinOrange) } } - -public val ZapSplitVector: ImageVector - get() { - if (zapSplit != null) { - return zapSplit!! - } - zapSplit = - materialIcon(name = "ZapSplit") { - materialPath { - moveTo(7.0f, 21.0f) - horizontalLineToRelative(-1.0f) - lineToRelative(1.0f, -7.0f) - horizontalLineTo(3.5f) - curveToRelative(-0.88f, 0.0f, -0.33f, -0.75f, -0.31f, -0.78f) - curveTo(4.48f, 10.94f, 6.42f, 7.54f, 9.01f, 3.0f) - horizontalLineToRelative(1.0f) - lineToRelative(-1.0f, 7.0f) - horizontalLineToRelative(3.51f) - curveToRelative(0.4f, 0.0f, 0.62f, 0.19f, 0.4f, 0.66f) - curveTo(8.97f, 17.55f, 7.0f, 21.0f, 7.0f, 21.0f) - close() - moveTo(14.59f, 16.59f) - lineTo(19.17f, 12.0f) - lineTo(14.59f, 7.41f) - lineTo(16.0f, 6.0f) - lineToRelative(6.0f, 6.0f) - lineToRelative(-6.0f, 6.0f) - lineToRelative(-1.41f, -1.41f) - close() - } - } - return zapSplit!! - } - -private var zapSplit: ImageVector? = null diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt index 46f899148..4b27dcd23 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt @@ -50,7 +50,6 @@ import androidx.compose.material.ripple.rememberRipple import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.CircularProgressIndicator -import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.LinearProgressIndicator import androidx.compose.material3.MaterialTheme @@ -79,7 +78,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.Role import androidx.compose.ui.text.SpanStyle @@ -120,8 +118,8 @@ import com.vitorpamplona.amethyst.ui.theme.ReactionRowHeightWithPadding import com.vitorpamplona.amethyst.ui.theme.ReactionRowZapraiser import com.vitorpamplona.amethyst.ui.theme.ReactionRowZapraiserWithPadding import com.vitorpamplona.amethyst.ui.theme.RowColSpacing -import com.vitorpamplona.amethyst.ui.theme.Size16Modifier -import com.vitorpamplona.amethyst.ui.theme.Size17Modifier +import com.vitorpamplona.amethyst.ui.theme.Size18Modifier +import com.vitorpamplona.amethyst.ui.theme.Size18dp import com.vitorpamplona.amethyst.ui.theme.Size19Modifier import com.vitorpamplona.amethyst.ui.theme.Size20Modifier import com.vitorpamplona.amethyst.ui.theme.Size20dp @@ -130,7 +128,6 @@ import com.vitorpamplona.amethyst.ui.theme.Size24dp import com.vitorpamplona.amethyst.ui.theme.TinyBorders import com.vitorpamplona.amethyst.ui.theme.mediumImportanceLink import com.vitorpamplona.amethyst.ui.theme.placeholderText -import com.vitorpamplona.amethyst.ui.theme.placeholderTextColorFilter import com.vitorpamplona.quartz.encoders.Nip30CustomEmoji import com.vitorpamplona.quartz.events.BaseTextNoteEvent import kotlinx.collections.immutable.ImmutableList @@ -205,11 +202,11 @@ private fun InnerReactionRow( ZapReaction(baseNote, MaterialTheme.colorScheme.placeholderText, accountViewModel, nav = nav) }, six = { - ViewCountReaction( - note = baseNote, - grayTint = MaterialTheme.colorScheme.placeholderText, - viewCountColorFilter = MaterialTheme.colorScheme.placeholderTextColorFilter, - ) + // ViewCountReaction( + // note = baseNote, + // grayTint = MaterialTheme.colorScheme.placeholderText, + // viewCountColorFilter = MaterialTheme.colorScheme.placeholderTextColorFilter, + // ) }, ) } @@ -585,7 +582,7 @@ fun ReplyReaction( grayTint: Color, accountViewModel: AccountViewModel, showCounter: Boolean = true, - iconSizeModifier: Modifier = Size17Modifier, + iconSizeModifier: Modifier = Size19Modifier, onPress: () -> Unit, ) { IconButton( @@ -710,7 +707,7 @@ fun BoostReaction( baseNote: Note, grayTint: Color, accountViewModel: AccountViewModel, - iconSizeModifier: Modifier = Size20Modifier, + iconSizeModifier: Modifier = Size19Modifier, iconSize: Dp = Size20dp, onQuotePress: () -> Unit, onForkPress: () -> Unit, @@ -787,8 +784,8 @@ fun LikeReaction( grayTint: Color, accountViewModel: AccountViewModel, nav: (String) -> Unit, - iconSize: Dp = Size20dp, - heartSizeModifier: Modifier = Size16Modifier, + iconSize: Dp = Size18dp, + heartSizeModifier: Modifier = Size18Modifier, iconFontSize: TextUnit = Font14SP, ) { var wantsToChangeReactionSymbol by remember { mutableStateOf(false) } @@ -1408,12 +1405,8 @@ private fun ActionableReactionButton( } else { when (reactionType) { "+" -> { - Icon( - painter = painterResource(R.drawable.ic_liked), - null, - modifier = remember { thisModifier.size(16.dp) }, - tint = Color.White, - ) + LikedIcon(modifier = thisModifier.size(16.dp), tint = Color.White) + Text( text = removeSymbol, color = Color.White, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt index 68d1109c8..bc00950ff 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt @@ -42,7 +42,6 @@ import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults -import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Surface @@ -59,7 +58,6 @@ 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.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.input.KeyboardCapitalization @@ -95,7 +93,9 @@ import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.launch -class UpdateReactionTypeViewModel(val account: Account) : ViewModel() { +class UpdateReactionTypeViewModel( + val account: Account, +) : ViewModel() { var nextChoice by mutableStateOf(TextFieldValue("")) var reactionSet by mutableStateOf(listOf()) @@ -103,9 +103,7 @@ class UpdateReactionTypeViewModel(val account: Account) : ViewModel() { this.reactionSet = account.reactionChoices } - fun toListOfChoices(commaSeparatedAmounts: String): List { - return commaSeparatedAmounts.split(",").map { it.trim().toLongOrNull() ?: 0 } - } + fun toListOfChoices(commaSeparatedAmounts: String): List = commaSeparatedAmounts.split(",").map { it.trim().toLongOrNull() ?: 0 } fun addChoice() { val newValue = nextChoice.text.trim().firstFullChar() @@ -131,14 +129,12 @@ class UpdateReactionTypeViewModel(val account: Account) : ViewModel() { nextChoice = TextFieldValue("") } - fun hasChanged(): Boolean { - return reactionSet != account.reactionChoices - } + fun hasChanged(): Boolean = reactionSet != account.reactionChoices - class Factory(val account: Account) : ViewModelProvider.Factory { - override fun create(modelClass: Class): UpdateReactionTypeViewModel { - return UpdateReactionTypeViewModel(account) as UpdateReactionTypeViewModel - } + class Factory( + val account: Account, + ) : ViewModelProvider.Factory { + override fun create(modelClass: Class): UpdateReactionTypeViewModel = UpdateReactionTypeViewModel(account) as UpdateReactionTypeViewModel } } @@ -297,12 +293,8 @@ private fun RenderReactionOption( } else { when (reactionType) { "+" -> { - Icon( - painter = painterResource(R.drawable.ic_liked), - null, - modifier = remember { Modifier.size(16.dp) }, - tint = Color.White, - ) + LikedIcon(modifier = Modifier.size(16.dp), tint = Color.White) + Text( text = " ✖", color = Color.White, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UserReactionsRow.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UserReactionsRow.kt index 8e9692177..81961994c 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UserReactionsRow.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UserReactionsRow.kt @@ -39,7 +39,6 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment.Companion.CenterVertically import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp @@ -93,7 +92,10 @@ fun UserReactionsRow( ) { Row( verticalAlignment = CenterVertically, - modifier = Modifier.clickable(onClick = onClick).padding(10.dp), + modifier = + Modifier + .clickable(onClick = onClick) + .padding(10.dp), ) { Row(verticalAlignment = CenterVertically, modifier = Modifier.width(68.dp)) { Text( @@ -143,12 +145,7 @@ private fun UserZapModel(model: UserReactionsViewModel) { @Composable private fun UserReactionModel(model: UserReactionsViewModel) { - Icon( - painter = painterResource(R.drawable.ic_liked), - null, - modifier = Size20Modifier, - tint = Color.Unspecified, - ) + LikedIcon(modifier = Size20Modifier) Spacer(modifier = StdHorzSpacer) @@ -157,9 +154,7 @@ private fun UserReactionModel(model: UserReactionsViewModel) { @Composable private fun UserBoostModel(model: UserReactionsViewModel) { - Icon( - painter = painterResource(R.drawable.ic_retweeted), - null, + RepostedIcon( modifier = Size24Modifier, tint = Color.Unspecified, ) @@ -171,12 +166,7 @@ private fun UserBoostModel(model: UserReactionsViewModel) { @Composable private fun UserReplyModel(model: UserReactionsViewModel) { - Icon( - painter = painterResource(R.drawable.ic_comment), - null, - modifier = Size20Modifier, - tint = RoyalBlue, - ) + CommentIcon(Size20Modifier, RoyalBlue) Spacer(modifier = StdHorzSpacer) @@ -184,7 +174,9 @@ private fun UserReplyModel(model: UserReactionsViewModel) { } @Stable -class UserReactionsViewModel(val account: Account) : ViewModel() { +class UserReactionsViewModel( + val account: Account, +) : ViewModel() { val user: User = account.userProfile() private var _reactions = MutableStateFlow>(emptyMap()) @@ -213,11 +205,10 @@ class UserReactionsViewModel(val account: Account) : ViewModel() { var shouldShowDecimalsInAxis = false - fun formatDate(createAt: Long): String { - return sdf.format( + fun formatDate(createAt: Long): String = + sdf.format( Instant.ofEpochSecond(createAt).atZone(ZoneId.systemDefault()).toLocalDateTime(), ) - } fun today() = sdf.format(LocalDateTime.now()) @@ -452,10 +443,10 @@ class UserReactionsViewModel(val account: Account) : ViewModel() { super.onCleared() } - class Factory(val account: Account) : ViewModelProvider.Factory { - override fun create(modelClass: Class): UserReactionsViewModel { - return UserReactionsViewModel(account) as UserReactionsViewModel - } + class Factory( + val account: Account, + ) : ViewModelProvider.Factory { + override fun create(modelClass: Class): UserReactionsViewModel = UserReactionsViewModel(account) as UserReactionsViewModel } } diff --git a/app/src/main/res/drawable-hdpi/ic_comment.png b/app/src/main/res/drawable-hdpi/ic_comment.png deleted file mode 100644 index 0ae259d47..000000000 Binary files a/app/src/main/res/drawable-hdpi/ic_comment.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_like.png b/app/src/main/res/drawable-hdpi/ic_like.png deleted file mode 100644 index 1ff6f5772..000000000 Binary files a/app/src/main/res/drawable-hdpi/ic_like.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_liked.png b/app/src/main/res/drawable-hdpi/ic_liked.png deleted file mode 100644 index b5247d64c..000000000 Binary files a/app/src/main/res/drawable-hdpi/ic_liked.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_retweet.png b/app/src/main/res/drawable-hdpi/ic_retweet.png deleted file mode 100644 index 89cb87ed6..000000000 Binary files a/app/src/main/res/drawable-hdpi/ic_retweet.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_retweeted.png b/app/src/main/res/drawable-hdpi/ic_retweeted.png deleted file mode 100644 index c7e2b0abf..000000000 Binary files a/app/src/main/res/drawable-hdpi/ic_retweeted.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_search.png b/app/src/main/res/drawable-hdpi/ic_search.png deleted file mode 100644 index 353391caf..000000000 Binary files a/app/src/main/res/drawable-hdpi/ic_search.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_share.png b/app/src/main/res/drawable-hdpi/ic_share.png deleted file mode 100644 index cd4b166ea..000000000 Binary files a/app/src/main/res/drawable-hdpi/ic_share.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_comment.png b/app/src/main/res/drawable-mdpi/ic_comment.png deleted file mode 100644 index 893bb49f9..000000000 Binary files a/app/src/main/res/drawable-mdpi/ic_comment.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_like.png b/app/src/main/res/drawable-mdpi/ic_like.png deleted file mode 100644 index babf38b7b..000000000 Binary files a/app/src/main/res/drawable-mdpi/ic_like.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_liked.png b/app/src/main/res/drawable-mdpi/ic_liked.png deleted file mode 100644 index 194ff9f95..000000000 Binary files a/app/src/main/res/drawable-mdpi/ic_liked.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_retweet.png b/app/src/main/res/drawable-mdpi/ic_retweet.png deleted file mode 100644 index 0e36ae06c..000000000 Binary files a/app/src/main/res/drawable-mdpi/ic_retweet.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_retweeted.png b/app/src/main/res/drawable-mdpi/ic_retweeted.png deleted file mode 100644 index 39545e500..000000000 Binary files a/app/src/main/res/drawable-mdpi/ic_retweeted.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_search.png b/app/src/main/res/drawable-mdpi/ic_search.png deleted file mode 100644 index 026723273..000000000 Binary files a/app/src/main/res/drawable-mdpi/ic_search.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_share.png b/app/src/main/res/drawable-mdpi/ic_share.png deleted file mode 100644 index f08ff4f53..000000000 Binary files a/app/src/main/res/drawable-mdpi/ic_share.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_comment.png b/app/src/main/res/drawable-xhdpi/ic_comment.png deleted file mode 100644 index 6687355e0..000000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_comment.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_like.png b/app/src/main/res/drawable-xhdpi/ic_like.png deleted file mode 100644 index 89dc58fdc..000000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_like.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_liked.png b/app/src/main/res/drawable-xhdpi/ic_liked.png deleted file mode 100644 index d6f1bb5c4..000000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_liked.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_retweet.png b/app/src/main/res/drawable-xhdpi/ic_retweet.png deleted file mode 100644 index dbcd7480e..000000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_retweet.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_retweeted.png b/app/src/main/res/drawable-xhdpi/ic_retweeted.png deleted file mode 100644 index 2b1222f98..000000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_retweeted.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_search.png b/app/src/main/res/drawable-xhdpi/ic_search.png deleted file mode 100644 index 1da2ab0b4..000000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_search.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_share.png b/app/src/main/res/drawable-xhdpi/ic_share.png deleted file mode 100644 index 97c9b2e95..000000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_share.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_comment.png b/app/src/main/res/drawable-xxhdpi/ic_comment.png deleted file mode 100644 index b73c0d880..000000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_comment.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_like.png b/app/src/main/res/drawable-xxhdpi/ic_like.png deleted file mode 100644 index 0ad7f67cd..000000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_like.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_liked.png b/app/src/main/res/drawable-xxhdpi/ic_liked.png deleted file mode 100644 index ab0b6d881..000000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_liked.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_retweet.png b/app/src/main/res/drawable-xxhdpi/ic_retweet.png deleted file mode 100644 index ec6941727..000000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_retweet.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_retweeted.png b/app/src/main/res/drawable-xxhdpi/ic_retweeted.png deleted file mode 100644 index 5a3025a57..000000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_retweeted.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_search.png b/app/src/main/res/drawable-xxhdpi/ic_search.png deleted file mode 100644 index 1b1018879..000000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_search.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_share.png b/app/src/main/res/drawable-xxhdpi/ic_share.png deleted file mode 100644 index 63728b0ed..000000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_share.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_comment.png b/app/src/main/res/drawable-xxxhdpi/ic_comment.png deleted file mode 100644 index 924df6135..000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_comment.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_like.png b/app/src/main/res/drawable-xxxhdpi/ic_like.png deleted file mode 100644 index 2883a6428..000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_like.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_liked.png b/app/src/main/res/drawable-xxxhdpi/ic_liked.png deleted file mode 100644 index 526a70808..000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_liked.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_retweet.png b/app/src/main/res/drawable-xxxhdpi/ic_retweet.png deleted file mode 100644 index afe333eda..000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_retweet.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_retweeted.png b/app/src/main/res/drawable-xxxhdpi/ic_retweeted.png deleted file mode 100644 index 4306931b2..000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_retweeted.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_search.png b/app/src/main/res/drawable-xxxhdpi/ic_search.png deleted file mode 100644 index 9c50ac7b2..000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_search.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_share.png b/app/src/main/res/drawable-xxxhdpi/ic_share.png deleted file mode 100644 index 1b556d7dd..000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_share.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/icons/Following.kt similarity index 95% rename from commons/src/main/java/com/vitorpamplona/amethyst/commons/labels/Following.kt rename to commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Following.kt index 7ded87dd0..b03622799 100644 --- a/commons/src/main/java/com/vitorpamplona/amethyst/commons/labels/Following.kt +++ b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Following.kt @@ -18,7 +18,7 @@ * 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. */ -package com.vitorpamplona.amethyst.commons.labels +package com.vitorpamplona.amethyst.commons.icons import androidx.compose.foundation.Image import androidx.compose.runtime.Composable @@ -41,12 +41,9 @@ private fun VectorPreview() { private var labelsFollowing: ImageVector? = null public val Following: ImageVector - get() { - if (labelsFollowing != null) { - return labelsFollowing!! - } - labelsFollowing = - ImageVector.Builder( + get() = + labelsFollowing ?: ImageVector + .Builder( name = "Following", defaultWidth = 30.dp, defaultHeight = 30.dp, @@ -128,6 +125,4 @@ public val Following: ImageVector close() } }.build() - - return labelsFollowing!! - } + .also { labelsFollowing = it } diff --git a/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Like.kt b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Like.kt new file mode 100644 index 000000000..3a2e3e693 --- /dev/null +++ b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Like.kt @@ -0,0 +1,82 @@ +/** + * 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. + */ +package com.vitorpamplona.amethyst.commons.icons + +import androidx.compose.foundation.Image +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap.Companion.Butt +import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +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(Like, null) +} + +private var labelsLike: ImageVector? = null + +public val Like: ImageVector + get() = + labelsLike ?: Builder( + name = "Like", + defaultWidth = 24.0.dp, + defaultHeight = 24.0.dp, + viewportWidth = 24.0f, + viewportHeight = 24.0f, + ).apply { + path( + fill = SolidColor(Color(0xFF000000)), + strokeLineWidth = 0.0f, + strokeLineCap = Butt, + strokeLineJoin = Miter, + strokeLineMiter = 4.0f, + pathFillType = NonZero, + ) { + moveTo(12.0f, 21.638f) + horizontalLineToRelative(-0.014f) + curveTo(9.403f, 21.59f, 1.95f, 14.856f, 1.95f, 8.478f) + curveToRelative(0.0f, -3.064f, 2.525f, -5.754f, 5.403f, -5.754f) + curveToRelative(2.29f, 0.0f, 3.83f, 1.58f, 4.646f, 2.73f) + curveToRelative(0.814f, -1.148f, 2.354f, -2.73f, 4.645f, -2.73f) + curveToRelative(2.88f, 0.0f, 5.404f, 2.69f, 5.404f, 5.755f) + curveToRelative(0.0f, 6.376f, -7.454f, 13.11f, -10.037f, 13.157f) + horizontalLineTo(12.0f) + close() + moveTo(7.354f, 4.225f) + curveToRelative(-2.08f, 0.0f, -3.903f, 1.988f, -3.903f, 4.255f) + curveToRelative(0.0f, 5.74f, 7.034f, 11.596f, 8.55f, 11.658f) + curveToRelative(1.518f, -0.062f, 8.55f, -5.917f, 8.55f, -11.658f) + curveToRelative(0.0f, -2.267f, -1.823f, -4.255f, -3.903f, -4.255f) + curveToRelative(-2.528f, 0.0f, -3.94f, 2.936f, -3.952f, 2.965f) + curveToRelative(-0.23f, 0.562f, -1.156f, 0.562f, -1.387f, 0.0f) + curveToRelative(-0.014f, -0.03f, -1.425f, -2.965f, -3.954f, -2.965f) + close() + } + }.build() + .also { labelsLike = it } diff --git a/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Liked.kt b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Liked.kt new file mode 100644 index 000000000..2e58b4cf4 --- /dev/null +++ b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Liked.kt @@ -0,0 +1,73 @@ +/** + * 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. + */ +package com.vitorpamplona.amethyst.commons.icons + +import androidx.compose.foundation.Image +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap.Companion.Butt +import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +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(Liked, null) +} + +private var labelsLiked: ImageVector? = null + +public val Liked: ImageVector + get() = + labelsLiked ?: Builder( + name = "Like", + defaultWidth = 24.0.dp, + defaultHeight = 24.0.dp, + viewportWidth = 24.0f, + viewportHeight = 24.0f, + ).apply { + path( + fill = SolidColor(Color(0xFFCA395f)), + strokeLineWidth = 0.0f, + strokeLineCap = Butt, + strokeLineJoin = Miter, + strokeLineMiter = 4.0f, + pathFillType = NonZero, + ) { + moveTo(12.0f, 21.638f) + horizontalLineToRelative(-0.014f) + curveTo(9.403f, 21.59f, 1.95f, 14.856f, 1.95f, 8.478f) + curveToRelative(0.0f, -3.064f, 2.525f, -5.754f, 5.403f, -5.754f) + curveToRelative(2.29f, 0.0f, 3.83f, 1.58f, 4.646f, 2.73f) + curveToRelative(0.814f, -1.148f, 2.354f, -2.73f, 4.645f, -2.73f) + curveToRelative(2.88f, 0.0f, 5.404f, 2.69f, 5.404f, 5.755f) + curveToRelative(0.0f, 6.376f, -7.454f, 13.11f, -10.037f, 13.157f) + horizontalLineTo(12.0f) + close() + } + }.build() + .also { labelsLiked = it } diff --git a/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Reply.kt b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Reply.kt new file mode 100644 index 000000000..0c5e1adfc --- /dev/null +++ b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Reply.kt @@ -0,0 +1,90 @@ +/** + * 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. + */ +package com.vitorpamplona.amethyst.commons.icons + +import androidx.compose.foundation.Image +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap.Companion.Butt +import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +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(Reply, null) +} + +private var labelsReply: ImageVector? = null + +public val Reply: ImageVector + get() = + labelsReply ?: Builder( + name = "Reply", + defaultWidth = 24.0.dp, + defaultHeight = 24.0.dp, + viewportWidth = 24.0f, + viewportHeight = 24.0f, + ).apply { + path( + fill = SolidColor(Color(0xFF000000)), + stroke = null, + strokeLineWidth = 0.0f, + strokeLineCap = Butt, + strokeLineJoin = Miter, + strokeLineMiter = 4.0f, + pathFillType = NonZero, + ) { + moveTo(14.046f, 2.242f) + lineToRelative(-4.148f, -0.01f) + horizontalLineToRelative(-0.002f) + curveToRelative(-4.374f, 0.0f, -7.8f, 3.427f, -7.8f, 7.802f) + curveToRelative(0.0f, 4.098f, 3.186f, 7.206f, 7.465f, 7.37f) + verticalLineToRelative(3.828f) + curveToRelative(0.0f, 0.108f, 0.044f, 0.286f, 0.12f, 0.403f) + curveToRelative(0.142f, 0.225f, 0.384f, 0.347f, 0.632f, 0.347f) + curveToRelative(0.138f, 0.0f, 0.277f, -0.038f, 0.402f, -0.118f) + curveToRelative(0.264f, -0.168f, 6.473f, -4.14f, 8.088f, -5.506f) + curveToRelative(1.902f, -1.61f, 3.04f, -3.97f, 3.043f, -6.312f) + verticalLineToRelative(-0.017f) + curveToRelative(-0.006f, -4.367f, -3.43f, -7.787f, -7.8f, -7.788f) + close() + moveTo(17.833f, 15.214f) + curveToRelative(-1.134f, 0.96f, -4.862f, 3.405f, -6.772f, 4.643f) + lineTo(11.061f, 16.67f) + curveToRelative(0.0f, -0.414f, -0.335f, -0.75f, -0.75f, -0.75f) + horizontalLineToRelative(-0.396f) + curveToRelative(-3.66f, 0.0f, -6.318f, -2.476f, -6.318f, -5.886f) + curveToRelative(0.0f, -3.534f, 2.768f, -6.302f, 6.3f, -6.302f) + lineToRelative(4.147f, 0.01f) + horizontalLineToRelative(0.002f) + curveToRelative(3.532f, 0.0f, 6.3f, 2.766f, 6.302f, 6.296f) + curveToRelative(-0.003f, 1.91f, -0.942f, 3.844f, -2.514f, 5.176f) + close() + } + }.build() + .also { labelsReply = it } diff --git a/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Repost.kt b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Repost.kt new file mode 100644 index 000000000..d99d4a823 --- /dev/null +++ b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Repost.kt @@ -0,0 +1,104 @@ +/** + * 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. + */ +package com.vitorpamplona.amethyst.commons.icons + +import androidx.compose.foundation.Image +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap.Companion.Butt +import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +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(Repost, null) +} + +private var labelsRepost: ImageVector? = null + +public val Repost: ImageVector + get() = + labelsRepost ?: Builder( + name = "Repost", + defaultWidth = 24.0.dp, + defaultHeight = 24.0.dp, + viewportWidth = 24.0f, + viewportHeight = 24.0f, + ).apply { + path( + fill = SolidColor(Color(0xFF000000)), + stroke = null, + strokeLineWidth = 0.0f, + strokeLineCap = Butt, + strokeLineJoin = Miter, + strokeLineMiter = 4.0f, + pathFillType = NonZero, + ) { + moveTo(23.77f, 15.67f) + curveToRelative(-0.292f, -0.293f, -0.767f, -0.293f, -1.06f, 0.0f) + lineToRelative(-2.22f, 2.22f) + lineTo(20.49f, 7.65f) + curveToRelative(0.0f, -2.068f, -1.683f, -3.75f, -3.75f, -3.75f) + horizontalLineToRelative(-5.85f) + curveToRelative(-0.414f, 0.0f, -0.75f, 0.336f, -0.75f, 0.75f) + reflectiveCurveToRelative(0.336f, 0.75f, 0.75f, 0.75f) + horizontalLineToRelative(5.85f) + curveToRelative(1.24f, 0.0f, 2.25f, 1.01f, 2.25f, 2.25f) + verticalLineToRelative(10.24f) + lineToRelative(-2.22f, -2.22f) + curveToRelative(-0.293f, -0.293f, -0.768f, -0.293f, -1.06f, 0.0f) + reflectiveCurveToRelative(-0.294f, 0.768f, 0.0f, 1.06f) + lineToRelative(3.5f, 3.5f) + curveToRelative(0.145f, 0.147f, 0.337f, 0.22f, 0.53f, 0.22f) + reflectiveCurveToRelative(0.383f, -0.072f, 0.53f, -0.22f) + lineToRelative(3.5f, -3.5f) + curveToRelative(0.294f, -0.292f, 0.294f, -0.767f, 0.0f, -1.06f) + close() + moveTo(13.11f, 18.95f) + lineTo(7.26f, 18.95f) + curveToRelative(-1.24f, 0.0f, -2.25f, -1.01f, -2.25f, -2.25f) + lineTo(5.01f, 6.46f) + lineToRelative(2.22f, 2.22f) + curveToRelative(0.148f, 0.147f, 0.34f, 0.22f, 0.532f, 0.22f) + reflectiveCurveToRelative(0.384f, -0.073f, 0.53f, -0.22f) + curveToRelative(0.293f, -0.293f, 0.293f, -0.768f, 0.0f, -1.06f) + lineToRelative(-3.5f, -3.5f) + curveToRelative(-0.293f, -0.294f, -0.768f, -0.294f, -1.06f, 0.0f) + lineToRelative(-3.5f, 3.5f) + curveToRelative(-0.294f, 0.292f, -0.294f, 0.767f, 0.0f, 1.06f) + reflectiveCurveToRelative(0.767f, 0.293f, 1.06f, 0.0f) + lineToRelative(2.22f, -2.22f) + lineTo(3.512f, 16.7f) + curveToRelative(0.0f, 2.068f, 1.683f, 3.75f, 3.75f, 3.75f) + horizontalLineToRelative(5.85f) + curveToRelative(0.414f, 0.0f, 0.75f, -0.336f, 0.75f, -0.75f) + reflectiveCurveToRelative(-0.337f, -0.75f, -0.75f, -0.75f) + close() + } + }.build() + .also { labelsRepost = it } diff --git a/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Reposted.kt b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Reposted.kt new file mode 100644 index 000000000..28563c104 --- /dev/null +++ b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Reposted.kt @@ -0,0 +1,104 @@ +/** + * 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. + */ +package com.vitorpamplona.amethyst.commons.icons + +import androidx.compose.foundation.Image +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap.Companion.Butt +import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +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(Reposted, null) +} + +private var labelsReposted: ImageVector? = null + +public val Reposted: ImageVector + get() = + labelsReposted ?: Builder( + name = "Repost", + defaultWidth = 24.0.dp, + defaultHeight = 24.0.dp, + viewportWidth = 24.0f, + viewportHeight = 24.0f, + ).apply { + path( + fill = SolidColor(Color(0xFF59bc6d)), + stroke = null, + strokeLineWidth = 0.0f, + strokeLineCap = Butt, + strokeLineJoin = Miter, + strokeLineMiter = 4.0f, + pathFillType = NonZero, + ) { + moveTo(23.77f, 15.67f) + curveToRelative(-0.292f, -0.293f, -0.767f, -0.293f, -1.06f, 0.0f) + lineToRelative(-2.22f, 2.22f) + lineTo(20.49f, 7.65f) + curveToRelative(0.0f, -2.068f, -1.683f, -3.75f, -3.75f, -3.75f) + horizontalLineToRelative(-5.85f) + curveToRelative(-0.414f, 0.0f, -0.75f, 0.336f, -0.75f, 0.75f) + reflectiveCurveToRelative(0.336f, 0.75f, 0.75f, 0.75f) + horizontalLineToRelative(5.85f) + curveToRelative(1.24f, 0.0f, 2.25f, 1.01f, 2.25f, 2.25f) + verticalLineToRelative(10.24f) + lineToRelative(-2.22f, -2.22f) + curveToRelative(-0.293f, -0.293f, -0.768f, -0.293f, -1.06f, 0.0f) + reflectiveCurveToRelative(-0.294f, 0.768f, 0.0f, 1.06f) + lineToRelative(3.5f, 3.5f) + curveToRelative(0.145f, 0.147f, 0.337f, 0.22f, 0.53f, 0.22f) + reflectiveCurveToRelative(0.383f, -0.072f, 0.53f, -0.22f) + lineToRelative(3.5f, -3.5f) + curveToRelative(0.294f, -0.292f, 0.294f, -0.767f, 0.0f, -1.06f) + close() + moveTo(13.11f, 18.95f) + lineTo(7.26f, 18.95f) + curveToRelative(-1.24f, 0.0f, -2.25f, -1.01f, -2.25f, -2.25f) + lineTo(5.01f, 6.46f) + lineToRelative(2.22f, 2.22f) + curveToRelative(0.148f, 0.147f, 0.34f, 0.22f, 0.532f, 0.22f) + reflectiveCurveToRelative(0.384f, -0.073f, 0.53f, -0.22f) + curveToRelative(0.293f, -0.293f, 0.293f, -0.768f, 0.0f, -1.06f) + lineToRelative(-3.5f, -3.5f) + curveToRelative(-0.293f, -0.294f, -0.768f, -0.294f, -1.06f, 0.0f) + lineToRelative(-3.5f, 3.5f) + curveToRelative(-0.294f, 0.292f, -0.294f, 0.767f, 0.0f, 1.06f) + reflectiveCurveToRelative(0.767f, 0.293f, 1.06f, 0.0f) + lineToRelative(2.22f, -2.22f) + lineTo(3.512f, 16.7f) + curveToRelative(0.0f, 2.068f, 1.683f, 3.75f, 3.75f, 3.75f) + horizontalLineToRelative(5.85f) + curveToRelative(0.414f, 0.0f, 0.75f, -0.336f, 0.75f, -0.75f) + reflectiveCurveToRelative(-0.337f, -0.75f, -0.75f, -0.75f) + close() + } + }.build() + .also { labelsReposted = it } diff --git a/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Search.kt b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Search.kt new file mode 100644 index 000000000..f3be659d2 --- /dev/null +++ b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Search.kt @@ -0,0 +1,82 @@ +/** + * 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. + */ +package com.vitorpamplona.amethyst.commons.icons + +import androidx.compose.foundation.Image +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap.Companion.Butt +import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +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(Search, null) +} + +private var labelsSearch: ImageVector? = null + +val Search: ImageVector + get() = + labelsSearch ?: Builder( + name = "Search", + defaultWidth = 24.0.dp, + defaultHeight = 24.0.dp, + viewportWidth = 24.0f, + viewportHeight = 24.0f, + ).apply { + path( + fill = SolidColor(Color(0xFF000000)), + stroke = null, + strokeLineWidth = 0.0f, + strokeLineCap = Butt, + strokeLineJoin = Miter, + strokeLineMiter = 4.0f, + pathFillType = NonZero, + ) { + moveTo(21.53f, 20.47f) + lineToRelative(-3.66f, -3.66f) + curveTo(19.195f, 15.24f, 20.0f, 13.214f, 20.0f, 11.0f) + curveToRelative(0.0f, -4.97f, -4.03f, -9.0f, -9.0f, -9.0f) + reflectiveCurveToRelative(-9.0f, 4.03f, -9.0f, 9.0f) + reflectiveCurveToRelative(4.03f, 9.0f, 9.0f, 9.0f) + curveToRelative(2.215f, 0.0f, 4.24f, -0.804f, 5.808f, -2.13f) + lineToRelative(3.66f, 3.66f) + curveToRelative(0.147f, 0.146f, 0.34f, 0.22f, 0.53f, 0.22f) + reflectiveCurveToRelative(0.385f, -0.073f, 0.53f, -0.22f) + curveToRelative(0.295f, -0.293f, 0.295f, -0.767f, 0.002f, -1.06f) + close() + moveTo(3.5f, 11.0f) + curveToRelative(0.0f, -4.135f, 3.365f, -7.5f, 7.5f, -7.5f) + reflectiveCurveToRelative(7.5f, 3.365f, 7.5f, 7.5f) + reflectiveCurveToRelative(-3.365f, 7.5f, -7.5f, 7.5f) + reflectiveCurveToRelative(-7.5f, -3.365f, -7.5f, -7.5f) + close() + } + }.build() + .also { labelsSearch = it } diff --git a/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Share.kt b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Share.kt new file mode 100644 index 000000000..a4c58913a --- /dev/null +++ b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/Share.kt @@ -0,0 +1,106 @@ +/** + * 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. + */ +package com.vitorpamplona.amethyst.commons.icons + +import androidx.compose.foundation.Image +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap.Companion.Butt +import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +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(Share, null) +} + +private var labelsShare: ImageVector? = null + +val Share: ImageVector + get() = + labelsShare ?: Builder( + name = "Share", + defaultWidth = 24.0.dp, + defaultHeight = 24.0.dp, + viewportWidth = 24.0f, + viewportHeight = 24.0f, + ).apply { + path( + fill = SolidColor(Color(0xFF000000)), + stroke = null, + strokeLineWidth = 0.0f, + strokeLineCap = Butt, + strokeLineJoin = Miter, + strokeLineMiter = 4.0f, + pathFillType = NonZero, + ) { + moveTo(17.53f, 7.47f) + lineToRelative(-5.0f, -5.0f) + curveToRelative(-0.293f, -0.293f, -0.768f, -0.293f, -1.06f, 0.0f) + lineToRelative(-5.0f, 5.0f) + curveToRelative(-0.294f, 0.293f, -0.294f, 0.768f, 0.0f, 1.06f) + reflectiveCurveToRelative(0.767f, 0.294f, 1.06f, 0.0f) + lineToRelative(3.72f, -3.72f) + verticalLineTo(15.0f) + curveToRelative(0.0f, 0.414f, 0.336f, 0.75f, 0.75f, 0.75f) + reflectiveCurveToRelative(0.75f, -0.336f, 0.75f, -0.75f) + verticalLineTo(4.81f) + lineToRelative(3.72f, 3.72f) + curveToRelative(0.146f, 0.147f, 0.338f, 0.22f, 0.53f, 0.22f) + reflectiveCurveToRelative(0.384f, -0.072f, 0.53f, -0.22f) + curveToRelative(0.293f, -0.293f, 0.293f, -0.767f, 0.0f, -1.06f) + close() + } + path( + fill = SolidColor(Color(0xFF000000)), + stroke = null, + strokeLineWidth = 0.0f, + strokeLineCap = Butt, + strokeLineJoin = Miter, + strokeLineMiter = 4.0f, + pathFillType = NonZero, + ) { + moveTo(19.708f, 21.944f) + horizontalLineTo(4.292f) + curveTo(3.028f, 21.944f, 2.0f, 20.916f, 2.0f, 19.652f) + verticalLineTo(14.0f) + curveToRelative(0.0f, -0.414f, 0.336f, -0.75f, 0.75f, -0.75f) + reflectiveCurveToRelative(0.75f, 0.336f, 0.75f, 0.75f) + verticalLineToRelative(5.652f) + curveToRelative(0.0f, 0.437f, 0.355f, 0.792f, 0.792f, 0.792f) + horizontalLineToRelative(15.416f) + curveToRelative(0.437f, 0.0f, 0.792f, -0.355f, 0.792f, -0.792f) + verticalLineTo(14.0f) + curveToRelative(0.0f, -0.414f, 0.336f, -0.75f, 0.75f, -0.75f) + reflectiveCurveToRelative(0.75f, 0.336f, 0.75f, 0.75f) + verticalLineToRelative(5.652f) + curveToRelative(0.0f, 1.264f, -1.028f, 2.292f, -2.292f, 2.292f) + close() + } + }.build() + .also { labelsShare = it } diff --git a/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/ZapSplit.kt b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/ZapSplit.kt new file mode 100644 index 000000000..94e3dd232 --- /dev/null +++ b/commons/src/main/java/com/vitorpamplona/amethyst/commons/icons/ZapSplit.kt @@ -0,0 +1,104 @@ +/** + * 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. + */ +package com.vitorpamplona.amethyst.commons.icons + +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.DefaultFillType +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.PathBuilder +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(ZapSplit, null) +} + +private var zapSplit: ImageVector? = null + +val ZapSplit: ImageVector + get() = + zapSplit ?: materialIcon(name = "ZapSplit") { + materialPath { + moveTo(7.0f, 21.0f) + horizontalLineToRelative(-1.0f) + lineToRelative(1.0f, -7.0f) + horizontalLineTo(3.5f) + curveToRelative(-0.88f, 0.0f, -0.33f, -0.75f, -0.31f, -0.78f) + curveTo(4.48f, 10.94f, 6.42f, 7.54f, 9.01f, 3.0f) + horizontalLineToRelative(1.0f) + lineToRelative(-1.0f, 7.0f) + horizontalLineToRelative(3.51f) + curveToRelative(0.4f, 0.0f, 0.62f, 0.19f, 0.4f, 0.66f) + curveTo(8.97f, 17.55f, 7.0f, 21.0f, 7.0f, 21.0f) + close() + moveTo(14.59f, 16.59f) + lineTo(19.17f, 12.0f) + lineTo(14.59f, 7.41f) + lineTo(16.0f, 6.0f) + lineToRelative(6.0f, 6.0f) + lineToRelative(-6.0f, 6.0f) + lineToRelative(-1.41f, -1.41f) + close() + } + }.also { zapSplit = it } + +inline fun ImageVector.Builder.materialPath( + fillAlpha: Float = 1f, + strokeAlpha: Float = 1f, + pathFillType: PathFillType = DefaultFillType, + pathBuilder: PathBuilder.() -> Unit, +) = path( + fill = SolidColor(Color.Black), + fillAlpha = fillAlpha, + stroke = null, + strokeAlpha = strokeAlpha, + strokeLineWidth = 1f, + strokeLineCap = StrokeCap.Butt, + strokeLineJoin = StrokeJoin.Bevel, + strokeLineMiter = 1f, + pathFillType = pathFillType, + pathBuilder = pathBuilder, +) + +inline fun materialIcon( + name: String, + autoMirror: Boolean = false, + block: ImageVector.Builder.() -> ImageVector.Builder, +): ImageVector = + ImageVector + .Builder( + name = name, + defaultWidth = 24.dp, + defaultHeight = 24.dp, + viewportWidth = 24f, + viewportHeight = 24f, + autoMirror = autoMirror, + ).block() + .build()