diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d1a8f33..343d907 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -77,6 +77,9 @@
android:value="true" />
+
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 ea99349..b0e9e13 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
@@ -3,6 +3,8 @@ package apps.amine.bou.readerforselfoss.fragments
import android.content.Context
import android.content.SharedPreferences
import android.content.res.ColorStateList
+import android.content.res.TypedArray
+import android.graphics.Typeface
import android.graphics.drawable.ColorDrawable
import android.os.Build
import android.os.Bundle
@@ -19,6 +21,7 @@ import android.view.View
import android.view.ViewGroup
import android.webkit.WebSettings
import androidx.appcompat.app.AlertDialog
+import androidx.core.content.res.ResourcesCompat
import androidx.room.Room
import apps.amine.bou.readerforselfoss.R
import apps.amine.bou.readerforselfoss.api.mercury.MercuryApi
@@ -45,6 +48,7 @@ import apps.amine.bou.readerforselfoss.utils.succeeded
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.github.rubensousa.floatingtoolbar.FloatingToolbar
+import kotlinx.android.synthetic.main.fragment_article.*
import kotlinx.android.synthetic.main.fragment_article.view.*
import org.acra.ACRA
import retrofit2.Call
@@ -97,6 +101,9 @@ class ArticleFragment : Fragment() {
private lateinit var prefs: SharedPreferences
+ private lateinit var typeface: Typeface
+ private var resId: Int = 0
+
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
@@ -106,6 +113,9 @@ class ArticleFragment : Fragment() {
rootView = inflater
.inflate(R.layout.fragment_article, container, false) as ViewGroup
+ resId = context!!.resources.getIdentifier("aguafina_script", "font", context!!.packageName)
+ typeface = ResourcesCompat.getFont(context!!, resId)!!
+
url = allItems[pageNumber.toInt()].getLinkDecoded()
contentText = allItems[pageNumber.toInt()].content
contentTitle = allItems[pageNumber.toInt()].title
@@ -204,11 +214,13 @@ class ArticleFragment : Fragment() {
)
rootView!!.source.text = contentSource
+ rootView!!.source.typeface = typeface
if (contentText.isEmptyOrNullOrNullString()) {
getContentFromMercury(customTabsIntent, prefs)
} else {
rootView!!.titleView.text = contentTitle
+ rootView!!.titleView.typeface = typeface
htmlToWebview()
@@ -283,6 +295,7 @@ class ArticleFragment : Fragment() {
if (response.body() != null && response.body()!!.content != null && !response.body()!!.content.isNullOrEmpty()) {
try {
rootView!!.titleView.text = response.body()!!.title
+ rootView!!.titleView.typeface = typeface
try {
// Note: Mercury may return relative urls... If it does the url val will not be changed.
URL(response.body()!!.url)
@@ -364,6 +377,11 @@ class ArticleFragment : Fragment() {
private fun htmlToWebview() {
val stringColor = String.format("#%06X", 0xFFFFFF and appColors.colorAccent)
+ val attrs: IntArray = intArrayOf(android.R.attr.fontFamily)
+ val a: TypedArray = context!!.obtainStyledAttributes(resId, attrs)
+
+
+ rootView!!.webcontent.settings.standardFontFamily = a.getString(0)
rootView!!.webcontent.visibility = View.VISIBLE
val (textColor, backgroundColor) = if (appColors.isDarkTheme) {
if (context != null) {
diff --git a/app/src/main/res/font/abril_fatface.xml b/app/src/main/res/font/abril_fatface.xml
new file mode 100644
index 0000000..2299e59
--- /dev/null
+++ b/app/src/main/res/font/abril_fatface.xml
@@ -0,0 +1,7 @@
+
+
+
diff --git a/app/src/main/res/font/aguafina_script.ttf b/app/src/main/res/font/aguafina_script.ttf
new file mode 100644
index 0000000..78a3555
Binary files /dev/null and b/app/src/main/res/font/aguafina_script.ttf differ
diff --git a/app/src/main/res/font/open_sans.xml b/app/src/main/res/font/open_sans.xml
new file mode 100644
index 0000000..f9284b2
--- /dev/null
+++ b/app/src/main/res/font/open_sans.xml
@@ -0,0 +1,7 @@
+
+
+
diff --git a/app/src/main/res/font/roboto.xml b/app/src/main/res/font/roboto.xml
new file mode 100644
index 0000000..2641caf
--- /dev/null
+++ b/app/src/main/res/font/roboto.xml
@@ -0,0 +1,7 @@
+
+
+
diff --git a/app/src/main/res/layout/fragment_article.xml b/app/src/main/res/layout/fragment_article.xml
index ee087c4..b0f6894 100644
--- a/app/src/main/res/layout/fragment_article.xml
+++ b/app/src/main/res/layout/fragment_article.xml
@@ -31,8 +31,9 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
- android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
+ android:layout_marginRight="16dp"
+ android:fontFamily="@font/aguafina_script"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textSize="12sp"
app:layout_constraintHorizontal_bias="0.0"
diff --git a/app/src/main/res/values/font_certs.xml b/app/src/main/res/values/font_certs.xml
new file mode 100644
index 0000000..d2226ac
--- /dev/null
+++ b/app/src/main/res/values/font_certs.xml
@@ -0,0 +1,17 @@
+
+
+
+ - @array/com_google_android_gms_fonts_certs_dev
+ - @array/com_google_android_gms_fonts_certs_prod
+
+
+ -
+ MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhb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FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
+
+
+
diff --git a/app/src/main/res/values/preloaded_fonts.xml b/app/src/main/res/values/preloaded_fonts.xml
new file mode 100644
index 0000000..469ee89
--- /dev/null
+++ b/app/src/main/res/values/preloaded_fonts.xml
@@ -0,0 +1,8 @@
+
+
+
+ - @font/abril_fatface
+ - @font/open_sans
+ - @font/roboto
+
+
diff --git a/app/src/main/res/xml/pref_viewer.xml b/app/src/main/res/xml/pref_viewer.xml
index 8fdc6c0..8cee815 100644
--- a/app/src/main/res/xml/pref_viewer.xml
+++ b/app/src/main/res/xml/pref_viewer.xml
@@ -13,4 +13,12 @@
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="@string/pref_content_reader_font_size" />
+
+
+