From cadb6fa95b484d2e1ffc6054603eaacbf71dbdd6 Mon Sep 17 00:00:00 2001 From: nunommts <79104027+nunommts@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:30:01 +0100 Subject: [PATCH] Adjusted feed tabs navigation to keep the "Catalog" on the screen (#242) * Adjusted feed tabs navigation to keep the "Catalog" on the top of the screen. * Created new release entry on Changelog --- README-CHANGES.xml | 9 +++++++-- org.thepalaceproject.android.platform | 2 +- .../librarysimplified/ui/catalog/CatalogFeedFragment.kt | 7 +++++++ .../librarysimplified/ui/catalog/CatalogFeedViewModel.kt | 6 +++--- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README-CHANGES.xml b/README-CHANGES.xml index bec9e686b..80036b96e 100644 --- a/README-CHANGES.xml +++ b/README-CHANGES.xml @@ -332,9 +332,14 @@ - + - + + + + + + diff --git a/org.thepalaceproject.android.platform b/org.thepalaceproject.android.platform index af217f7c1..90566ab18 160000 --- a/org.thepalaceproject.android.platform +++ b/org.thepalaceproject.android.platform @@ -1 +1 @@ -Subproject commit af217f7c1198c474c6da7f1ad89f7e56bc42454a +Subproject commit 90566ab18f80a080d57346cb54b1202815c4f2a2 diff --git a/simplified-ui-catalog/src/main/java/org/librarysimplified/ui/catalog/CatalogFeedFragment.kt b/simplified-ui-catalog/src/main/java/org/librarysimplified/ui/catalog/CatalogFeedFragment.kt index ec1247de4..a8f165efa 100644 --- a/simplified-ui-catalog/src/main/java/org/librarysimplified/ui/catalog/CatalogFeedFragment.kt +++ b/simplified-ui-catalog/src/main/java/org/librarysimplified/ui/catalog/CatalogFeedFragment.kt @@ -835,6 +835,7 @@ class CatalogFeedFragment : Fragment(R.layout.feed), AgeGateDialog.BirthYearSele button.setOnClickListener { this.logger.debug("selected entry point facet: {}", facet.title) this.viewModel.openFacet(facet) + updateSelectedFacet(facetTabs = facetTabs, index = index) } button.setPadding(0) facetTabs.addView(button) @@ -858,6 +859,12 @@ class CatalogFeedFragment : Fragment(R.layout.feed), AgeGateDialog.BirthYearSele } } + private fun updateSelectedFacet(facetTabs: RadioGroup, index: Int) { + facetTabs.clearCheck() + val button = facetTabs.getChildAt(index) as RadioButton + facetTabs.check(button.id) + } + private fun showFacetSelectDialog( groupName: String, group: List diff --git a/simplified-ui-catalog/src/main/java/org/librarysimplified/ui/catalog/CatalogFeedViewModel.kt b/simplified-ui-catalog/src/main/java/org/librarysimplified/ui/catalog/CatalogFeedViewModel.kt index 34b4a1955..710bba856 100644 --- a/simplified-ui-catalog/src/main/java/org/librarysimplified/ui/catalog/CatalogFeedViewModel.kt +++ b/simplified-ui-catalog/src/main/java/org/librarysimplified/ui/catalog/CatalogFeedViewModel.kt @@ -887,9 +887,9 @@ class CatalogFeedViewModel( fun openFacet(facet: FeedFacet) { val feedArguments = this.resolveFacet(facet) - this.listener.post( - CatalogFeedEvent.OpenFeed(feedArguments) - ) + val newState = CatalogFeedState.CatalogFeedLoading(feedArguments) + this.stateMutable.value = newState + reloadFeed() } /**