From 1994fa2f7df3fd75711fc27be75675765fcbec1f Mon Sep 17 00:00:00 2001 From: davidoskky Date: Tue, 26 Oct 2021 20:16:38 +0200 Subject: [PATCH] Add option to always show the bottom bar in the article reader (#368) --- .../readerforselfoss/fragments/ArticleFragment.kt | 14 +++++++++++++- app/src/main/res/values/strings.xml | 3 +++ app/src/main/res/xml/pref_general.xml | 7 +++++++ 3 files changed, 23 insertions(+), 1 deletion(-) 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 ed155eb..11d8503 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 @@ -77,6 +77,7 @@ class ArticleFragment : Fragment() { private var typeface: Typeface? = null private var resId: Int = 0 private var font = "" + private var staticBar = false override fun onStop() { super.onStop() @@ -118,6 +119,7 @@ class ArticleFragment : Fragment() { prefs = PreferenceManager.getDefaultSharedPreferences(activity) editor = prefs.edit() fontSize = prefs.getString("reader_font_size", "16")!!.toInt() + staticBar = prefs.getBoolean("reader_static_bar", false) font = prefs.getString("reader_font", "")!! if (font.isNotEmpty()) { @@ -211,6 +213,11 @@ class ArticleFragment : Fragment() { } ) + if (staticBar) { + fab.hide() + floatingToolbar.show() + } + binding.source.text = contentSource if (typeface != null) { binding.source.typeface = typeface @@ -242,9 +249,14 @@ class ArticleFragment : Fragment() { binding.nestedScrollView.setOnScrollChangeListener( NestedScrollView.OnScrollChangeListener { _, _, scrollY, _, oldScrollY -> if (scrollY > oldScrollY) { + floatingToolbar.hide() fab.hide() } else { - if (floatingToolbar.isShowing) floatingToolbar.hide() else fab.show() + if (staticBar) { + floatingToolbar.show() + } else { + if (floatingToolbar.isShowing) floatingToolbar.hide() else fab.show() + } } } ) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fca4be6..f9dd537 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -165,4 +165,7 @@ Reader font open_sans roboto + Static bottom bar in the article viewer + The bottom bar will always be displayed + The bottom bar can be shown through the floating button diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index 10763e3..d4324f1 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -41,6 +41,13 @@ android:summaryOff="@string/prefer_article_viewer_off" android:summaryOn="@string/prefer_article_viewer_on" android:title="@string/prefer_article_viewer_title" /> +