From 721a15ec219de36e8ae7a5cf3139021b4daf21e9 Mon Sep 17 00:00:00 2001 From: davidoskky Date: Mon, 15 Nov 2021 21:17:48 +0100 Subject: [PATCH] Upgrade minsdk to 21 (#378) * Upgrade minSdk * Add changelog entry about the upgrade * Remove obsolete version checks --- CHANGELOG.md | 2 ++ app/build.gradle | 2 +- .../bou/readerforselfoss/AddSourceActivity.kt | 23 ++++--------------- .../bou/readerforselfoss/HomeActivity.kt | 9 ++------ .../bou/readerforselfoss/ReaderActivity.kt | 4 +--- .../bou/readerforselfoss/SourcesActivity.kt | 5 +--- .../fragments/ArticleFragment.kt | 9 ++------ 7 files changed, 13 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d952d2..248a5b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,8 @@ - Closing #236. New sources can be added in Selfoss 2.19. +- Dropped support for android 4, the last version supporting it is v1721030811 + **1.6.x** - Handling hidden tags. diff --git a/app/build.gradle b/app/build.gradle index 2b69397..4131a62 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -45,7 +45,7 @@ android { } defaultConfig { applicationId "apps.amine.bou.readerforselfoss" - minSdkVersion 16 + minSdkVersion 21 targetSdkVersion 31 versionCode versionCodeFromGit() versionName versionNameFromGit() diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/AddSourceActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/AddSourceActivity.kt index f3e8e10..ad2bb5d 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/AddSourceActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/AddSourceActivity.kt @@ -2,7 +2,6 @@ package apps.amine.bou.readerforselfoss import android.content.Context import android.content.Intent -import android.os.Build import android.os.Bundle import androidx.preference.PreferenceManager import androidx.constraintlayout.widget.ConstraintLayout @@ -50,38 +49,24 @@ class AddSourceActivity : AppCompatActivity() { val scoop = Scoop.getInstance() scoop.bind(this, Toppings.PRIMARY.value, binding.toolbar) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value) - } + scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value) val drawable = binding.nameInput.background drawable.setColorFilter(appColors.colorAccent, PorterDuff.Mode.SRC_ATOP) // TODO: clean - if(Build.VERSION.SDK_INT > 16) { - binding.nameInput.background = drawable - } else{ - binding.nameInput.setBackgroundDrawable(drawable) - } + binding.nameInput.background = drawable val drawable1 = binding.sourceUri.background drawable1.setColorFilter(appColors.colorAccent, PorterDuff.Mode.SRC_ATOP) - if(Build.VERSION.SDK_INT > 16) { - binding.sourceUri.background = drawable1 - } else{ - binding.sourceUri.setBackgroundDrawable(drawable1) - } + binding.sourceUri.background = drawable1 val drawable2 = binding.tags.background drawable2.setColorFilter(appColors.colorAccent, PorterDuff.Mode.SRC_ATOP) - if(Build.VERSION.SDK_INT > 16) { - binding.tags.background = drawable2 - } else{ - binding.tags.setBackgroundDrawable(drawable2) - } + binding.tags.background = drawable2 setSupportActionBar(binding.toolbar) supportActionBar?.setDisplayHomeAsUpEnabled(true) 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 13f4048..9bb9c48 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt @@ -7,7 +7,6 @@ import android.graphics.Color import android.graphics.drawable.Drawable import android.graphics.drawable.GradientDrawable import android.net.Uri -import android.os.Build import android.os.Bundle import androidx.preference.PreferenceManager import android.view.Menu @@ -436,9 +435,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { private fun handleThemeBinding() { val scoop = Scoop.getInstance() scoop.bind(this, Toppings.PRIMARY.value, binding.toolBar) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value) - } + scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value) } private fun handleThemeUpdate() { @@ -446,9 +443,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { val scoop = Scoop.getInstance() scoop.update(Toppings.PRIMARY.value, appColors.colorPrimary) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - scoop.update(Toppings.PRIMARY_DARK.value, appColors.colorPrimaryDark) - } + scoop.update(Toppings.PRIMARY_DARK.value, appColors.colorPrimaryDark) } private fun handleDrawer() { diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt index 8837081..6a23c55 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt @@ -85,9 +85,7 @@ class ReaderActivity : AppCompatActivity() { val scoop = Scoop.getInstance() scoop.bind(this, Toppings.PRIMARY.value, binding.toolBar) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value) - } + scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value) setSupportActionBar(binding.toolBar) supportActionBar?.setDisplayHomeAsUpEnabled(true) diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/SourcesActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/SourcesActivity.kt index 492f22c..b6453a3 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/SourcesActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/SourcesActivity.kt @@ -3,7 +3,6 @@ package apps.amine.bou.readerforselfoss import android.content.Context import android.content.Intent import android.content.res.ColorStateList -import android.os.Build import android.os.Bundle import androidx.preference.PreferenceManager import androidx.appcompat.app.AppCompatActivity @@ -38,9 +37,7 @@ class SourcesActivity : AppCompatActivity() { val scoop = Scoop.getInstance() scoop.bind(this, Toppings.PRIMARY.value, binding.toolbar) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value) - } + scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value) setSupportActionBar(binding.toolbar) supportActionBar?.setDisplayHomeAsUpEnabled(true) diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt index 0514036..d0ba5bb 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt @@ -9,7 +9,6 @@ import android.graphics.Bitmap import android.graphics.Typeface import android.graphics.drawable.ColorDrawable import android.net.Uri -import android.os.Build import android.os.Bundle import androidx.preference.PreferenceManager import android.view.* @@ -474,12 +473,8 @@ class ArticleFragment : Fragment() { binding.webcontent.setOnTouchListener { _, event -> gestureDetector.onTouchEvent(event)} - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - binding.webcontent.settings.layoutAlgorithm = - WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING - } else { - binding.webcontent.settings.layoutAlgorithm = WebSettings.LayoutAlgorithm.SINGLE_COLUMN - } + binding.webcontent.settings.layoutAlgorithm = + WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING var baseUrl: String? = null