diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/MessageDetailActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/MessageDetailActivity.kt index c6d22e423f..0fddfd7ee4 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/MessageDetailActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/MessageDetailActivity.kt @@ -361,10 +361,7 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() { Column(verticalArrangement = Arrangement.spacedBy(16.dp)) { Row { - CarouselPrevButton( - pagerState, - modifier = Modifier.align(Alignment.CenterVertically) - ) + CarouselPrevButton(pagerState) Box(modifier = Modifier.weight(1f)) { CellNoMargin { HorizontalPager(state = pagerState) { i -> @@ -399,10 +396,7 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() { ) } } - CarouselNextButton( - pagerState, - modifier = Modifier.align(Alignment.CenterVertically) - ) + CarouselNextButton(pagerState) } FileDetails(attachments, pagerState) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt index 7cba0fb94b..c7720f2396 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt @@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.ui import androidx.annotation.DrawableRes import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxWidth @@ -108,24 +109,23 @@ fun SessionHorizontalPagerIndicator(modifier: Modifier, pagerState: PagerState, @OptIn(ExperimentalFoundationApi::class) @Composable -fun CarouselPrevButton(pagerState: PagerState, modifier: Modifier = Modifier) { - CarouselButton(pagerState, pagerState.canScrollBackward, R.drawable.ic_prev, -1, modifier) +fun RowScope.CarouselPrevButton(pagerState: PagerState) { + CarouselButton(pagerState, pagerState.canScrollBackward, R.drawable.ic_prev, -1) } @OptIn(ExperimentalFoundationApi::class) @Composable -fun CarouselNextButton(pagerState: PagerState, modifier: Modifier = Modifier) { - CarouselButton(pagerState, pagerState.canScrollForward, R.drawable.ic_next, 1, modifier) +fun RowScope.CarouselNextButton(pagerState: PagerState) { + CarouselButton(pagerState, pagerState.canScrollForward, R.drawable.ic_next, 1) } @OptIn(ExperimentalFoundationApi::class) @Composable -fun CarouselButton( +fun RowScope.CarouselButton( pagerState: PagerState, enabled: Boolean, @DrawableRes id: Int, - delta: Int, - modifier: Modifier = Modifier + delta: Int ) { if (pagerState.pageCount <= 1) Spacer(modifier = Modifier.width(32.dp)) else { @@ -133,7 +133,7 @@ fun CarouselButton( IconButton( modifier = Modifier .width(40.dp) - .then(modifier), + .align(Alignment.CenterVertically), enabled = enabled, onClick = { animationScope.launch { pagerState.animateScrollToPage(pagerState.currentPage + delta) } }) { Icon(