From 67184fb72e1dc39a6641fae5137ba899e8b9fd07 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Sun, 5 Apr 2026 12:50:52 -0400 Subject: [PATCH] Add a filter group for locations and moves global and around me to their correct sections --- .../navigation/topbars/FeedFilterSpinner.kt | 33 ++++++++++++++++--- .../amethyst/ui/screen/TopNavFilterState.kt | 2 +- amethyst/src/main/res/values/strings.xml | 1 + 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/topbars/FeedFilterSpinner.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/topbars/FeedFilterSpinner.kt index 4fe59d6dee..fefd9876f5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/topbars/FeedFilterSpinner.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/topbars/FeedFilterSpinner.kt @@ -327,6 +327,7 @@ private enum class FeedGroup( FEEDS(R.string.feed_group_feeds), HASHTAGS(R.string.feed_group_hashtags), COMMUNITIES(R.string.feed_group_communities), + LOCATIONS(R.string.feed_group_locations), LISTS(R.string.feed_group_lists), RELAYS(R.string.feed_group_relays), } @@ -335,11 +336,33 @@ private fun groupFeedDefinitions(options: ImmutableList): Map IndexedFeedDefinition(index, item) } return indexed.groupBy { entry -> when (entry.item.name) { - is HashtagName -> FeedGroup.HASHTAGS - is CommunityName -> FeedGroup.COMMUNITIES - is PeopleListName -> FeedGroup.LISTS - is RelayName -> FeedGroup.RELAYS - else -> FeedGroup.FEEDS + is HashtagName -> { + FeedGroup.HASHTAGS + } + + is CommunityName -> { + FeedGroup.COMMUNITIES + } + + is PeopleListName -> { + FeedGroup.LISTS + } + + is RelayName -> { + FeedGroup.RELAYS + } + + is GeoHashName -> { + FeedGroup.LOCATIONS + } + + is ResourceName -> { + when (entry.item.code) { + is TopFilter.AroundMe -> FeedGroup.LOCATIONS + is TopFilter.Global -> FeedGroup.RELAYS + else -> FeedGroup.FEEDS + } + } } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/TopNavFilterState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/TopNavFilterState.kt index 8a81b1a7ce..878c047924 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/TopNavFilterState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/TopNavFilterState.kt @@ -243,7 +243,7 @@ class TopNavFilterState( } @Stable -abstract class Name { +sealed class Name { abstract fun name(): String open fun name(context: Context) = name() diff --git a/amethyst/src/main/res/values/strings.xml b/amethyst/src/main/res/values/strings.xml index ea2c30d389..55325cc715 100644 --- a/amethyst/src/main/res/values/strings.xml +++ b/amethyst/src/main/res/values/strings.xml @@ -1675,6 +1675,7 @@ Select an option to filter the feed Feeds Hashtags + Locations Communities Lists Relays