mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 02:25:19 +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)) {
|
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||||
Row {
|
Row {
|
||||||
CarouselPrevButton(
|
CarouselPrevButton(pagerState)
|
||||||
pagerState,
|
|
||||||
modifier = Modifier.align(Alignment.CenterVertically)
|
|
||||||
)
|
|
||||||
Box(modifier = Modifier.weight(1f)) {
|
Box(modifier = Modifier.weight(1f)) {
|
||||||
CellNoMargin {
|
CellNoMargin {
|
||||||
HorizontalPager(state = pagerState) { i ->
|
HorizontalPager(state = pagerState) { i ->
|
||||||
@ -399,10 +396,7 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CarouselNextButton(
|
CarouselNextButton(pagerState)
|
||||||
pagerState,
|
|
||||||
modifier = Modifier.align(Alignment.CenterVertically)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
FileDetails(attachments, pagerState)
|
FileDetails(attachments, pagerState)
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.ui
|
|||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.RowScope
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
@ -108,24 +109,23 @@ fun SessionHorizontalPagerIndicator(modifier: Modifier, pagerState: PagerState,
|
|||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun CarouselPrevButton(pagerState: PagerState, modifier: Modifier = Modifier) {
|
fun RowScope.CarouselPrevButton(pagerState: PagerState) {
|
||||||
CarouselButton(pagerState, pagerState.canScrollBackward, R.drawable.ic_prev, -1, modifier)
|
CarouselButton(pagerState, pagerState.canScrollBackward, R.drawable.ic_prev, -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun CarouselNextButton(pagerState: PagerState, modifier: Modifier = Modifier) {
|
fun RowScope.CarouselNextButton(pagerState: PagerState) {
|
||||||
CarouselButton(pagerState, pagerState.canScrollForward, R.drawable.ic_next, 1, modifier)
|
CarouselButton(pagerState, pagerState.canScrollForward, R.drawable.ic_next, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun CarouselButton(
|
fun RowScope.CarouselButton(
|
||||||
pagerState: PagerState,
|
pagerState: PagerState,
|
||||||
enabled: Boolean,
|
enabled: Boolean,
|
||||||
@DrawableRes id: Int,
|
@DrawableRes id: Int,
|
||||||
delta: Int,
|
delta: Int
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
if (pagerState.pageCount <= 1) Spacer(modifier = Modifier.width(32.dp))
|
if (pagerState.pageCount <= 1) Spacer(modifier = Modifier.width(32.dp))
|
||||||
else {
|
else {
|
||||||
@ -133,7 +133,7 @@ fun CarouselButton(
|
|||||||
IconButton(
|
IconButton(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.width(40.dp)
|
.width(40.dp)
|
||||||
.then(modifier),
|
.align(Alignment.CenterVertically),
|
||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
onClick = { animationScope.launch { pagerState.animateScrollToPage(pagerState.currentPage + delta) } }) {
|
onClick = { animationScope.launch { pagerState.animateScrollToPage(pagerState.currentPage + delta) } }) {
|
||||||
Icon(
|
Icon(
|
||||||
|
Loading…
Reference in New Issue
Block a user