From 7be074f7596215b1245578644fcc3a97349374b7 Mon Sep 17 00:00:00 2001 From: Shinokuni Date: Fri, 12 Jul 2024 15:27:23 +0200 Subject: [PATCH] Hide FAB in TimelineTab when displaying local account refresh screen --- .../app/timelime/TimelineScreenModel.kt | 6 +++-- .../com/readrops/app/timelime/TimelineTab.kt | 24 ++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/readrops/app/timelime/TimelineScreenModel.kt b/app/src/main/java/com/readrops/app/timelime/TimelineScreenModel.kt index 6218f34f..c55527a7 100644 --- a/app/src/main/java/com/readrops/app/timelime/TimelineScreenModel.kt +++ b/app/src/main/java/com/readrops/app/timelime/TimelineScreenModel.kt @@ -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> = emptyMap(), val itemState: Flow> = emptyFlow(), val dialog: DialogState? = null, - val isAccountLocal: Boolean = false + val isAccountLocal: Boolean = false, + val hideReadAllFAB: Boolean = false ) { val showSubtitle = filters.subFilter != SubFilter.ALL diff --git a/app/src/main/java/com/readrops/app/timelime/TimelineTab.kt b/app/src/main/java/com/readrops/app/timelime/TimelineTab.kt index 69788193..8b8ca91e 100644 --- a/app/src/main/java/com/readrops/app/timelime/TimelineTab.kt +++ b/app/src/main/java/com/readrops/app/timelime/TimelineTab.kt @@ -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 ->