From ddc754ec259de46442584151253dde1610cbb306 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 15 Jan 2019 19:54:46 +0100 Subject: [PATCH] Closes #270. --- .../apps/amine/bou/readerforselfoss/AddSourceActivity.kt | 5 ++++- .../java/apps/amine/bou/readerforselfoss/ReaderActivity.kt | 7 ++++++- .../apps/amine/bou/readerforselfoss/SourcesActivity.kt | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) 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 b444be7..947d295 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/AddSourceActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/AddSourceActivity.kt @@ -1,5 +1,6 @@ package apps.amine.bou.readerforselfoss +import android.content.Context import android.content.Intent import android.os.Build import android.os.Bundle @@ -85,10 +86,12 @@ class AddSourceActivity : AppCompatActivity() { try { val prefs = PreferenceManager.getDefaultSharedPreferences(this) + val settings = + getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE) api = SelfossApi( this, this@AddSourceActivity, - prefs.getBoolean("isSelfSignedCert", false), + settings.getBoolean("isSelfSignedCert", false), prefs.getString("api_timeout", "-1").toLong(), prefs.getBoolean("should_log_everything", false) ) 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 413733d..e2b2fc2 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt @@ -1,5 +1,6 @@ package apps.amine.bou.readerforselfoss +import android.content.Context import android.content.SharedPreferences import android.graphics.drawable.ColorDrawable import android.os.Build @@ -27,6 +28,7 @@ import apps.amine.bou.readerforselfoss.persistence.migrations.MIGRATION_2_3 import apps.amine.bou.readerforselfoss.themes.AppColors import apps.amine.bou.readerforselfoss.themes.Toppings import apps.amine.bou.readerforselfoss.transformers.DepthPageTransformer +import apps.amine.bou.readerforselfoss.utils.Config import apps.amine.bou.readerforselfoss.utils.maybeHandleSilentException import apps.amine.bou.readerforselfoss.utils.network.isNetworkAccessible import apps.amine.bou.readerforselfoss.utils.persistence.toEntity @@ -94,6 +96,9 @@ class ReaderActivity : AppCompatActivity() { supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayShowHomeEnabled(true) + val settings = + getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE) + prefs = PreferenceManager.getDefaultSharedPreferences(this) editor = prefs.edit() @@ -105,7 +110,7 @@ class ReaderActivity : AppCompatActivity() { api = SelfossApi( this, this@ReaderActivity, - prefs.getBoolean("isSelfSignedCert", false), + settings.getBoolean("isSelfSignedCert", false), prefs.getString("api_timeout", "-1").toLong(), prefs.getBoolean("should_log_everything", false) ) 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 2c13460..e8bc716 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/SourcesActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/SourcesActivity.kt @@ -1,5 +1,6 @@ package apps.amine.bou.readerforselfoss +import android.content.Context import android.content.Intent import android.content.res.ColorStateList import android.os.Build @@ -13,6 +14,7 @@ import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi import apps.amine.bou.readerforselfoss.api.selfoss.Source import apps.amine.bou.readerforselfoss.themes.AppColors import apps.amine.bou.readerforselfoss.themes.Toppings +import apps.amine.bou.readerforselfoss.utils.Config import apps.amine.bou.readerforselfoss.utils.network.isNetworkAccessible import com.ftinc.scoop.Scoop import kotlinx.android.synthetic.main.activity_sources.* @@ -54,12 +56,14 @@ class SourcesActivity : AppCompatActivity() { super.onResume() val mLayoutManager = LinearLayoutManager(this) + val settings = + getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE) val prefs = PreferenceManager.getDefaultSharedPreferences(this) val api = SelfossApi( this, this@SourcesActivity, - prefs.getBoolean("isSelfSignedCert", false), + settings.getBoolean("isSelfSignedCert", false), prefs.getString("api_timeout", "-1").toLong(), prefs.getBoolean("should_log_everything", false) )