diff --git a/app/src/main/java/com/infomaniak/mail/ui/main/thread/ThreadFragment.kt b/app/src/main/java/com/infomaniak/mail/ui/main/thread/ThreadFragment.kt index 4280ab1d18..370351258b 100644 --- a/app/src/main/java/com/infomaniak/mail/ui/main/thread/ThreadFragment.kt +++ b/app/src/main/java/com/infomaniak/mail/ui/main/thread/ThreadFragment.kt @@ -169,6 +169,8 @@ class ThreadFragment : Fragment() { private fun setupUi() = with(binding) { + threadSubject.movementMethod = LinkMovementMethod.getInstance() + updateNavigationIcon() toolbar.setNavigationOnClickListener { twoPaneViewModel.closeThread() } @@ -350,18 +352,16 @@ class ThreadFragment : Fragment() { mainViewModel.toggleLightThemeForMessage.observe(viewLifecycleOwner, threadAdapter::toggleLightMode) } - private fun observeThreadLive() = with(binding) { + private fun observeThreadLive() = with(threadViewModel) { - threadViewModel.threadLive.observe(viewLifecycleOwner) { thread -> + threadLive.observe(viewLifecycleOwner) { thread -> if (thread == null) { twoPaneViewModel.closeThread() return@observe } - threadSubject.movementMethod = LinkMovementMethod.getInstance() - - iconFavorite.apply { + binding.iconFavorite.apply { setIconResource(if (thread.isFavorite) R.drawable.ic_star_filled else R.drawable.ic_star) val color = if (thread.isFavorite) { context.getColor(R.color.favoriteYellow)