ux: pull-to-refresh на всех списках (Этап 2 п.12)
Раньше свайп-обновление было только в Файлах. Добавлено (Material3 PullToRefreshBox): Почта (входящие/исходящие, force-обновление), Конференции (список бесед — заменяет убранную кнопку ↻), Контакты (force + CTag — дёшево), Задачи (список), Карточки (доски и открытая доска). Контакты: refresh() получил параметр force (pull-to-refresh форсит sync мимо TTL; с CTag-проверкой это 1 лёгкий PROPFIND).
This commit is contained in:
@@ -24,6 +24,8 @@ import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.collectAsState
|
||||
@@ -485,6 +487,8 @@ fun MailScreen(
|
||||
onOutboxRetry = { vm.retryOutboxMessage(session, it) },
|
||||
onOutboxDelete = { vm.deleteOutboxMessage(session, it) },
|
||||
onLoadMore = { vm.loadMore(session) },
|
||||
refreshing = state.loading,
|
||||
onRefresh = { vm.load(session, forceRefresh = true) },
|
||||
)
|
||||
}
|
||||
MailNavigationSidebar(
|
||||
@@ -520,6 +524,7 @@ fun MailScreen(
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
private fun MailInboxScreen(
|
||||
session: AuthSession,
|
||||
@@ -542,6 +547,8 @@ private fun MailInboxScreen(
|
||||
onOutboxRetry: (Int) -> Unit,
|
||||
onOutboxDelete: (Int) -> Unit,
|
||||
onLoadMore: () -> Unit,
|
||||
refreshing: Boolean = false,
|
||||
onRefresh: () -> Unit = {},
|
||||
) {
|
||||
val listItems = remember(messages) { buildMailInboxListItems(messages) }
|
||||
val folderTitle = mailFolderListTitle(selectedFolder, searchQuery, searchParams)
|
||||
@@ -595,11 +602,14 @@ private fun MailInboxScreen(
|
||||
if (!error.isNullOrBlank()) {
|
||||
Text(text = error, color = F7Colors.Error, style = MaterialTheme.typography.bodyMedium)
|
||||
}
|
||||
Box(
|
||||
PullToRefreshBox(
|
||||
isRefreshing = refreshing && !loading,
|
||||
onRefresh = onRefresh,
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.fillMaxWidth(),
|
||||
) {
|
||||
Box(modifier = Modifier.fillMaxSize()) {
|
||||
if (loading) {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
@@ -705,6 +715,7 @@ private fun MailInboxScreen(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user