diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2b3e07d..e2cb490 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@
- Added an option to use a webview in the article viewer (see #149)
-- Fixes (#151 #155)
+- Fixes (#151 #152 #155)
**1.5.5.x (didn't last long) AND 1.5.6.x**
diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt
index 0f32b6f..1206ab4 100644
--- a/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt
+++ b/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt
@@ -87,19 +87,19 @@ class MyApp : MultiDexApplication() {
private fun initTheme() {
Scoop.waffleCone()
.addFlavor(getString(R.string.default_theme), R.style.NoBar, true)
- .addFlavor(getString(R.string.default_dark_theme), R.style.NoBarDark)
+ .addDayNightFlavor(getString(R.string.default_dark_theme), R.style.NoBarDark)
.addFlavor(getString(R.string.teal_orange_theme), R.style.NoBarTealOrange)
- .addFlavor(getString(R.string.teal_orange_dark_theme), R.style.NoBarTealOrangeDark)
+ .addDayNightFlavor(getString(R.string.teal_orange_dark_theme), R.style.NoBarTealOrangeDark)
.addFlavor(getString(R.string.cyan_pink_theme), R.style.NoBarCyanPink)
- .addFlavor(getString(R.string.cyan_pink_dark_theme), R.style.NoBarCyanPinkDark)
+ .addDayNightFlavor(getString(R.string.cyan_pink_dark_theme), R.style.NoBarCyanPinkDark)
.addFlavor(getString(R.string.grey_orange_theme), R.style.NoBarGreyOrange)
- .addFlavor(getString(R.string.grey_orange_dark_theme), R.style.NoBarGreyOrangeDark)
+ .addDayNightFlavor(getString(R.string.grey_orange_dark_theme), R.style.NoBarGreyOrangeDark)
.addFlavor(getString(R.string.blue_amber_theme), R.style.NoBarBlueAmber)
- .addFlavor(getString(R.string.blue_amber_dark_theme), R.style.NoBarBlueAmberDark)
+ .addDayNightFlavor(getString(R.string.blue_amber_dark_theme), R.style.NoBarBlueAmberDark)
.addFlavor(getString(R.string.indigo_pink_theme), R.style.NoBarIndigoPink)
- .addFlavor(getString(R.string.indigo_pink_dark_theme), R.style.NoBarIndigoPinkDark)
+ .addDayNightFlavor(getString(R.string.indigo_pink_dark_theme), R.style.NoBarIndigoPinkDark)
.addFlavor(getString(R.string.red_teal_theme), R.style.NoBarRedTeal)
- .addFlavor(getString(R.string.red_teal_dark_theme), R.style.NoBarRedTealDark)
+ .addDayNightFlavor(getString(R.string.red_teal_dark_theme), R.style.NoBarRedTealDark)
.setSharedPreferences(PreferenceManager.getDefaultSharedPreferences(this))
.initialize()
}
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 65f56e4..b7959b7 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
@@ -7,6 +7,7 @@ import android.preference.PreferenceManager
import android.support.customtabs.CustomTabsIntent
import android.support.design.widget.FloatingActionButton
import android.support.v4.app.Fragment
+import android.support.v4.content.ContextCompat
import android.support.v4.widget.NestedScrollView
import android.text.Html
import android.text.method.LinkMovementMethod
@@ -30,6 +31,7 @@ import apps.amine.bou.readerforselfoss.utils.sourceAndDateText
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.crashlytics.android.Crashlytics
+import com.ftinc.scoop.Scoop
import com.github.rubensousa.floatingtoolbar.FloatingToolbar
import kotlinx.android.synthetic.main.fragment_article.view.*
import org.sufficientlysecure.htmltextview.HtmlHttpImageGetter
@@ -237,12 +239,6 @@ class ArticleFragment : Fragment() {
}
private fun htmlToWebview(c: String) {
- val attrBackground = TypedValue()
- activity!!.baseContext.theme.resolveAttribute(
- android.R.attr.colorBackground,
- attrBackground,
- true
- )
val defaultColor = TypedValue()
activity!!.baseContext.theme.resolveAttribute(
@@ -254,7 +250,16 @@ class ArticleFragment : Fragment() {
val stringColor = String.format("#%06X", 0xFFFFFF and accentColor)
rootView.webcontent.visibility = View.VISIBLE
- rootView.webcontent.setBackgroundColor(attrBackground.data)
+ val textColor = if (Scoop.getInstance().currentFlavor.isDayNight) {
+ rootView.webcontent.setBackgroundColor(ContextCompat.getColor(activity!!.baseContext, R.color.dark_webview))
+ ContextCompat.getColor(activity!!.baseContext, R.color.dark_webview_text)
+ } else {
+ rootView.webcontent.setBackgroundColor(ContextCompat.getColor(activity!!.baseContext, R.color.light_webview))
+ ContextCompat.getColor(activity!!.baseContext, R.color.light_webview_text)
+ }
+
+ val stringTextColor = String.format("#%06X", 0xFFFFFF and textColor)
+
rootView.webcontent.settings.useWideViewPort = true
rootView.webcontent.settings.loadWithOverviewMode = true
rootView.webcontent.settings.javaScriptEnabled = false
@@ -266,7 +271,7 @@ class ArticleFragment : Fragment() {
}
rootView.webcontent.loadData(
- "$c",
+ "$c",
"text/html; charset=utf-8",
"utf-8"
)
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 582484a..c52e6d6 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -11,4 +11,9 @@
@color/colorAccent
@color/pink
#FFe4e4e4
+
+ #FF303030
+ @color/md_white_1000
+ @color/md_grey_50
+ @color/md_grey_900