Skip to content

Commit b88cbfc

Browse files
committed
fix: bottombar highlight on snackbar action
1 parent 2926458 commit b88cbfc

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -813,12 +813,10 @@ class FileDisplayActivity : FileActivity(),
813813
Timber.v("onResume() start")
814814
super.onResume()
815815

816+
updateBottomBarSelection(mainFileListFragment?.getCurrentSpace())
816817
if (mainFileListFragment?.getCurrentSpace()?.isProject == true ||
817818
(mainFileListFragment?.getCurrentSpace()?.isPersonal == true && isMultiPersonal)) {
818-
setCheckedItemAtBottomBar(getMenuItemForFileListOption(FileListOption.SPACES_LIST))
819819
updateToolbar(null, mainFileListFragment?.getCurrentSpace())
820-
} else {
821-
setCheckedItemAtBottomBar(getMenuItemForFileListOption(fileListOption))
822820
}
823821

824822
if (secondFragment == null) {
@@ -1893,9 +1891,20 @@ class FileDisplayActivity : FileActivity(),
18931891

18941892
override fun onCurrentFolderUpdated(newCurrentFolder: OCFile, currentSpace: OCSpace?) {
18951893
updateToolbar(newCurrentFolder, currentSpace)
1894+
val newCurrentFolderSpace = currentSpace?.takeIf { it.id == newCurrentFolder.spaceId }
1895+
updateBottomBarSelection(newCurrentFolderSpace)
18961896
file = newCurrentFolder
18971897
}
18981898

1899+
private fun updateBottomBarSelection(currentSpace: OCSpace?) {
1900+
val bottomBarOption = if (currentSpace?.isProject == true) {
1901+
FileListOption.SPACES_LIST
1902+
} else {
1903+
fileListOption
1904+
}
1905+
setCheckedItemAtBottomBar(getMenuItemForFileListOption(bottomBarOption))
1906+
}
1907+
18991908
override fun onFileClicked(file: OCFile) {
19001909
when {
19011910
PreviewImageFragment.canBePreviewed(file) -> {

0 commit comments

Comments
 (0)