@@ -46,10 +46,12 @@ fun PreviewAutoConnectCarousel() {
46
46
AppTheme { AutoConnectCarousel () }
47
47
}
48
48
49
+ private const val CAROUSEL_PAGE_SIZE = 3
50
+
49
51
@OptIn(ExperimentalFoundationApi ::class )
50
52
@Composable
51
53
fun AutoConnectCarousel () {
52
- val pagerState = rememberPagerState(pageCount = { 3 })
54
+ val pagerState = rememberPagerState(pageCount = { CAROUSEL_PAGE_SIZE })
53
55
HorizontalPager (state = pagerState, modifier = Modifier .fillMaxSize()) { page ->
54
56
val scope = rememberCoroutineScope()
55
57
ConstraintLayout (
@@ -70,14 +72,16 @@ fun AutoConnectCarousel() {
70
72
end.linkTo(parent.end)
71
73
bottom.linkTo(imageRef.top)
72
74
},
75
+ style = MaterialTheme .typography.labelMedium,
76
+ color = MaterialTheme .colorScheme.onSecondary,
73
77
text =
74
78
HtmlCompat .fromHtml(
75
79
stringResource(
76
80
id =
77
81
when (page) {
78
- 0 -> R .string.carousel_slide_1_text_1
79
- 1 -> R .string.carousel_slide_2_text_1
80
- else -> R .string.carousel_slide_3_text_1
82
+ 0 -> R .string.auto_connect_carousel_first_slide_top_text
83
+ 1 -> R .string.auto_connect_carousel_second_slide_top_text
84
+ else -> R .string.auto_connect_carousel_third_slide_top_text
81
85
}
82
86
),
83
87
HtmlCompat .FROM_HTML_MODE_COMPACT
@@ -86,7 +90,7 @@ fun AutoConnectCarousel() {
86
90
boldSpanStyle =
87
91
SpanStyle (
88
92
fontWeight = FontWeight .ExtraBold ,
89
- color = MaterialTheme .colorScheme.onSecondary
93
+ color = MaterialTheme .colorScheme.onPrimary
90
94
)
91
95
)
92
96
)
@@ -129,7 +133,7 @@ fun AutoConnectCarousel() {
129
133
contentDescription = null ,
130
134
)
131
135
132
- if (page != 2 ) {
136
+ if (page < CAROUSEL_PAGE_SIZE ) {
133
137
IconButton (
134
138
modifier =
135
139
Modifier .constrainAs(nextButtonRef) {
@@ -156,14 +160,17 @@ fun AutoConnectCarousel() {
156
160
end.linkTo(parent.end)
157
161
start.linkTo(parent.start)
158
162
},
163
+ style = MaterialTheme .typography.labelMedium,
164
+ color = MaterialTheme .colorScheme.onSecondary,
159
165
text =
160
166
HtmlCompat .fromHtml(
161
167
stringResource(
162
168
id =
163
169
when (page) {
164
- 0 -> R .string.carousel_slide_1_text_2
165
- 1 -> R .string.carousel_slide_2_text_2
166
- else -> R .string.carousel_slide_3_text_2
170
+ 0 -> R .string.auto_connect_carousel_first_slide_bottom_text
171
+ 1 -> R .string.auto_connect_carousel_second_slide_bottom_text
172
+ else ->
173
+ R .string.auto_connect_carousel_third_slide_bottom_text
167
174
}
168
175
),
169
176
HtmlCompat .FROM_HTML_MODE_COMPACT
@@ -172,7 +179,7 @@ fun AutoConnectCarousel() {
172
179
boldSpanStyle =
173
180
SpanStyle (
174
181
fontWeight = FontWeight .ExtraBold ,
175
- color = MaterialTheme .colorScheme.onSecondary
182
+ color = MaterialTheme .colorScheme.onPrimary
176
183
)
177
184
)
178
185
)
@@ -183,6 +190,7 @@ fun AutoConnectCarousel() {
183
190
.padding(top = Dimens .topPadding)
184
191
.constrainAs(pageIndicatorRef) {
185
192
top.linkTo(lowerTextRef.bottom)
193
+
186
194
end.linkTo(parent.end)
187
195
start.linkTo(parent.start)
188
196
},
@@ -191,7 +199,8 @@ fun AutoConnectCarousel() {
191
199
) {
192
200
repeat(pagerState.pageCount) { iteration ->
193
201
val color =
194
- if (pagerState.currentPage == iteration) Color .LightGray else Color .DarkGray
202
+ if (pagerState.currentPage == iteration) MaterialTheme .colorScheme.onPrimary
203
+ else MaterialTheme .colorScheme.primary
195
204
Box (
196
205
modifier =
197
206
Modifier .padding(Dimens .indicatorPadding)
0 commit comments