Commit b2046fa 1 parent 11db4a8 commit b2046fa Copy full SHA for b2046fa
File tree 3 files changed +8
-5
lines changed
app/src/main/java/com/infomaniak/mail
3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ import com.infomaniak.mail.ui.main.thread.ThreadFragment
39
39
import com.infomaniak.mail.utils.AttachmentIntentUtils
40
40
import com.infomaniak.mail.utils.UiUtils.FULLY_SLID
41
41
import com.infomaniak.mail.utils.UiUtils.progressivelyColorSystemBars
42
- import com.infomaniak.mail.utils.canDisplayBothPanes
43
42
import com.infomaniak.mail.utils.safeNavigateToNewMessageActivity
44
43
import com.infomaniak.mail.utils.setSystemBarsColors
45
44
import javax.inject.Inject
@@ -188,7 +187,9 @@ abstract class TwoPaneFragment : Fragment() {
188
187
// TODO: When we'll add the feature of swiping between Threads, we'll need to check if this function is still needed.
189
188
private fun updateDrawerLockMode () {
190
189
if (this is ThreadListFragment ) {
191
- (requireActivity() as MainActivity ).setDrawerLockMode(isLocked = twoPaneViewModel.isThreadOpen && ! canDisplayBothPanes())
190
+ (requireActivity() as MainActivity ).setDrawerLockMode(
191
+ isLocked = twoPaneViewModel.isInThreadInPhoneMode(requireContext()),
192
+ )
192
193
}
193
194
}
194
195
}
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ import com.infomaniak.mail.data.models.message.Message
32
32
import com.infomaniak.mail.data.models.thread.Thread
33
33
import com.infomaniak.mail.ui.newMessage.NewMessageActivityArgs
34
34
import com.infomaniak.mail.utils.Utils.runCatchingRealm
35
- import com.infomaniak.mail.utils.canDisplayBothPanes
35
+ import com.infomaniak.mail.utils.canDisplayOnlyOnePane
36
36
import dagger.hilt.android.lifecycle.HiltViewModel
37
37
import javax.inject.Inject
38
38
@@ -94,7 +94,7 @@ class TwoPaneViewModel @Inject constructor(
94
94
)
95
95
}
96
96
97
- fun isInThreadInPhoneMode (context : Context ): Boolean = isThreadOpen && ! context.canDisplayBothPanes ()
97
+ fun isInThreadInPhoneMode (context : Context ): Boolean = isThreadOpen && context.canDisplayOnlyOnePane ()
98
98
99
99
data class NavData (
100
100
@IdRes val resId : Int ,
Original file line number Diff line number Diff line change @@ -159,8 +159,10 @@ fun Date.isLastWeek(): Boolean {
159
159
// region UI
160
160
fun Context.isInPortrait (): Boolean = resources.configuration.orientation == Configuration .ORIENTATION_PORTRAIT
161
161
162
+ private fun Context.canDisplayBothPanes (): Boolean = resources.getBoolean(R .bool.canDisplayBothPanes)
162
163
fun Fragment.canDisplayBothPanes (): Boolean = requireContext().canDisplayBothPanes()
163
- fun Context.canDisplayBothPanes (): Boolean = resources.getBoolean(R .bool.canDisplayBothPanes)
164
+ fun Context.canDisplayOnlyOnePane (): Boolean = ! canDisplayBothPanes()
165
+ fun Fragment.canDisplayOnlyOnePane (): Boolean = requireContext().canDisplayOnlyOnePane()
164
166
165
167
fun View.toggleChevron (
166
168
isCollapsed : Boolean ,
You can’t perform that action at this time.
0 commit comments