From 357fda20906d61792275ed2d74c1a97b649f77f5 Mon Sep 17 00:00:00 2001 From: davidoskky Date: Sun, 21 Nov 2021 23:44:03 +0100 Subject: [PATCH] Fix issues with the color selection. --- .../amine/bou/readerforselfoss/SourcesActivity.kt | 8 +------- .../readerforselfoss/settings/SettingsActivity.kt | 13 +++++++++++-- 2 files changed, 12 insertions(+), 9 deletions(-) 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 b68ae7f..1d8ba6d 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/SourcesActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/SourcesActivity.kt @@ -31,9 +31,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) super.onCreate(savedInstanceState) binding = ActivitySourcesBinding.inflate(layoutInflater) @@ -41,10 +39,6 @@ class SourcesActivity : AppCompatActivity() { setContentView(view) - val scoop = Scoop.getInstance() - scoop.bind(this, Toppings.PRIMARY.value, binding.toolbar) - scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value) - setSupportActionBar(binding.toolbar) supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayShowHomeEnabled(true) diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/settings/SettingsActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/settings/SettingsActivity.kt index 6bbdd61..3bef30a 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/settings/SettingsActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/settings/SettingsActivity.kt @@ -13,7 +13,10 @@ import androidx.core.widget.addTextChangedListener import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import apps.amine.bou.readerforselfoss.R +import apps.amine.bou.readerforselfoss.databinding.ActivitySettingsBinding +import apps.amine.bou.readerforselfoss.themes.Toppings import apps.amine.bou.readerforselfoss.utils.Config +import com.ftinc.scoop.Scoop import java.lang.NumberFormatException private const val TITLE_TAG = "settingsActivityTitle" @@ -26,7 +29,13 @@ class SettingsActivity : AppCompatActivity(), if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("dark_theme", false)) { setTheme(R.style.NoBarDark) } - setContentView(R.layout.activity_settings) + val binding = ActivitySettingsBinding.inflate(layoutInflater) + + val scoop = Scoop.getInstance() + scoop.bind(this, Toppings.PRIMARY.value, binding.toolbar) + scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value) + + setContentView(binding.root) if (savedInstanceState == null) { supportFragmentManager .beginTransaction() @@ -41,7 +50,7 @@ class SettingsActivity : AppCompatActivity(), } } - setSupportActionBar(findViewById(R.id.toolbar)) + setSupportActionBar(binding.toolbar) supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayShowHomeEnabled(true)