Skip to content

Commit 24a16a2

Browse files
Display correct navigationBarColor when closing a BottomSheetDialog
1 parent 8adf37d commit 24a16a2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: app/src/main/java/com/infomaniak/mail/ui/MainActivity.kt

+20
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,31 @@ class MainActivity : BaseActivity() {
433433
SentryDebug.addNavigationBreadcrumb(destination.displayName, arguments)
434434
trackDestination(destination)
435435

436+
updateColorsWhenDestinationChanged()
436437
setDrawerLockMode(isLocked = destination.id != R.id.threadListFragment)
437438

438439
previousDestinationId = destination.id
439440
}
440441

442+
private fun updateColorsWhenDestinationChanged() {
443+
when (previousDestinationId) {
444+
R.id.threadActionsBottomSheetDialog,
445+
R.id.messageActionsBottomSheetDialog,
446+
R.id.replyBottomSheetDialog,
447+
R.id.detailedContactBottomSheetDialog -> {
448+
val fragment = currentFragment
449+
if (fragment is TwoPaneFragment) {
450+
val navigationBarColor = if (fragment.isThreadOpen() && !canDisplayBothPanes()) {
451+
R.color.elevatedBackground
452+
} else {
453+
R.color.backgroundColor
454+
}
455+
window.updateNavigationBarColor(getColor(navigationBarColor))
456+
}
457+
}
458+
}
459+
}
460+
441461
fun setDrawerLockMode(isLocked: Boolean) {
442462
val drawerLockMode = if (isLocked) DrawerLayout.LOCK_MODE_LOCKED_CLOSED else DrawerLayout.LOCK_MODE_UNLOCKED
443463
binding.drawerLayout.setDrawerLockMode(drawerLockMode)

0 commit comments

Comments
 (0)