@@ -38,7 +38,7 @@ import com.infomaniak.mail.utils.AttachmentIntentUtils
3838import com.infomaniak.mail.utils.UiUtils.FULLY_SLID
3939import com.infomaniak.mail.utils.UiUtils.progressivelyColorSystemBars
4040import com.infomaniak.mail.utils.safeNavigateToNewMessageActivity
41- import com.infomaniak.mail.utils.updateNavigationBarColor
41+ import com.infomaniak.mail.utils.setSystemBarsColors
4242import javax.inject.Inject
4343
4444abstract class TwoPaneFragment : Fragment () {
@@ -121,7 +121,7 @@ abstract class TwoPaneFragment : Fragment() {
121121 val isOpeningThread = threadUid != null
122122 if (isOpeningThread) {
123123 val hasOpened = slidingPaneLayout.openPaneNoAnimation()
124- if (hasOpened) requireActivity().window. statusBarColor = requireContext().getColor( R .color.backgroundColor)
124+ if (hasOpened) setSystemBarsColors( statusBarColor = R .color.backgroundColor, navigationBarColor = null )
125125 } else {
126126 resetPanes()
127127 }
@@ -157,13 +157,15 @@ abstract class TwoPaneFragment : Fragment() {
157157 }
158158 }
159159
160- private fun resetPanes () = with (requireActivity()) {
160+ private fun resetPanes () {
161161
162162 val hasClosed = slidingPaneLayout.closePaneNoAnimation()
163163
164164 if (hasClosed) {
165- if (this @TwoPaneFragment is ThreadListFragment ) window.statusBarColor = getColor(R .color.backgroundHeaderColor)
166- window.updateNavigationBarColor(getColor(R .color.backgroundColor))
165+ setSystemBarsColors(
166+ statusBarColor = if (this @TwoPaneFragment is ThreadListFragment ) R .color.backgroundHeaderColor else null ,
167+ navigationBarColor = R .color.backgroundColor,
168+ )
167169 }
168170
169171 threadListAdapter.selectNewThread(newPosition = null , threadUid = null )
0 commit comments