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 11db3728e..54fe2c103 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 @@ -34,6 +34,7 @@ import androidx.compose.animation.slideInVertically import androidx.compose.animation.slideOutVertically import androidx.compose.animation.togetherWith import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.clickable import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Arrangement @@ -51,7 +52,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.IconButton import androidx.compose.material3.LinearProgressIndicator import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ProgressIndicatorDefaults @@ -215,7 +215,7 @@ fun ShareReaction( ) { val context = LocalContext.current - IconButton( + ClickableBox( modifier = barChartModifier, onClick = { val sendIntent = @@ -412,7 +412,7 @@ private fun RenderShowIndividualReactionsButton( wantsToSeeReactions: MutableState, accountViewModel: AccountViewModel, ) { - IconButton( + ClickableBox( onClick = { wantsToSeeReactions.value = !wantsToSeeReactions.value }, modifier = Size20Modifier, ) { @@ -609,6 +609,24 @@ private fun ReplyReactionWithDialog( ReplyReaction(baseNote, grayTint, accountViewModel) { wantsToReplyTo = baseNote } } +@Composable +fun ClickableBox( + modifier: Modifier, + onClick: () -> Unit, + content: @Composable () -> Unit, +) { + Box( + modifier.clickable( + role = Role.Button, + interactionSource = remember { MutableInteractionSource() }, + indication = rememberRipple(bounded = false, radius = Size24dp), + onClick = onClick, + ), + ) { + content() + } +} + @Composable fun ReplyReaction( baseNote: Note, @@ -618,7 +636,7 @@ fun ReplyReaction( iconSizeModifier: Modifier = Size19Modifier, onPress: () -> Unit, ) { - IconButton( + ClickableBox( modifier = iconSizeModifier, onClick = { if (baseNote.isDraft()) { @@ -626,15 +644,15 @@ fun ReplyReaction( R.string.draft_note, R.string.it_s_not_possible_to_reply_to_a_draft_note, ) - return@IconButton - } - if (accountViewModel.isWriteable()) { - onPress() } else { - accountViewModel.toast( - R.string.read_only_user, - R.string.login_with_a_private_key_to_be_able_to_reply, - ) + if (accountViewModel.isWriteable()) { + onPress() + } else { + accountViewModel.toast( + R.string.read_only_user, + R.string.login_with_a_private_key_to_be_able_to_reply, + ) + } } }, ) { @@ -747,9 +765,11 @@ fun BoostReaction( ) { var wantsToBoost by remember { mutableStateOf(false) } - IconButton( + ClickableBox( modifier = iconSizeModifier, - onClick = { accountViewModel.tryBoost(baseNote) { wantsToBoost = true } }, + onClick = { + accountViewModel.tryBoost(baseNote) { wantsToBoost = true } + }, ) { ObserveBoostIcon(baseNote, accountViewModel) { hasBoosted -> RepostedIcon(iconSizeModifier, if (hasBoosted) Color.Unspecified else grayTint) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayListRow.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayListRow.kt index 4dd5231a9..e7cccd1bd 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayListRow.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayListRow.kt @@ -27,7 +27,6 @@ import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ChevronRight import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -88,7 +87,7 @@ fun ShouldShowExpandButton( @Composable fun ChatRelayExpandButton(onClick: () -> Unit) { - IconButton( + ClickableBox( modifier = Size15Modifier, onClick = onClick, ) {