Hide FAB in TimelineTab when displaying local account refresh screen

This commit is contained in:
Shinokuni 2024-07-12 15:27:23 +02:00
parent 46800586e1
commit 7be074f759
2 changed files with 17 additions and 13 deletions

View File

@ -162,7 +162,7 @@ class TimelineScreenModel(
)
}
_timelineState.update { it.copy(isRefreshing = true) }
_timelineState.update { it.copy(isRefreshing = true, hideReadAllFAB = true) }
val results = repository?.synchronize(
selectedFeeds = selectedFeeds,
@ -180,6 +180,7 @@ class TimelineScreenModel(
it.copy(
isRefreshing = false,
endSynchronizing = true,
hideReadAllFAB = false,
localSyncErrors = if (results!!.second.isNotEmpty()) results.second else null
)
}
@ -359,7 +360,8 @@ data class TimelineState(
val foldersAndFeeds: Map<Folder?, List<Feed>> = emptyMap(),
val itemState: Flow<PagingData<ItemWithFeed>> = emptyFlow(),
val dialog: DialogState? = null,
val isAccountLocal: Boolean = false
val isAccountLocal: Boolean = false,
val hideReadAllFAB: Boolean = false
) {
val showSubtitle = filters.subFilter != SubFilter.ALL

View File

@ -289,19 +289,21 @@ object TimelineTab : Tab {
},
snackbarHost = { SnackbarHost(snackbarHostState) },
floatingActionButton = {
FloatingActionButton(
onClick = {
if (state.filters.mainFilter == MainFilter.ALL) {
viewModel.openDialog(DialogState.ConfirmDialog)
} else {
viewModel.setAllItemsRead()
if (!state.hideReadAllFAB) {
FloatingActionButton(
onClick = {
if (state.filters.mainFilter == MainFilter.ALL) {
viewModel.openDialog(DialogState.ConfirmDialog)
} else {
viewModel.setAllItemsRead()
}
}
) {
Icon(
painter = painterResource(id = R.drawable.ic_done_all),
contentDescription = null
)
}
) {
Icon(
painter = painterResource(id = R.drawable.ic_done_all),
contentDescription = null
)
}
},
) { paddingValues ->