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 aa0efd5..555bf0f 100644
--- a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt
+++ b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt
@@ -577,9 +577,9 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
LibsBuilder()
.withActivityStyle(
if (appColors.isDarkTheme) {
- Libs.ActivityStyle.LIGHT_DARK_TOOLBAR
- } else {
Libs.ActivityStyle.DARK
+ } else {
+ Libs.ActivityStyle.LIGHT_DARK_TOOLBAR
}
)
.withAboutIconShown(true)
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 82e5a70..af1c77d 100644
--- a/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt
+++ b/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt
@@ -2,14 +2,17 @@ package apps.amine.bou.readerforselfoss
import android.content.Context
import android.content.res.Resources
+import android.graphics.drawable.ColorDrawable
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
import android.support.v4.view.ViewPager
import android.support.v7.app.AppCompatActivity
import android.view.Menu
import android.view.MenuItem
+import android.view.ViewGroup
import android.widget.Toast
import apps.amine.bou.readerforselfoss.api.selfoss.Item
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
@@ -54,8 +57,6 @@ class ReaderActivity : AppCompatActivity() {
}
override fun onCreate(savedInstanceState: Bundle?) {
- val appColors = AppColors(this@ReaderActivity)
-
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_reader)
@@ -88,7 +89,7 @@ class ReaderActivity : AppCompatActivity() {
currentItem = intent.getIntExtra("currentItem", 0)
- pager.adapter = ScreenSlidePagerAdapter(supportFragmentManager)
+ pager.adapter = ScreenSlidePagerAdapter(supportFragmentManager, AppColors(this@ReaderActivity))
pager.currentItem = currentItem
}
@@ -175,8 +176,10 @@ class ReaderActivity : AppCompatActivity() {
oldInstanceState!!.clear()
}
- private inner class ScreenSlidePagerAdapter(fm: FragmentManager) :
+ private inner class ScreenSlidePagerAdapter(fm: FragmentManager, val appColors: AppColors) :
FragmentStatePagerAdapter(fm) {
+
+
override fun getCount(): Int {
return allItems.size
}
@@ -184,6 +187,12 @@ class ReaderActivity : AppCompatActivity() {
override fun getItem(position: Int): ArticleFragment {
return ArticleFragment.newInstance(position, allItems)
}
+
+ override fun startUpdate(container: ViewGroup) {
+ super.startUpdate(container)
+
+ container.background = ColorDrawable(ContextCompat.getColor(this@ReaderActivity, appColors.colorBackground))
+ }
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/themes/AppColors.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/themes/AppColors.kt
index dd752b4..2b24d77 100644
--- a/app/src/main/java/apps/amine/bou/readerforselfoss/themes/AppColors.kt
+++ b/app/src/main/java/apps/amine/bou/readerforselfoss/themes/AppColors.kt
@@ -17,6 +17,7 @@ class AppColors(a: Activity) {
@ColorInt val colorAccent: Int
@ColorInt val colorAccentDark: Int
@ColorInt val cardBackgroundColor: Int
+ @ColorInt val colorBackground: Int
val isDarkTheme: Boolean
init {
@@ -48,10 +49,12 @@ class AppColors(a: Activity) {
false
)
- if (isDarkTheme) {
+ colorBackground = if (isDarkTheme) {
a.setTheme(R.style.NoBarDark)
+ R.color.darkBackground
} else {
a.setTheme(R.style.NoBar)
+ android.R.color.background_light
}
val wrapper = Context::class.java
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 3f9c443..e440c82 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -24,7 +24,7 @@
- @color/colorAccent
- @color/colorAccentDark
- @color/md_grey_800
- - #303030
+ - @color/darkBackground
- @color/md_grey_900
- @color/md_white_1000
- @color/md_grey_600
diff --git a/build.gradle b/build.gradle
index 169ef9e..e6e2002 100644
--- a/build.gradle
+++ b/build.gradle
@@ -10,7 +10,7 @@ buildscript {
}
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.1.1'
+ classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong