From 9693dec807b779da3efe42df72da89c7cac444ad Mon Sep 17 00:00:00 2001 From: davidoskky Date: Sun, 16 Jan 2022 20:49:54 +0100 Subject: [PATCH] Make the selection of tags and source filters exclusive (#399) * Make the selection of tags and source filters exclusive * Update changelog --- CHANGELOG.md | 2 ++ .../amine/bou/readerforselfoss/HomeActivity.kt | 16 ++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 248a5b3..06602aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,8 @@ - Closing #236. New sources can be added in Selfoss 2.19. +- Closing #397 and #355. Tag and Sources filters are now exclusive. + - Dropped support for android 4, the last version supporting it is v1721030811 **1.6.x** diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt index 4c7bc6f..31d807a 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt @@ -101,9 +101,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { private var fullHeightCards: Boolean = false private var itemsNumber: Int = 200 private var elementsShown: Int = 1 - private var maybeTagFilter: Tag? = null - private var maybeSourceFilter: Source? = null - private var maybeSearchFilter: String? = null private var userIdentifier: String = "" private var displayAccountHeader: Boolean = false private var infiniteScroll: Boolean = false @@ -563,8 +560,9 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { color = ColorHolder.fromColor(appColors.colorAccent) } onDrawerItemClickListener = { _,_,_ -> allItems = ArrayList() - maybeTagFilter = it SharedItems.tagFilter = it.tag + SharedItems.sourceFilter = null + SharedItems.sourceIDFilter = null getElementsAccordingToTab() fetchOnEmptyList() false @@ -615,8 +613,9 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { color = ColorHolder.fromColor(appColors.colorAccent) } onDrawerItemClickListener = { _,_,_ -> allItems = ArrayList() - maybeTagFilter = it SharedItems.tagFilter = it.tag + SharedItems.sourceFilter = null + SharedItems.sourceIDFilter = null getElementsAccordingToTab() fetchOnEmptyList() false @@ -650,9 +649,9 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { iconUrl = source.getIcon(this@HomeActivity) onDrawerItemClickListener = { _,_,_ -> allItems = ArrayList() - maybeSourceFilter = source SharedItems.sourceIDFilter = source.id.toLong() SharedItems.sourceFilter = source.title + SharedItems.tagFilter = null getElementsAccordingToTab() fetchOnEmptyList() false @@ -673,11 +672,10 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { badgeRes = R.string.drawer_action_clear onDrawerItemClickListener = { _,_,_ -> allItems = ArrayList() - maybeSourceFilter = null SharedItems.sourceFilter = null SharedItems.sourceIDFilter = null - maybeTagFilter = null SharedItems.tagFilter = null + binding.mainDrawer.setSelectionAtPosition(-1) getElementsAccordingToTab() fetchOnEmptyList() false @@ -1122,7 +1120,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { override fun onQueryTextChange(p0: String?): Boolean { if (p0.isNullOrBlank()) { - maybeSearchFilter = null SharedItems.searchFilter = null getElementsAccordingToTab() fetchOnEmptyList() @@ -1131,7 +1128,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { } override fun onQueryTextSubmit(p0: String?): Boolean { - maybeSearchFilter = p0 SharedItems.searchFilter = p0 getElementsAccordingToTab() fetchOnEmptyList()