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 709b03c0abfa71c1b721b33ec12adec79c428d44..85459f36f690f2d57a3e8e715c0d76a5b7e6bf32 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 @@ -143,9 +143,12 @@ 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() + org.futo.circles.core.R.id.filter -> navigator.navigateToTimelinesFilter(args.roomId) } return@setOnMenuItemClickListener true } diff --git a/app/src/main/java/org/futo/circles/feature/timeline/TimelineNavigator.kt b/app/src/main/java/org/futo/circles/feature/timeline/TimelineNavigator.kt index c50ed998bf8984fd0cdcdca76b8c3607ea380576..ffb3eb1398822d7581e23baa0f04e6d5d362fbac 100644 --- a/app/src/main/java/org/futo/circles/feature/timeline/TimelineNavigator.kt +++ b/app/src/main/java/org/futo/circles/feature/timeline/TimelineNavigator.kt @@ -21,6 +21,12 @@ class TimelineNavigator(private val fragment: TimelineDialogFragment) { ) } + fun navigateToTimelinesFilter(roomId: String) { + fragment.findNavController().navigateSafe( + TimelineDialogFragmentDirections.toFilterTimelinesDialogFragment(roomId) + ) + } + fun navigateToCreatePoll(roomId: String) { fragment.findNavController().navigateSafe( TimelineDialogFragmentDirections.toCreatePoll(roomId, null) diff --git a/app/src/main/res/navigation/timeline_nav_graph.xml b/app/src/main/res/navigation/timeline_nav_graph.xml index d202290c3415b266f24e566f0107e33ca076d8aa..fd75cf9a0c9ac6b3df1be0fa2ffb479239fd4743 100644 --- a/app/src/main/res/navigation/timeline_nav_graph.xml +++ b/app/src/main/res/navigation/timeline_nav_graph.xml @@ -28,6 +28,17 @@ app:argType="string" app:nullable="true" /> + <action + android:id="@+id/to_filterTimelinesDialogFragment" + app:destination="@id/filter_timelines_nav_graph"> + + <argument + android:name="circleId" + app:argType="string" + app:nullable="false" /> + + </action> + <action android:id="@+id/to_createPostBottomSheet" app:destination="@id/createPostBottomSheet"> @@ -419,7 +430,8 @@ app:nullable="true" /> </action> + </dialog> + <include app:graph="@navigation/filter_timelines_nav_graph" /> - </dialog> </navigation> \ No newline at end of file diff --git a/core/src/main/res/menu/timeline_menu.xml b/core/src/main/res/menu/timeline_menu.xml index e90ba6ffb6e91a8e1c06690e3d632e6a100db493..9e90a3ac8d7b03f60911b64e6d7e57705afff3b3 100644 --- a/core/src/main/res/menu/timeline_menu.xml +++ b/core/src/main/res/menu/timeline_menu.xml @@ -2,6 +2,13 @@ <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> + <item + android:id="@+id/filter" + android:icon="@drawable/ic_filter" + android:title="@string/filter_timelines" + android:visible="false" + app:showAsAction="ifRoom" /> + <item android:id="@+id/settings" android:icon="@drawable/ic_settings" diff --git a/core/src/main/res/navigation/filter_timelines_nav_graph.xml b/core/src/main/res/navigation/filter_timelines_nav_graph.xml new file mode 100644 index 0000000000000000000000000000000000000000..0c24962c5f6f659639324706e66791c07e30ae24 --- /dev/null +++ b/core/src/main/res/navigation/filter_timelines_nav_graph.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<navigation xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/filter_timelines_nav_graph" + app:startDestination="@id/filterTimelinesDialogFragment"> + + <dialog + android:id="@+id/filterTimelinesDialogFragment" + android:name="org.futo.circles.core.feature.circles.filter.FilterTimelinesDialogFragment" + tools:layout="@layout/dialog_fragment_filter_timeline"> + + <argument + android:name="circleId" + app:argType="string" + app:nullable="false" /> + + </dialog> +</navigation> \ No newline at end of file diff --git a/core/src/main/res/navigation/timeline_options_nav_graph.xml b/core/src/main/res/navigation/timeline_options_nav_graph.xml index f8f290a78c64aa3badfb74af034376fdfc9224ba..6ddca8828dff61f748188f60ee81c9c5c1f30256 100644 --- a/core/src/main/res/navigation/timeline_options_nav_graph.xml +++ b/core/src/main/res/navigation/timeline_options_nav_graph.xml @@ -116,7 +116,7 @@ </action> <action android:id="@+id/to_filterTimelinesDialogFragment" - app:destination="@id/filterTimelinesDialogFragment"> + app:destination="@id/filter_timelines_nav_graph"> <argument android:name="circleId" @@ -263,16 +263,7 @@ android:id="@+id/userDialogFragment" android:name="org.futo.circles.core.feature.user.UserDialogFragment" tools:layout="@layout/dialog_fragment_user" /> - <dialog - android:id="@+id/filterTimelinesDialogFragment" - android:name="org.futo.circles.core.feature.circles.filter.FilterTimelinesDialogFragment" - tools:layout="@layout/dialog_fragment_filter_timeline"> - - <argument - android:name="circleId" - app:argType="string" - app:nullable="false" /> - </dialog> + <include app:graph="@navigation/filter_timelines_nav_graph" /> </navigation>