Skip to content

Commit 401fbca

Browse files
authored
Merge pull request #1732 from Infomaniak/prepare-code
Swap `with(binding) { … }` with `with(threadViewModel) { … }`
2 parents b1da033 + 082bebe commit 401fbca

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

app/src/main/java/com/infomaniak/mail/ui/main/thread/ThreadFragment.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ class ThreadFragment : Fragment() {
169169

170170
private fun setupUi() = with(binding) {
171171

172+
threadSubject.movementMethod = LinkMovementMethod.getInstance()
173+
172174
updateNavigationIcon()
173175
toolbar.setNavigationOnClickListener { twoPaneViewModel.closeThread() }
174176

@@ -350,18 +352,16 @@ class ThreadFragment : Fragment() {
350352
mainViewModel.toggleLightThemeForMessage.observe(viewLifecycleOwner, threadAdapter::toggleLightMode)
351353
}
352354

353-
private fun observeThreadLive() = with(binding) {
355+
private fun observeThreadLive() = with(threadViewModel) {
354356

355-
threadViewModel.threadLive.observe(viewLifecycleOwner) { thread ->
357+
threadLive.observe(viewLifecycleOwner) { thread ->
356358

357359
if (thread == null) {
358360
twoPaneViewModel.closeThread()
359361
return@observe
360362
}
361363

362-
threadSubject.movementMethod = LinkMovementMethod.getInstance()
363-
364-
iconFavorite.apply {
364+
binding.iconFavorite.apply {
365365
setIconResource(if (thread.isFavorite) R.drawable.ic_star_filled else R.drawable.ic_star)
366366
val color = if (thread.isFavorite) {
367367
context.getColor(R.color.favoriteYellow)

0 commit comments

Comments
 (0)