From 7fb54f14c795895386447e6ff0c24f6752212612 Mon Sep 17 00:00:00 2001 From: Amine Date: Sat, 15 Sep 2018 16:08:08 +0200 Subject: [PATCH] Fixed bug --- .../bou/readerforselfoss/ReaderActivity.kt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 609d39e..54aaf3e 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt @@ -3,6 +3,7 @@ package apps.amine.bou.readerforselfoss import android.graphics.drawable.ColorDrawable import android.os.Build import android.os.Bundle +import android.preference.PreferenceManager import android.support.v4.app.FragmentManager import android.support.v4.app.FragmentStatePagerAdapter import android.support.v4.content.ContextCompat @@ -63,6 +64,15 @@ class ReaderActivity : AppCompatActivity() { supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayShowHomeEnabled(true) + val prefs = PreferenceManager.getDefaultSharedPreferences(this) + + api = SelfossApi( + this, + this@ReaderActivity, + prefs.getBoolean("isSelfSignedCert", false), + prefs.getBoolean("should_log_everything", false) + ) + if (allItems.isEmpty()) { finish() @@ -77,12 +87,16 @@ class ReaderActivity : AppCompatActivity() { override fun onResume() { super.onResume() - (pager.adapter as ScreenSlidePagerAdapter).notifyDataSetChanged() + notifyAdapter() pager.setPageTransformer(true, DepthPageTransformer()) (indicator as CircleIndicator).setViewPager(pager) } + private fun notifyAdapter() { + (pager.adapter as ScreenSlidePagerAdapter).notifyDataSetChanged() + } + override fun onPause() { super.onPause() if (markOnScroll) { @@ -142,6 +156,7 @@ class ReaderActivity : AppCompatActivity() { response: Response ) { allItems[pager.currentItem] = allItems[pager.currentItem].toggleStar() + notifyAdapter() canRemoveFromFavorite() } @@ -165,6 +180,7 @@ class ReaderActivity : AppCompatActivity() { response: Response ) { allItems[pager.currentItem] = allItems[pager.currentItem].toggleStar() + notifyAdapter() canFavorite() }