From 68ff9e90e7c0ecdb06ba43298839e164756d7e08 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 5 Nov 2014 22:10:01 +0300 Subject: [PATCH] make article fragment more materal-y; simplify themes a bit --- .../java/org/fox/ttrss/ArticleFragment.java | 45 +++--- .../src/main/res/layout/article_fragment.xml | 14 +- org.fox.ttrss/src/main/res/values/attrs.xml | 2 + .../src/main/res/values/resources.xml | 1 - org.fox.ttrss/src/main/res/values/style.xml | 152 +++++++----------- 5 files changed, 90 insertions(+), 124 deletions(-) diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java index 2b705389..e4205f24 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java @@ -4,14 +4,12 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; -import android.graphics.Color; import android.graphics.Typeface; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.text.Html; -import android.util.Log; import android.util.TypedValue; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; @@ -96,7 +94,7 @@ public class ArticleFragment extends Fragment { if (m_article != null) { - if (!useTitleWebView) { + /* if (!useTitleWebView) { View scroll = view.findViewById(R.id.article_scrollview); if (scroll != null) { @@ -116,7 +114,7 @@ public class ArticleFragment extends Fragment { } } - } + } */ int articleFontSize = Integer.parseInt(m_prefs.getString("article_font_size_sp", "16")); int articleSmallFontSize = Math.max(10, Math.min(18, articleFontSize - 2)); @@ -247,29 +245,23 @@ public class ArticleFragment extends Fragment { WebSettings ws = web.getSettings(); ws.setSupportZoom(false); - TypedValue tv = new TypedValue(); - getActivity().getTheme().resolveAttribute(R.attr.linkColor, tv, true); - - String theme = m_prefs.getString("theme", CommonActivity.THEME_DEFAULT); - - if (CommonActivity.THEME_DARK.equals(theme)) { - cssOverride = "body { background : transparent; color : #e0e0e0}"; - } else { - cssOverride = "body { background : transparent; }"; - } - - if (useTitleWebView || android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) { - web.setBackgroundColor(Color.TRANSPARENT); - } else { - // seriously? - web.setBackgroundColor(Color.argb(1, 0, 0, 0)); - } - - String hexColor = String.format("#%06X", (0xFFFFFF & tv.data)); - cssOverride += " a:link {color: "+hexColor+";} a:visited { color: "+hexColor+";}"; + TypedValue tvBackground = new TypedValue(); + getActivity().getTheme().resolveAttribute(R.attr.articleBackground, tvBackground, true); + + String backgroundHexColor = String.format("#%06X", (0xFFFFFF & tvBackground.data)); + + cssOverride = "body { background : "+ backgroundHexColor+"; }"; + + if (m_activity.isDarkTheme()) { + cssOverride += "body { color : #e0e0e0; }"; + } + + TypedValue tvLinkColor = new TypedValue(); + getActivity().getTheme().resolveAttribute(R.attr.linkColor, tvLinkColor, true); + + String linkHexColor = String.format("#%06X", (0xFFFFFF & tvLinkColor.data)); + cssOverride += " a:link {color: "+linkHexColor+";} a:visited { color: "+linkHexColor+";}"; - cssOverride += " table { width : 100%; }"; - String articleContent = m_article.content != null ? m_article.content : ""; Document doc = Jsoup.parse(articleContent); @@ -298,6 +290,7 @@ public class ArticleFragment extends Fragment { "" + "" + diff --git a/org.fox.ttrss/src/main/res/layout/article_fragment.xml b/org.fox.ttrss/src/main/res/layout/article_fragment.xml index e956e9b0..2f1b4498 100644 --- a/org.fox.ttrss/src/main/res/layout/article_fragment.xml +++ b/org.fox.ttrss/src/main/res/layout/article_fragment.xml @@ -16,7 +16,9 @@ android:orientation="vertical" > @@ -87,11 +89,11 @@ android:background="?articleNoteBackground" android:textColor="?articleNoteTextColor" android:textSize="13sp" - android:padding="2dp" - android:layout_marginBottom="6dp" + android:padding="8dp" android:text="[Article note]" /> diff --git a/org.fox.ttrss/src/main/res/values/attrs.xml b/org.fox.ttrss/src/main/res/values/attrs.xml index 31d5e33e..f08f757e 100644 --- a/org.fox.ttrss/src/main/res/values/attrs.xml +++ b/org.fox.ttrss/src/main/res/values/attrs.xml @@ -27,4 +27,6 @@ + + \ No newline at end of file diff --git a/org.fox.ttrss/src/main/res/values/resources.xml b/org.fox.ttrss/src/main/res/values/resources.xml index a3c4151c..9a2c3a63 100644 --- a/org.fox.ttrss/src/main/res/values/resources.xml +++ b/org.fox.ttrss/src/main/res/values/resources.xml @@ -5,7 +5,6 @@ #ffffff #EAE2DC #D3C6BA - #33b5e5 #88b0f0 #63758E #C46262 diff --git a/org.fox.ttrss/src/main/res/values/style.xml b/org.fox.ttrss/src/main/res/values/style.xml index 1fc8b25d..083a6bdf 100644 --- a/org.fox.ttrss/src/main/res/values/style.xml +++ b/org.fox.ttrss/src/main/res/values/style.xml @@ -1,120 +1,90 @@ - - - - - - - - - - + + - - - - - - - - - + + + \ No newline at end of file