Fixes reaction sizes and alignments.

This commit is contained in:
Vitor Pamplona
2023-06-15 12:21:44 -04:00
parent 72e474c9ec
commit 3116ea1ad9
2 changed files with 15 additions and 6 deletions
@@ -54,6 +54,7 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.Popup import androidx.compose.ui.window.Popup
@@ -441,7 +442,8 @@ fun LikeReaction(
grayTint: Color, grayTint: Color,
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
iconSize: Dp = 20.dp, iconSize: Dp = 20.dp,
heartSize: Dp = 16.dp heartSize: Dp = 16.dp,
iconFontSize: TextUnit = 14.sp
) { ) {
val context = LocalContext.current val context = LocalContext.current
val scope = rememberCoroutineScope() val scope = rememberCoroutineScope()
@@ -455,6 +457,7 @@ fun LikeReaction(
Row( Row(
verticalAlignment = CenterVertically, verticalAlignment = CenterVertically,
horizontalArrangement = Arrangement.Center,
modifier = iconButtonModifier.combinedClickable( modifier = iconButtonModifier.combinedClickable(
role = Role.Button, role = Role.Button,
interactionSource = remember { MutableInteractionSource() }, interactionSource = remember { MutableInteractionSource() },
@@ -475,7 +478,7 @@ fun LikeReaction(
} }
) )
) { ) {
LikeIcon(baseNote, heartSize, grayTint, accountViewModel.userProfile()) LikeIcon(baseNote, iconFontSize, heartSize, grayTint, accountViewModel.userProfile())
if (wantsToChangeReactionSymbol) { if (wantsToChangeReactionSymbol) {
UpdateReactionTypeDialog({ wantsToChangeReactionSymbol = false }, accountViewModel = accountViewModel) UpdateReactionTypeDialog({ wantsToChangeReactionSymbol = false }, accountViewModel = accountViewModel)
@@ -500,7 +503,13 @@ fun LikeReaction(
} }
@Composable @Composable
fun LikeIcon(baseNote: Note, iconSize: Dp = 20.dp, grayTint: Color, loggedIn: User) { fun LikeIcon(
baseNote: Note,
iconFontSize: TextUnit = 14.sp,
iconSize: Dp = 20.dp,
grayTint: Color,
loggedIn: User
) {
val reactionsState by baseNote.live().reactions.observeAsState() val reactionsState by baseNote.live().reactions.observeAsState()
var reactionType by remember(baseNote) { var reactionType by remember(baseNote) {
@@ -530,8 +539,8 @@ fun LikeIcon(baseNote: Note, iconSize: Dp = 20.dp, grayTint: Color, loggedIn: Us
tint = Color.Unspecified tint = Color.Unspecified
) )
} }
"-" -> Text(text = "\uD83D\uDC4E") "-" -> Text(text = "\uD83D\uDC4E", fontSize = iconFontSize)
else -> Text(text = reactionType!!) else -> Text(text = reactionType!!, fontSize = iconFontSize)
} }
} else { } else {
Icon( Icon(
@@ -397,7 +397,7 @@ fun ReactionsColumn(baseNote: Note, accountViewModel: AccountViewModel, nav: (St
BoostReaction(baseNote, accountViewModel, iconSize = 40.dp) { BoostReaction(baseNote, accountViewModel, iconSize = 40.dp) {
wantsToQuote = baseNote wantsToQuote = baseNote
}*/ }*/
LikeReaction(baseNote, grayTint = MaterialTheme.colors.onBackground, accountViewModel, iconSize = 40.dp, heartSize = 35.dp) LikeReaction(baseNote, grayTint = MaterialTheme.colors.onBackground, accountViewModel, iconSize = 40.dp, heartSize = 35.dp, 28.sp)
ZapReaction(baseNote, grayTint = MaterialTheme.colors.onBackground, accountViewModel, iconSize = 40.dp, animationSize = 35.dp) ZapReaction(baseNote, grayTint = MaterialTheme.colors.onBackground, accountViewModel, iconSize = 40.dp, animationSize = 35.dp)
ViewCountReaction(baseNote.idHex, grayTint = MaterialTheme.colors.onBackground, iconSize = 40.dp, barChartSize = 39.dp) ViewCountReaction(baseNote.idHex, grayTint = MaterialTheme.colors.onBackground, iconSize = 40.dp, barChartSize = 39.dp)
} }