Skip to content

Commit

Permalink
Merge pull request #846 from Infomaniak/fix-File-details-status-bar
Browse files Browse the repository at this point in the history
Fix file details status bar
  • Loading branch information
sirambd authored Jul 20, 2022
2 parents 70e5990 + 2a7f63d commit 9b73aff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
7 changes: 5 additions & 2 deletions app/src/main/java/com/infomaniak/drive/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {
Expand All @@ -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)
Expand All @@ -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)
}
}
})
Expand Down

0 comments on commit 9b73aff

Please sign in to comment.