Switches Social Icons to faster SVG versions
@ -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 <T> CrossfadeIfEnabled(
|
||||
content: @Composable (T) -> Unit,
|
||||
) {
|
||||
if (accountViewModel.settings.featureSet == FeatureSetType.PERFORMANCE) {
|
||||
content(targetState)
|
||||
Box(modifier) {
|
||||
content(targetState)
|
||||
}
|
||||
} else {
|
||||
Crossfade(targetState, modifier, animationSpec, label, content)
|
||||
}
|
||||
|
@ -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(
|
||||
|
@ -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<String, Note?> = 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<Note>,
|
||||
account: Account,
|
||||
): Set<Note> {
|
||||
return newItems
|
||||
}
|
||||
): Set<Note> = newItems
|
||||
|
||||
open fun filterMore(
|
||||
newItems: List<Note>,
|
||||
account: Account,
|
||||
): List<Note> {
|
||||
return newItems
|
||||
}
|
||||
): List<Note> = newItems
|
||||
}
|
||||
|
||||
object HomeLatestItem : LatestItem() {
|
||||
@ -382,16 +375,12 @@ object MessagesLatestItem : LatestItem() {
|
||||
override fun filterMore(
|
||||
newItems: Set<Note>,
|
||||
account: Account,
|
||||
): Set<Note> {
|
||||
return newItems.filter { isNew(it, account) }.toSet()
|
||||
}
|
||||
): Set<Note> = newItems.filter { isNew(it, account) }.toSet()
|
||||
|
||||
override fun filterMore(
|
||||
newItems: List<Note>,
|
||||
account: Account,
|
||||
): List<Note> {
|
||||
return newItems.filter { isNew(it, account) }
|
||||
}
|
||||
): List<Note> = 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<NavBackStackEntry?>): String? {
|
||||
return navState.value?.let { getRouteWithArguments(it.destination, it.arguments) }
|
||||
}
|
||||
fun getRouteWithArguments(navState: State<NavBackStackEntry?>): String? = navState.value?.let { getRouteWithArguments(it.destination, it.arguments) }
|
||||
|
||||
private fun getRouteWithArguments(
|
||||
destination: NavDestination,
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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<String>())
|
||||
|
||||
@ -103,9 +103,7 @@ class UpdateReactionTypeViewModel(val account: Account) : ViewModel() {
|
||||
this.reactionSet = account.reactionChoices
|
||||
}
|
||||
|
||||
fun toListOfChoices(commaSeparatedAmounts: String): List<Long> {
|
||||
return commaSeparatedAmounts.split(",").map { it.trim().toLongOrNull() ?: 0 }
|
||||
}
|
||||
fun toListOfChoices(commaSeparatedAmounts: String): List<Long> = 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 <UpdateReactionTypeViewModel : ViewModel> create(modelClass: Class<UpdateReactionTypeViewModel>): UpdateReactionTypeViewModel {
|
||||
return UpdateReactionTypeViewModel(account) as UpdateReactionTypeViewModel
|
||||
}
|
||||
class Factory(
|
||||
val account: Account,
|
||||
) : ViewModelProvider.Factory {
|
||||
override fun <UpdateReactionTypeViewModel : ViewModel> create(modelClass: Class<UpdateReactionTypeViewModel>): 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,
|
||||
|
@ -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<Map<String, Int>>(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 <UserReactionsViewModel : ViewModel> create(modelClass: Class<UserReactionsViewModel>): UserReactionsViewModel {
|
||||
return UserReactionsViewModel(account) as UserReactionsViewModel
|
||||
}
|
||||
class Factory(
|
||||
val account: Account,
|
||||
) : ViewModelProvider.Factory {
|
||||
override fun <UserReactionsViewModel : ViewModel> create(modelClass: Class<UserReactionsViewModel>): UserReactionsViewModel = UserReactionsViewModel(account) as UserReactionsViewModel
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 839 B |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 3.2 KiB |
@ -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 }
|
@ -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 }
|
@ -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 }
|
@ -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 }
|
@ -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 }
|
@ -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 }
|
@ -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 }
|
@ -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 }
|
@ -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()
|