From 493fca9144c6f2078880ab898a9560203a6485d8 Mon Sep 17 00:00:00 2001 From: nwuensche Date: Mon, 26 Aug 2019 11:37:04 +0200 Subject: [PATCH 1/3] Add overflow/prewrap CSS for all three themes --- app/src/main/assets/dark.css | 8 ++++++++ app/src/main/assets/main.css | 8 ++++++++ app/src/main/assets/solarized.css | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/app/src/main/assets/dark.css b/app/src/main/assets/dark.css index d5bb51ed0..6275701b3 100755 --- a/app/src/main/assets/dark.css +++ b/app/src/main/assets/dark.css @@ -233,6 +233,14 @@ header.mbm { text-justify: none; } +.pre-overflow #article pre { + overflow: auto; +} + +.pre-prewrap #article pre { + white-space: pre-wrap; +} + #article blockquote *, #article pre * { background: inherit; } diff --git a/app/src/main/assets/main.css b/app/src/main/assets/main.css index d46ea66f1..7d9a0b873 100755 --- a/app/src/main/assets/main.css +++ b/app/src/main/assets/main.css @@ -226,6 +226,14 @@ header.mbm { text-justify: none; } +.pre-overflow #article pre { + overflow: auto; +} + +.pre-prewrap #article pre { + white-space: pre-wrap; +} + #article blockquote *, #article pre * { background: inherit; } diff --git a/app/src/main/assets/solarized.css b/app/src/main/assets/solarized.css index 45422b31d..667f41e75 100755 --- a/app/src/main/assets/solarized.css +++ b/app/src/main/assets/solarized.css @@ -241,6 +241,14 @@ header.mbm { text-justify: none; } +.pre-overflow #article pre { + overflow: auto; +} + +.pre-prewrap #article pre { + white-space: pre-wrap; +} + #article blockquote *, #article pre * { background: inherit; } From 3d06a728016c89e3154a5556238fc5c8922a654a Mon Sep 17 00:00:00 2001 From: nwuensche Date: Mon, 26 Aug 2019 11:37:51 +0200 Subject: [PATCH 2/3] Add text and layout for overflow/prewrap setting --- app/src/main/res/values-de/strings.xml | 6 ++++++ app/src/main/res/values/arrays.xml | 4 ++++ app/src/main/res/values/strings-preference-keys.xml | 1 + app/src/main/res/values/strings.xml | 6 ++++++ app/src/main/res/xml/preferences.xml | 8 ++++++++ 5 files changed, 25 insertions(+) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 57b18045d..bd5f5e484 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -246,6 +246,12 @@ Textausrichtung: Blocksatz Streckt die Textzeilen, so dass jede Zeile die gleiche Breite hat (wie in Zeitungen) + Umgang mit langen Textzeilen + Standardoption im Umgang mit vorformatiertem Text, welcher nicht vollständig auf das Display passt. + + Scroll innerhalb des Fensters (overflow) + Breche Zeilen um (pre-wrap) + Lesegeschwindigkeit Deine Lesegeschwindigkeit (gemessen in Wörtern pro Minute). Zum Berechnen der geschätzten Lesezeit genutzt. Bildschirm während Lesens anlassen diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index d20ae84c7..7eb65fad1 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -1,5 +1,9 @@ + + pre-overflow + pre-prewrap + 100 150 diff --git a/app/src/main/res/values/strings-preference-keys.xml b/app/src/main/res/values/strings-preference-keys.xml index 8d844c298..10d1fd91a 100644 --- a/app/src/main/res/values/strings-preference-keys.xml +++ b/app/src/main/res/values/strings-preference-keys.xml @@ -23,6 +23,7 @@ ui.article.fontSize ui.article.fontSerif ui.article.textAlignment.justify + ui.article.handlePreformattedText ui.readingSpeed ui.keepScreenOn ui.lists.sortOrder diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 72206acdd..c6f304cd2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -204,6 +204,12 @@ Serif font for articles Text alignment: Justify Stretches lines to equal width (like in newspapers) + Handling Long Preformatted Text + How To handle preformatted text that is too long to show completely. + + Scroll inside window (overflow) + Break lines (pre-wrap) + Fullscreen Article View Hides system and app bars when reading articles Reading speed diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index a0b976541..5174baac3 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -104,6 +104,14 @@ android:title="@string/pref_name_ui_article_textAlignment_justify" android:summary="@string/pref_desc_ui_article_textAlignment_justify" android:defaultValue="true"/> + Date: Mon, 26 Aug 2019 11:39:05 +0200 Subject: [PATCH 3/3] Handle and apply overflow/prewrap setting to articles --- .../main/java/fr/gaulupeau/apps/Poche/data/Settings.java | 8 ++++++++ .../fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java | 1 + 2 files changed, 9 insertions(+) diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/data/Settings.java b/app/src/main/java/fr/gaulupeau/apps/Poche/data/Settings.java index 3566be3ce..4cfd02a4e 100644 --- a/app/src/main/java/fr/gaulupeau/apps/Poche/data/Settings.java +++ b/app/src/main/java/fr/gaulupeau/apps/Poche/data/Settings.java @@ -364,6 +364,14 @@ public void setArticleTextAlignmentJustify(boolean value) { setBoolean(R.string.pref_key_ui_article_textAlignment_justify, value); } + public String getHandlePreformattedTextOption() { + return getString(R.string.pref_key_ui_article_handlePreformattedText, "pre-overflow"); + } + + public void setHandlePreformattedTextOption(String value) { + setString(R.string.pref_key_ui_article_handlePreformattedText, value); + } + public boolean isFullscreenArticleView() { return getBoolean(R.string.pref_key_ui_article_fullscreen, false); } diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java index 1c71699df..c9188051d 100644 --- a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java +++ b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java @@ -683,6 +683,7 @@ private String getHtmlPage() { if(weightedFont) additionalClasses.add("weighted-font"); if(settings.isArticleFontSerif()) additionalClasses.add("serif-font"); if(settings.isArticleTextAlignmentJustify()) additionalClasses.add("text-align-justify"); + additionalClasses.add(settings.getHandlePreformattedTextOption()); String classAttr; if(!additionalClasses.isEmpty()) {