From cff6ee457d02b6fe4d5a76f61ee9858bc7cea74f Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 17 Oct 2024 14:18:40 -0400 Subject: [PATCH] Fixes zapraiser progress bar --- .../amethyst/ui/note/ReactionsRow.kt | 28 +++++++------------ .../vitorpamplona/amethyst/ui/theme/Color.kt | 3 ++ .../vitorpamplona/amethyst/ui/theme/Shape.kt | 3 ++ .../vitorpamplona/amethyst/ui/theme/Theme.kt | 3 ++ 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt index 9a9fd900d..3857ae8db 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt @@ -48,7 +48,6 @@ import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size @@ -81,6 +80,7 @@ import androidx.compose.ui.Alignment.Companion.CenterStart import androidx.compose.ui.Alignment.Companion.CenterVertically import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.StrokeCap import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.semantics.Role @@ -116,10 +116,11 @@ import com.vitorpamplona.amethyst.ui.note.types.RenderReaction import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.ButtonBorder -import com.vitorpamplona.amethyst.ui.theme.DarkerGreen import com.vitorpamplona.amethyst.ui.theme.Font14SP import com.vitorpamplona.amethyst.ui.theme.HalfDoubleVertSpacer import com.vitorpamplona.amethyst.ui.theme.HalfPadding +import com.vitorpamplona.amethyst.ui.theme.Height24dpFilledModifier +import com.vitorpamplona.amethyst.ui.theme.Height4dpFilledModifier import com.vitorpamplona.amethyst.ui.theme.ModifierWidth3dp import com.vitorpamplona.amethyst.ui.theme.NoSoTinyBorders import com.vitorpamplona.amethyst.ui.theme.ReactionRowExpandButton @@ -141,7 +142,7 @@ import com.vitorpamplona.amethyst.ui.theme.TinyBorders import com.vitorpamplona.amethyst.ui.theme.defaultTweenDuration import com.vitorpamplona.amethyst.ui.theme.defaultTweenFloatSpec import com.vitorpamplona.amethyst.ui.theme.defaultTweenIntOffsetSpec -import com.vitorpamplona.amethyst.ui.theme.mediumImportanceLink +import com.vitorpamplona.amethyst.ui.theme.fundraiserProgressColor import com.vitorpamplona.amethyst.ui.theme.placeholderText import com.vitorpamplona.amethyst.ui.theme.reactionBox import com.vitorpamplona.amethyst.ui.theme.ripple24dp @@ -348,22 +349,13 @@ fun RenderZapRaiser( } } - val color = - if (zapraiserStatus.progress > 0.99) { - DarkerGreen - } else { - MaterialTheme.colorScheme.mediumImportanceLink - } - LinearProgressIndicator( - modifier = - remember(details) { - Modifier - .fillMaxWidth() - .height(if (details) 24.dp else 4.dp) - }, - color = color, + modifier = if (details) Height24dpFilledModifier else Height4dpFilledModifier, + color = MaterialTheme.colorScheme.fundraiserProgressColor, progress = { zapraiserStatus.progress }, + gapSize = 0.dp, + strokeCap = StrokeCap.Square, + drawStopIndicator = {}, ) if (details) { @@ -380,7 +372,7 @@ fun RenderZapRaiser( text = stringRes(id = R.string.sats_to_complete, totalPercentage, zapraiserStatus.left), modifier = NoSoTinyBorders, - color = MaterialTheme.colorScheme.placeholderText, + // color = MaterialTheme.colorScheme.placeholderText, fontSize = Font14SP, maxLines = 1, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Color.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Color.kt index 44eef1170..fc301a81d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Color.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Color.kt @@ -53,3 +53,6 @@ val DarkWarningColor = Color(0xFFF8DE22) val LightAllGoodColor = Color(0xFF339900) val DarkAllGoodColor = Color(0xFF99cc33) + +val LightFundraiserProgressColor = Color(0xFF3DB601) +val DarkFundraiserProgressColor = Color(0xFF61A229) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt index 0bec3e967..cc5693357 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt @@ -178,6 +178,9 @@ val UserNameMaxRowHeight = Modifier.fillMaxWidth() val Height24dpModifier = Modifier.height(24.dp) val Height4dpModifier = Modifier.height(4.dp) +val Height24dpFilledModifier = Modifier.fillMaxWidth().height(24.dp) +val Height4dpFilledModifier = Modifier.fillMaxWidth().height(4.dp) + val AccountPictureModifier = Modifier.size(55.dp).clip(shape = CircleShape) val HeaderPictureModifier = Modifier.size(34.dp).clip(shape = CircleShape) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Theme.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Theme.kt index d5ec9cbf9..be46269fc 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Theme.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/theme/Theme.kt @@ -397,6 +397,9 @@ val ColorScheme.warningColor: Color val ColorScheme.allGoodColor: Color get() = if (isLight) LightAllGoodColor else DarkAllGoodColor +val ColorScheme.fundraiserProgressColor: Color + get() = if (isLight) LightFundraiserProgressColor else DarkFundraiserProgressColor + val ColorScheme.markdownStyle: RichTextStyle get() = if (isLight) MarkDownStyleOnLight else MarkDownStyleOnDark