From 2a7f63daedb6deca1e288a81186e25c71060830d Mon Sep 17 00:00:00 2001 From: Joris Bodin Date: Wed, 20 Jul 2022 10:40:04 +0200 Subject: [PATCH] Fix file details status bar --- .../main/java/com/infomaniak/drive/ui/MainActivity.kt | 7 +++++-- .../ui/fileList/fileDetails/FileDetailsFragment.kt | 10 ++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/infomaniak/drive/ui/MainActivity.kt b/app/src/main/java/com/infomaniak/drive/ui/MainActivity.kt index e88fdbc02a..00bc00aca8 100644 --- a/app/src/main/java/com/infomaniak/drive/ui/MainActivity.kt +++ b/app/src/main/java/com/infomaniak/drive/ui/MainActivity.kt @@ -323,11 +323,14 @@ class MainActivity : BaseActivity() { } when (destination.id) { - R.id.fileDetailsFragment, R.id.fileShareLinkSettingsFragment -> { + R.id.fileDetailsFragment -> { + setColorNavigationBar(true) + } + R.id.fileShareLinkSettingsFragment -> { setColorStatusBar(destination.id == R.id.fileShareLinkSettingsFragment) setColorNavigationBar(true) } - R.id.downloadProgressDialog, R.id.previewSliderFragment -> Unit + R.id.downloadProgressDialog, R.id.previewSliderFragment, R.id.selectPermissionBottomSheetDialog -> Unit else -> { setColorStatusBar() setColorNavigationBar() diff --git a/app/src/main/java/com/infomaniak/drive/ui/fileList/fileDetails/FileDetailsFragment.kt b/app/src/main/java/com/infomaniak/drive/ui/fileList/fileDetails/FileDetailsFragment.kt index f36a4f4c24..ab5ee40602 100644 --- a/app/src/main/java/com/infomaniak/drive/ui/fileList/fileDetails/FileDetailsFragment.kt +++ b/app/src/main/java/com/infomaniak/drive/ui/fileList/fileDetails/FileDetailsFragment.kt @@ -74,7 +74,6 @@ class FileDetailsFragment : FileDetailsSubFragment() { super.onStart() activity?.window?.apply { statusBarColor = Color.TRANSPARENT - lightStatusBar(false) toggleEdgeToEdge(true) // Corrects the layout so it still takes into account system bars in edge-to-edge mode @@ -94,12 +93,6 @@ class FileDetailsFragment : FileDetailsSubFragment() { super.onPause() // TODO Understand why we need to do this toolbar.setNavigationIconTint(ContextCompat.getColor(requireContext(), R.color.primary)) - - activity?.window?.apply { - if (context?.resources?.isNightModeEnabled() == false) { - lightStatusBar(true) - } - } } override fun onStop() { @@ -109,6 +102,7 @@ class FileDetailsFragment : FileDetailsSubFragment() { private fun setFile(file: File) { fileDetailsViewModel.currentFile.value = file + requireActivity().window.lightStatusBar(context?.resources?.isNightModeEnabled() == false && !file.hasThumbnail) subtitleToolbar.title.text = file.name subtitleToolbar.subTitle.text = file.getLastModifiedAt().format(getString(R.string.allLastModifiedFilePattern)) setBannerThumbnail(file) @@ -127,7 +121,7 @@ class FileDetailsFragment : FileDetailsSubFragment() { // If in Light mode, change the status icons color to match the background. // If in Dark mode, the icons stay white all along, no need to check. - if (context?.resources?.isNightModeEnabled() == false) activity?.window?.lightStatusBar(!isExpanded) + if (context?.resources?.isNightModeEnabled() == false && file.hasThumbnail) activity?.window?.lightStatusBar(!isExpanded) } } })