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

View File

@ -289,19 +289,21 @@ object TimelineTab : Tab {
}, },
snackbarHost = { SnackbarHost(snackbarHostState) }, snackbarHost = { SnackbarHost(snackbarHostState) },
floatingActionButton = { floatingActionButton = {
FloatingActionButton( if (!state.hideReadAllFAB) {
onClick = { FloatingActionButton(
if (state.filters.mainFilter == MainFilter.ALL) { onClick = {
viewModel.openDialog(DialogState.ConfirmDialog) if (state.filters.mainFilter == MainFilter.ALL) {
} else { viewModel.openDialog(DialogState.ConfirmDialog)
viewModel.setAllItemsRead() } 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 -> ) { paddingValues ->