Skip to content

Commit 318d61c

Browse files
committed
Apply suggestions from code review
1 parent 8c6ecfe commit 318d61c

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

app/src/main/java/com/infomaniak/mail/ui/newMessage/NewMessageFragment.kt

+1-3
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,7 @@ class NewMessageFragment : Fragment() {
377377
}
378378

379379
private fun disableButtonsWhenFocusIsLost() {
380-
newMessageViewModel.isEditorWebViewFocusedLiveData.observe(viewLifecycleOwner) { hasFocus ->
381-
setToolbarEnabledStatus(hasFocus)
382-
}
380+
newMessageViewModel.isEditorWebViewFocusedLiveData.observe(viewLifecycleOwner, ::setToolbarEnabledStatus)
383381
}
384382

385383
private fun setToolbarEnabledStatus(isEnabled: Boolean) {

app/src/main/java/com/infomaniak/mail/ui/newMessage/NewMessageRecipientFieldsManager.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ class NewMessageRecipientFieldsManager @Inject constructor(private val snackbarM
121121
}
122122

123123
fun setOnFocusChangedListeners() = with(newMessageViewModel) {
124-
binding.subjectTextField.setOnFocusChangeListener { _, hasFocus -> if (hasFocus) fieldGotFocus(null) }
124+
binding.subjectTextField.setOnFocusChangeListener { _, hasFocus -> if (hasFocus) fieldGotFocus(field = null) }
125125
binding.editorWebView.setOnFocusChangeListener { _, hasFocus -> isEditorWebViewFocusedLiveData.value = hasFocus }
126126

127-
isEditorWebViewFocusedLiveData.observe(viewLifecycleOwner) { hasFocus -> if (hasFocus) fieldGotFocus(null) }
127+
isEditorWebViewFocusedLiveData.observe(viewLifecycleOwner) { hasFocus -> if (hasFocus) fieldGotFocus(field = null) }
128128
}
129129

130130
fun focusBodyField() {

0 commit comments

Comments
 (0)