From 6d86bfd51e35600cf895a03391609329fcc97a03 Mon Sep 17 00:00:00 2001 From: Taras Smakula <tarassmakula@gmail.com> Date: Fri, 15 Mar 2024 15:48:41 +0200 Subject: [PATCH] Show filter icon when filter is active --- .../circles/feature/timeline/TimelineDialogFragment.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/futo/circles/feature/timeline/TimelineDialogFragment.kt b/app/src/main/java/org/futo/circles/feature/timeline/TimelineDialogFragment.kt index 85459f36f..ac79fc892 100644 --- a/app/src/main/java/org/futo/circles/feature/timeline/TimelineDialogFragment.kt +++ b/app/src/main/java/org/futo/circles/feature/timeline/TimelineDialogFragment.kt @@ -41,6 +41,7 @@ import org.futo.circles.model.IgnoreSender import org.futo.circles.model.RemovePost import org.futo.circles.view.CreatePostViewListener import org.futo.circles.view.PostOptionsListener +import org.matrix.android.sdk.api.extensions.tryOrNull import org.matrix.android.sdk.api.session.room.model.PowerLevelsContent import org.matrix.android.sdk.api.session.room.powerlevels.Role @@ -143,8 +144,6 @@ class TimelineDialogFragment : BaseFullscreenDialogFragment(DialogFragmentTimeli private fun setupMenuClickListener() { binding.toolbar.apply { setOnClickListener { navigateToTimelineOptions() } - menu.findItem(org.futo.circles.core.R.id.filter).isVisible = - args.timelineId != null && !isThread setOnMenuItemClickListener { item -> when (item.itemId) { org.futo.circles.core.R.id.settings -> navigateToTimelineOptions() @@ -167,6 +166,11 @@ class TimelineDialogFragment : BaseFullscreenDialogFragment(DialogFragmentTimeli binding.rvTimeline.setIsPageLoading(false) viewModel.markTimelineAsRead(args.roomId, isGroupMode) } + viewModel.isFilterActiveLiveData.observeData(this) { + val menuItem = + tryOrNull { binding.toolbar.menu.findItem(org.futo.circles.core.R.id.filter) } + menuItem?.isVisible = it + } viewModel.notificationsStateLiveData.observeData(this) { binding.toolbar.subtitle = if (it) "" else getString(R.string.notifications_disabled) -- GitLab