mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-17 21:47:28 +00:00
Cleanup CarouselButton
This commit is contained in:
parent
26aed783e8
commit
f82ed7718d
@ -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)
|
||||
}
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user