Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ import to.bitkit.ui.theme.AppThemeSurface
import to.bitkit.ui.theme.Colors
import to.bitkit.ui.utils.withAccent

private const val LAST_PAGE_INDEX = 3

@Composable
fun OnboardingSlidesScreen(
currentTab: Int = 0,
Expand Down Expand Up @@ -90,31 +92,23 @@ fun OnboardingSlidesScreen(
)

2 -> OnboardingTab(
imageResId = R.drawable.spark,
title = stringResource(R.string.onboarding__slide2_header),
titleAccentColor = Colors.Yellow,
text = stringResource(R.string.onboarding__slide2_text),
modifier = Modifier.testTag("Slide2")
)

3 -> OnboardingTab(
imageResId = R.drawable.shield,
title = stringResource(R.string.onboarding__slide3_header),
titleAccentColor = Colors.Green,
text = stringResource(R.string.onboarding__slide3_text),
modifier = Modifier.testTag("Slide3")
modifier = Modifier.testTag("Slide2")
)

4 -> CreateWalletScreen(
LAST_PAGE_INDEX -> CreateWalletScreen(
onCreateClick = onCreateClick,
onRestoreClick = onRestoreClick,
modifier = Modifier.testTag("Slide4")
modifier = Modifier.testTag("Slide$LAST_PAGE_INDEX")
)
}
}

// Dots indicator
val isIndicatorVisible = pagerState.currentPage != 4
val isIndicatorVisible = pagerState.currentPage != LAST_PAGE_INDEX
val yOffset by animateDpAsState(
targetValue = if (isIndicatorVisible) 0.dp else 20.dp,
animationSpec = tween(durationMillis = 300),
Expand All @@ -135,7 +129,7 @@ fun OnboardingSlidesScreen(
.offset { IntOffset(0, yOffset.roundToPx()) }
.alpha(alpha)
) {
repeat(5) { index ->
repeat(LAST_PAGE_INDEX + 1) { index ->
val size by animateDpAsState(
targetValue = if (index == pagerState.currentPage) 10.dp else 7.dp,
animationSpec = tween(durationMillis = 300),
Expand All @@ -157,7 +151,7 @@ fun OnboardingSlidesScreen(
onBackClick = null,
titleText = null,
actions = {
if (pagerState.currentPage == 4) {
if (pagerState.currentPage == LAST_PAGE_INDEX) {
TextButton(
onClick = onAdvancedSetupClick,
modifier = Modifier.testTag("Passphrase")
Expand Down Expand Up @@ -276,7 +270,7 @@ private fun OnboardingViewPreview3() {
private fun OnboardingViewPreview4() {
AppThemeSurface {
OnboardingSlidesScreen(
currentTab = 4,
currentTab = LAST_PAGE_INDEX,
onAdvancedSetupClick = {},
onCreateClick = {},
onRestoreClick = {},
Expand Down
Loading