Skip to content

Commit c229d55

Browse files
committed
fix: simplify widget size carousel
1 parent d41073d commit c229d55

1 file changed

Lines changed: 14 additions & 25 deletions

File tree

app/src/main/java/to/bitkit/ui/screens/widgets/components/WidgetSizeCarousel.kt

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import androidx.compose.foundation.shape.CircleShape
1414
import androidx.compose.runtime.Composable
1515
import androidx.compose.ui.Alignment
1616
import androidx.compose.ui.Modifier
17-
import androidx.compose.ui.platform.LocalInspectionMode
1817
import androidx.compose.ui.platform.testTag
1918
import androidx.compose.ui.res.stringResource
2019
import androidx.compose.ui.text.style.TextAlign
@@ -24,22 +23,22 @@ import to.bitkit.ui.components.Caption13Up
2423
import to.bitkit.ui.components.VerticalSpacer
2524
import to.bitkit.ui.theme.Colors
2625

27-
private const val PAGE_SMALL = 0
28-
private const val PAGE_WIDE = 1
29-
private const val PAGE_COUNT = 2
30-
private const val RELEASE_PAGE_COUNT = 1
26+
private const val PAGE_WIDE = 0
27+
private const val PAGE_SMALL = 1
28+
29+
// temporarily removed until small size widgets variants are implemented
30+
private const val PAGE_COUNT = 1
31+
// private const val PAGE_COUNT = 2
3132

3233
@Composable
34+
@Suppress("UnusedParameter")
3335
fun WidgetSizeCarousel(
3436
smallContent: @Composable () -> Unit,
3537
wideContent: @Composable () -> Unit,
3638
modifier: Modifier = Modifier,
3739
) {
38-
val isPreview = LocalInspectionMode.current
3940
val pagerState = rememberPagerState(
40-
pageCount = {
41-
if (isPreview) PAGE_COUNT else RELEASE_PAGE_COUNT
42-
},
41+
pageCount = { PAGE_COUNT },
4342
)
4443

4544
Column(
@@ -58,18 +57,9 @@ fun WidgetSizeCarousel(
5857
modifier = Modifier.fillMaxWidth()
5958
) {
6059
when (page) {
61-
PAGE_SMALL -> {
62-
if (isPreview) {
63-
smallContent()
64-
} else {
65-
// temporarily removed until small size widgets variants are implemented
66-
/*
67-
smallContent()
68-
*/
69-
wideContent()
70-
}
71-
}
7260
PAGE_WIDE -> wideContent()
61+
// temporarily removed until small size widgets variants are implemented
62+
// PAGE_SMALL -> smallContent()
7363
}
7464
}
7565
}
@@ -78,10 +68,9 @@ fun WidgetSizeCarousel(
7868

7969
Caption13Up(
8070
text = stringResource(
81-
if (isPreview && pagerState.currentPage == PAGE_SMALL) {
82-
R.string.widgets__widget__size_small
83-
} else {
84-
R.string.widgets__widget__size_wide
71+
when (pagerState.currentPage) {
72+
PAGE_SMALL -> R.string.widgets__widget__size_small
73+
else -> R.string.widgets__widget__size_wide
8574
},
8675
),
8776
color = Colors.White64,
@@ -93,7 +82,7 @@ fun WidgetSizeCarousel(
9382

9483
VerticalSpacer(16.dp)
9584

96-
if (isPreview) {
85+
if (PAGE_COUNT > 1) {
9786
Row(
9887
horizontalArrangement = Arrangement.Center,
9988
modifier = Modifier

0 commit comments

Comments
 (0)