Switched CalDAV and CardDAV tab positions (#769)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
This commit is contained in:
Arnau Mora 2024-05-02 11:18:30 +02:00 committed by GitHub
parent c9fd66bd63
commit e40fa6e0fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -216,12 +216,12 @@ fun AccountScreen(
var nextIdx = -1
@Suppress("KotlinConstantConditions")
val idxCardDav: Int? = if (hasCardDav) ++nextIdx else null
val idxCalDav: Int? = if (hasCalDav) ++nextIdx else null
val idxCardDav: Int? = if (hasCardDav) ++nextIdx else null
val idxWebcal: Int? = if (hasWebcal) ++nextIdx else null
val nrPages =
(if (idxCardDav != null) 1 else 0) +
(if (idxCalDav != null) 1 else 0) +
(if (idxCalDav != null) 1 else 0) +
(if (idxCardDav != null) 1 else 0) +
(if (idxWebcal != null) 1 else 0)
val pagerState = rememberPagerState(pageCount = { nrPages })
@ -298,21 +298,6 @@ fun AccountScreen(
Column {
if (nrPages > 0) {
TabRow(selectedTabIndex = pagerState.currentPage) {
if (idxCardDav != null)
Tab(
selected = pagerState.currentPage == idxCardDav,
onClick = {
scope.launch {
pagerState.scrollToPage(idxCardDav)
}
}
) {
Text(
stringResource(R.string.account_carddav),
modifier = Modifier.padding(8.dp)
)
}
if (idxCalDav != null) {
Tab(
selected = pagerState.currentPage == idxCalDav,
@ -329,6 +314,22 @@ fun AccountScreen(
}
}
if (idxCardDav != null) {
Tab(
selected = pagerState.currentPage == idxCardDav,
onClick = {
scope.launch {
pagerState.scrollToPage(idxCardDav)
}
}
) {
Text(
stringResource(R.string.account_carddav),
modifier = Modifier.padding(8.dp)
)
}
}
if (idxWebcal != null) {
Tab(
selected = pagerState.currentPage == idxWebcal,