Skip to content

Commit 4b9bd04

Browse files
Make sure ThreadFragment is displayed after rotation
1 parent b995021 commit 4b9bd04

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/src/main/java/com/infomaniak/mail/ui/main/folder/TwoPaneFragment.kt

+9
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,13 @@ abstract class TwoPaneFragment : Fragment() {
8282
override fun onConfigurationChanged(newConfig: Configuration) {
8383
super.onConfigurationChanged(newConfig)
8484
updateDrawerLockMode()
85+
ensureThreadIsDisplayed(newConfig.orientation)
8586
}
8687

8788
private fun setupSlidingPane() = with(slidingPaneLayout) {
89+
8890
lockMode = SlidingPaneLayout.LOCK_MODE_LOCKED
91+
8992
addPanelSlideListener(object : SlidingPaneLayout.PanelSlideListener {
9093
override fun onPanelOpened(panel: View) = Unit
9194
override fun onPanelClosed(panel: View) = Unit
@@ -192,4 +195,10 @@ abstract class TwoPaneFragment : Fragment() {
192195
)
193196
}
194197
}
198+
199+
private fun ensureThreadIsDisplayed(orientation: Int) {
200+
if (orientation == Configuration.ORIENTATION_PORTRAIT && twoPaneViewModel.isInThreadInPhoneMode(requireContext())) {
201+
slidingPaneLayout.openPaneNoAnimation()
202+
}
203+
}
195204
}

0 commit comments

Comments
 (0)