Skip to content

Commit

Permalink
Moved pull-to-refresh indicator below tabs (#1028)
Browse files Browse the repository at this point in the history
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
  • Loading branch information
ArnyminerZ authored Sep 16, 2024
1 parent dcb7e31 commit 5180b99
Showing 1 changed file with 50 additions and 49 deletions.
99 changes: 50 additions & 49 deletions app/src/main/kotlin/at/bitfire/davdroid/ui/account/AccountScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -297,70 +297,71 @@ fun AccountScreen(
SnackbarHost(snackbarHostState)
}
) { padding ->
PullToRefreshBox(
isRefreshing = isRefreshing,
onRefresh = { isRefreshing = true; onSync() },
Column(
modifier = Modifier.padding(padding)
) {
Column {
if (nrPages > 0) {
TabRow(selectedTabIndex = pagerState.currentPage) {
if (idxCalDav != null) {
Tab(
selected = pagerState.currentPage == idxCalDav,
onClick = {
scope.launch {
pagerState.scrollToPage(idxCalDav)
}
if (nrPages > 0) {
TabRow(selectedTabIndex = pagerState.currentPage) {
if (idxCalDav != null) {
Tab(
selected = pagerState.currentPage == idxCalDav,
onClick = {
scope.launch {
pagerState.scrollToPage(idxCalDav)
}
) {
Text(
stringResource(R.string.account_caldav),
modifier = Modifier.padding(8.dp)
)
}
) {
Text(
stringResource(R.string.account_caldav),
modifier = Modifier.padding(8.dp)
)
}
}

if (idxCardDav != null) {
Tab(
selected = pagerState.currentPage == idxCardDav,
onClick = {
scope.launch {
pagerState.scrollToPage(idxCardDav)
}
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)
)
}
) {
Text(
stringResource(R.string.account_carddav),
modifier = Modifier.padding(8.dp)
)
}
}

if (idxWebcal != null) {
Tab(
selected = pagerState.currentPage == idxWebcal,
onClick = {
scope.launch {
pagerState.scrollToPage(idxWebcal)
}
if (idxWebcal != null) {
Tab(
selected = pagerState.currentPage == idxWebcal,
onClick = {
scope.launch {
pagerState.scrollToPage(idxWebcal)
}
) {
Text(
stringResource(R.string.account_webcal),
modifier = Modifier.padding(8.dp)
)
}
) {
Text(
stringResource(R.string.account_webcal),
modifier = Modifier.padding(8.dp)
)
}
}
}

HorizontalPager(
pagerState,
verticalAlignment = Alignment.Top,
modifier = Modifier
.fillMaxWidth()
.weight(1f)
) { index ->
HorizontalPager(
pagerState,
verticalAlignment = Alignment.Top,
modifier = Modifier
.fillMaxWidth()
.weight(1f)
) { index ->
PullToRefreshBox(
isRefreshing = isRefreshing,
onRefresh = { isRefreshing = true; onSync() }
) {
when (index) {
idxCardDav ->
AccountScreen_ServiceTab(
Expand Down

0 comments on commit 5180b99

Please sign in to comment.