diff --git a/CHANGELOG.md b/CHANGELOG.md index c0a0fd7..5cd070c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ **1.6.x** +- Handling hidden tags. + - Fixed pre-lolipop issue with automatic theme changes. - Removed all Build config things. diff --git a/app/build.gradle b/app/build.gradle index cd2bad2..9bd9d74 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -30,16 +30,13 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' -repositories { -} - android { compileOptions { - sourceCompatibility 1.8 - targetCompatibility 1.8 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } - compileSdkVersion 27 - buildToolsVersion '27.0.3' + compileSdkVersion 28 + buildToolsVersion '28.0.1' defaultConfig { applicationId "apps.amine.bou.readerforselfoss" minSdkVersion 16 @@ -93,11 +90,8 @@ dependencies { androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.1' // Espresso-intents for validation and stubbing of Intents androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.1' - - - implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation fileTree(include: ['*.jar'], dir: 'libs') implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - // Android Support implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:design:27.1.1' @@ -143,8 +137,7 @@ dependencies { // Themes implementation 'com.52inc:scoops:1.0.0' - implementation'com.jrummyapps:colorpicker:2.1.7' - + implementation 'com.jrummyapps:colorpicker:2.1.7' implementation 'com.github.rubensousa:floatingtoolbar:1.5.1' // Pager @@ -153,8 +146,8 @@ dependencies { implementation 'androidx.core:core-ktx:0.3' // Crash - implementation "ch.acra:acra-http:5.1.3" - implementation "ch.acra:acra-dialog:5.1.3" + implementation 'ch.acra:acra-http:5.1.3' + implementation 'ch.acra:acra-dialog:5.1.3' } 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 822b38e..48e81ea 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt @@ -74,6 +74,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { private val MENU_PREFERENCES = 12302 private val DRAWER_ID_TAGS = 100101L + private val DRAWER_ID_HIDDEN_TAGS = 101100L private val DRAWER_ID_SOURCES = 100110L private val DRAWER_ID_FILTERS = 100111L private val UNREAD_SHOWN = 1 @@ -101,6 +102,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { private var displayAccountHeader: Boolean = false private var infiniteScroll: Boolean = false private var lastFetchDone: Boolean = false + private var hiddenTags: List = emptyList() private lateinit var tabNewBadge: TextBadgeItem @@ -186,8 +188,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { } if (sharedPref.getString("acra.user.email", "").isNotEmpty()) { - sharedEditor.remove("acra.user.email"); - sharedEditor.commit(); + sharedEditor.remove("acra.user.email") + sharedEditor.commit() } } @@ -343,14 +345,14 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { // TODO: Make this the only appcolors init appColors = AppColors(this@HomeActivity) - handleDrawerItems() - sharedPref = PreferenceManager.getDefaultSharedPreferences(this) editor = settings.edit() handleSharedPrefs() + handleDrawerItems() + handleThemeUpdate() reloadLayoutManager() @@ -387,6 +389,11 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { userIdentifier = sharedPref.getString("unique_id", "") displayAccountHeader = sharedPref.getBoolean("account_header_displaying", false) infiniteScroll = sharedPref.getBoolean("infinite_loading", false) + hiddenTags = if (sharedPref.getString("hidden_tags", "").isNotEmpty()) { + sharedPref.getString("hidden_tags", "").replace("\\s".toRegex(), "").split(",") + } else { + emptyList() + } } private fun handleThemeBinding() { @@ -515,6 +522,52 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { } } + fun handleHiddenTags(maybeTags: List?) { + if (maybeTags == null) { + if (loadedFromCache) { + drawer.addItem( + SecondaryDrawerItem() + .withName(getString(R.string.drawer_error_loading_tags)) + .withSelectable(false) + ) + } + } else { + val actualTags: List = maybeTags.filter { hiddenTags.contains(it.tag) } + tagsBadge = actualTags.map { + val gd = GradientDrawable() + val color = try { + Color.parseColor(it.color) + } catch (e: IllegalArgumentException) { + appColors.colorPrimary + } + + gd.setColor(color) + gd.shape = GradientDrawable.RECTANGLE + gd.setSize(30, 30) + gd.cornerRadius = 30F + drawer.addItem( + PrimaryDrawerItem() + .withName(it.tag) + .withIdentifier(it.tag.longHash()) + .withIcon(gd) + .withBadge("${it.unread}") + .withBadgeStyle( + BadgeStyle().withTextColor(Color.WHITE) + .withColor(appColors.colorAccent) + ) + .withOnDrawerItemClickListener { _, _, _ -> + allItems = ArrayList() + maybeTagFilter = it + getElementsAccordingToTab() + false + } + ) + + (it.tag.longHash() to it.unread) + }.toMap() + } + } + fun handleSources(maybeSources: List?) { if (maybeSources == null) { if (loadedFromCache) { @@ -566,6 +619,16 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { .withSelectable(false) ) handleTags(maybeDrawerData.tags) + if (hiddenTags.isNotEmpty()) { + drawer.addItem(DividerDrawerItem()) + drawer.addItem( + SecondaryDrawerItem() + .withName(getString(R.string.drawer_item_hidden_tags)) + .withIdentifier(DRAWER_ID_HIDDEN_TAGS) + .withSelectable(false) + ) + handleHiddenTags(maybeDrawerData.tags) + } drawer.addItem(DividerDrawerItem()) drawer.addItem( SecondaryDrawerItem() @@ -819,6 +882,11 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { } } + private fun filter(tags: String): Boolean { + val tagsList = tags.replace("\\s".toRegex(), "").split(",") + return tagsList.intersect(hiddenTags).isEmpty() + } + private fun doCallTo( appendResults: Boolean, toastMessage: Int, @@ -829,6 +897,9 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { if (response.body() != null) { if (shouldUpdate) { items = response.body() as ArrayList + items = items.filter { + maybeTagFilter != null || filter(it.tags) + } as ArrayList if (allItems.isEmpty()) { allItems = items diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/settings/SettingsActivity.java b/app/src/main/java/apps/amine/bou/readerforselfoss/settings/SettingsActivity.java index 424f23c..47e6c0e 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/settings/SettingsActivity.java +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/settings/SettingsActivity.java @@ -181,6 +181,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity { } } }); + } @Override diff --git a/app/src/main/res/values-af-rZA/strings.xml b/app/src/main/res/values-af-rZA/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-af-rZA/strings.xml +++ b/app/src/main/res/values-af-rZA/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-ar-rSA/strings.xml b/app/src/main/res/values-ar-rSA/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-ar-rSA/strings.xml +++ b/app/src/main/res/values-ar-rSA/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-ca-rES/strings.xml b/app/src/main/res/values-ca-rES/strings.xml index c873cad..8e6e6ad 100644 --- a/app/src/main/res/values-ca-rES/strings.xml +++ b/app/src/main/res/values-ca-rES/strings.xml @@ -166,4 +166,5 @@ Informes d\'error Registre de depuració (s\'enviarà automàticament) Habilita el registre + Hidden Tags diff --git a/app/src/main/res/values-cs-rCZ/strings.xml b/app/src/main/res/values-cs-rCZ/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-cs-rCZ/strings.xml +++ b/app/src/main/res/values-cs-rCZ/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-da-rDK/strings.xml b/app/src/main/res/values-da-rDK/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-da-rDK/strings.xml +++ b/app/src/main/res/values-da-rDK/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml index 75aa748..a085f36 100644 --- a/app/src/main/res/values-de-rDE/strings.xml +++ b/app/src/main/res/values-de-rDE/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-el-rGR/strings.xml b/app/src/main/res/values-el-rGR/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-el-rGR/strings.xml +++ b/app/src/main/res/values-el-rGR/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 89049e0..78e37e0 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -166,4 +166,5 @@ Informe de fallos Registro de depuración (éstos se enviarán sin diálogo) Habilitar el registro + Hidden Tags diff --git a/app/src/main/res/values-fi-rFI/strings.xml b/app/src/main/res/values-fi-rFI/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-fi-rFI/strings.xml +++ b/app/src/main/res/values-fi-rFI/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-fr-rFR/strings.xml b/app/src/main/res/values-fr-rFR/strings.xml index 51e2339..a3fed96 100644 --- a/app/src/main/res/values-fr-rFR/strings.xml +++ b/app/src/main/res/values-fr-rFR/strings.xml @@ -166,4 +166,5 @@ Rapport d\'erreur Log de debug (seront envoyés automatiquement) Activer les logs + Hidden Tags diff --git a/app/src/main/res/values-gl-rES/strings.xml b/app/src/main/res/values-gl-rES/strings.xml index 52c94a6..11b42a0 100644 --- a/app/src/main/res/values-gl-rES/strings.xml +++ b/app/src/main/res/values-gl-rES/strings.xml @@ -166,4 +166,5 @@ Informes de erros Rexistro de depuración (Estes enviaranse automáticamente) Habilitar o rexistro + Hidden Tags diff --git a/app/src/main/res/values-hu-rHU/strings.xml b/app/src/main/res/values-hu-rHU/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-hu-rHU/strings.xml +++ b/app/src/main/res/values-hu-rHU/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-in-rID/strings.xml b/app/src/main/res/values-in-rID/strings.xml index 73aea1b..3235a11 100644 --- a/app/src/main/res/values-in-rID/strings.xml +++ b/app/src/main/res/values-in-rID/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-it-rIT/strings.xml b/app/src/main/res/values-it-rIT/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-it-rIT/strings.xml +++ b/app/src/main/res/values-it-rIT/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-iw-rIL/strings.xml b/app/src/main/res/values-iw-rIL/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-iw-rIL/strings.xml +++ b/app/src/main/res/values-iw-rIL/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-nl-rNL/strings.xml b/app/src/main/res/values-nl-rNL/strings.xml index 8c8dca0..eab6d8b 100644 --- a/app/src/main/res/values-nl-rNL/strings.xml +++ b/app/src/main/res/values-nl-rNL/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-no-rNO/strings.xml b/app/src/main/res/values-no-rNO/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-no-rNO/strings.xml +++ b/app/src/main/res/values-no-rNO/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-pl-rPL/strings.xml b/app/src/main/res/values-pl-rPL/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-pl-rPL/strings.xml +++ b/app/src/main/res/values-pl-rPL/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 64252ba..323ade3 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -166,4 +166,5 @@ Relatório de erro Log de depuração (Serão enviados sem uma caixa de diálogo) Ativar registro de erros + Hidden Tags diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index e1e1a5f..599689d 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-ro-rRO/strings.xml b/app/src/main/res/values-ro-rRO/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-ro-rRO/strings.xml +++ b/app/src/main/res/values-ro-rRO/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-ru-rRU/strings.xml b/app/src/main/res/values-ru-rRU/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-ru-rRU/strings.xml +++ b/app/src/main/res/values-ru-rRU/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-sr-rSP/strings.xml b/app/src/main/res/values-sr-rSP/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-sr-rSP/strings.xml +++ b/app/src/main/res/values-sr-rSP/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-sv-rSE/strings.xml b/app/src/main/res/values-sv-rSE/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-sv-rSE/strings.xml +++ b/app/src/main/res/values-sv-rSE/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml index 49d75c2..dd5240c 100644 --- a/app/src/main/res/values-tr-rTR/strings.xml +++ b/app/src/main/res/values-tr-rTR/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-uk-rUA/strings.xml b/app/src/main/res/values-uk-rUA/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-uk-rUA/strings.xml +++ b/app/src/main/res/values-uk-rUA/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-vi-rVN/strings.xml b/app/src/main/res/values-vi-rVN/strings.xml index eb764c8..f1510d0 100644 --- a/app/src/main/res/values-vi-rVN/strings.xml +++ b/app/src/main/res/values-vi-rVN/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 9ff9d99..ea95788 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 6c6fdad..7c4694d 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -166,4 +166,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ff1e867..2c19b75 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -127,6 +127,7 @@ Due to security reasons, self signed certificates are not supported by default. By activating this, I\'ll not be responsible of any security problem you encounter. Selfoss Api Loaded items number + Hidden tags. Read articles appearing as unread ? No log when marking an item as read Api calls will be logged when marking an article as read @@ -169,4 +170,5 @@ Crash reports Debug logging (these will be sent without a dialog) Enable logging + Hidden Tags diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index f34aa1d..61ed71d 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -12,6 +12,14 @@ android:singleLine="true" android:title="@string/pref_api_items_number_title" /> + +