diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index 0decd120..455799a0 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -15,6 +15,7 @@ import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.text.Html; import android.text.method.LinkMovementMethod; +import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -101,13 +102,25 @@ public class ArticleFragment extends Fragment { ws.setSupportZoom(true); ws.setBuiltInZoomControls(true); + TypedValue tv = new TypedValue(); + if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) { - cssOverride = "body { background : black; color : #e0e0e0}\na:link {color: #00aae0;} \na:visited { color: #aaaae0;}\n"; + getActivity().getTheme().resolveAttribute(android.R.attr.textColorLink, tv, true); + + cssOverride = "body { background : black; color : #e0e0e0}"; + view.setBackgroundColor(android.R.color.black); web.setBackgroundColor(android.R.color.black); } else { + getActivity().getTheme().resolveAttribute(android.R.attr.textColorLinkInverse, tv, true); + cssOverride = ""; } + int linkColor = tv.data; + String hexColor = String.format("#%06X", (0xFFFFFF & linkColor)); + + cssOverride += " a:link {color: "+hexColor+";} a:visited { color: "+hexColor+";}"; + String articleContent = m_article.content != null ? m_article.content : ""; Document doc = Jsoup.parse(articleContent); diff --git a/src/org/fox/ttrss/OfflineArticleFragment.java b/src/org/fox/ttrss/OfflineArticleFragment.java index 34efb717..95bbb121 100644 --- a/src/org/fox/ttrss/OfflineArticleFragment.java +++ b/src/org/fox/ttrss/OfflineArticleFragment.java @@ -17,6 +17,7 @@ import android.provider.BaseColumns; import android.support.v4.app.Fragment; import android.text.Html; import android.text.method.LinkMovementMethod; +import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -106,12 +107,24 @@ public class OfflineArticleFragment extends Fragment { ws.setSupportZoom(true); ws.setBuiltInZoomControls(true); + TypedValue tv = new TypedValue(); + if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) { - cssOverride = "body { background : black; color : #e0e0e0}\n"; + getActivity().getTheme().resolveAttribute(android.R.attr.textColorLink, tv, true); + + cssOverride = "body { background : black; color : #e0e0e0}"; + view.setBackgroundColor(android.R.color.black); web.setBackgroundColor(android.R.color.black); } else { + getActivity().getTheme().resolveAttribute(android.R.attr.textColorLinkInverse, tv, true); + cssOverride = ""; } + + int linkColor = tv.data; + String hexColor = String.format("#%06X", (0xFFFFFF & linkColor)); + + cssOverride += " a:link {color: "+hexColor+";} a:visited { color: "+hexColor+";}"; String articleContent = m_cursor.getString(m_cursor.getColumnIndex("content")); Document doc = Jsoup.parse(articleContent);