summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2012-11-23 18:44:15 +0100
committerdaniel oeh <daniel.oeh@gmail.com>2012-11-23 18:44:15 +0100
commitcaa00a97cb6cb984f0e71ab06a72e4b2514320fb (patch)
tree937b33eb29d2d5adb624ee3e7aeba0de7bbb9252 /src
parent56b93247feceebad93d0c141c85d9d09a58674ae (diff)
downloadAntennaPod-caa00a97cb6cb984f0e71ab06a72e4b2514320fb.zip
Added dark version of borderless button
Diffstat (limited to 'src')
-rw-r--r--src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
index 8452f24c1..a25279e1c 100644
--- a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
+++ b/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
@@ -2,12 +2,15 @@ package de.danoeh.antennapod.fragment;
import org.apache.commons.lang3.StringEscapeUtils;
+import android.R;
import android.annotation.SuppressLint;
import android.app.Activity;
+import android.content.res.TypedArray;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
+import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -27,8 +30,6 @@ public class ItemDescriptionFragment extends SherlockFragment {
private static final String ARG_FEED_ID = "arg.feedId";
private static final String ARG_FEEDITEM_ID = "arg.feedItemId";
- private static final String WEBVIEW_STYLE = "<head><style type=\"text/css\"> * { font-family: Helvetica; line-height: 1.5em; font-size: 12pt; } a { font-style: normal; text-decoration: none; font-weight: normal; color: #00A8DF; }</style></head>";
-
private WebView webvDescription;
private FeedItem item;
@@ -52,6 +53,7 @@ public class ItemDescriptionFragment extends SherlockFragment {
if (AppConfig.DEBUG)
Log.d(TAG, "Creating view");
webvDescription = new WebView(getActivity());
+ webvDescription.setBackgroundColor(0);
webvDescription.getSettings().setUseWideViewPort(false);
return webvDescription;
}
@@ -151,6 +153,14 @@ public class ItemDescriptionFragment extends SherlockFragment {
webViewLoader.execute();
}
}
+
+ /** Return the CSS style of the Webview.
+ * @param textColor the default color to use for the text in the webview. This value is inserted directly into the CSS String.
+ * */
+ private String getWebViewStyle(String textColor) {
+ final String WEBVIEW_STYLE = "<head><style type=\"text/css\"> * { color: %s; font-family: Helvetica; line-height: 1.5em; font-size: 12pt; } a { font-style: normal; text-decoration: none; font-weight: normal; color: #00A8DF; }</style></head>";
+ return String.format(WEBVIEW_STYLE, textColor);
+ }
private AsyncTask<Void, Void, Void> createLoader() {
return new AsyncTask<Void, Void, Void>() {
@@ -201,8 +211,13 @@ public class ItemDescriptionFragment extends SherlockFragment {
} else {
data = StringEscapeUtils.unescapeHtml4(contentEncodedRef);
}
-
- data = WEBVIEW_STYLE + data;
+
+ TypedArray res = getActivity().getTheme().obtainStyledAttributes(new int[] {android.R.attr.textColorPrimary});
+ int colorResource = res.getColor(0, 0);
+ String colorString = String.format("#%06X", 0xFFFFFF & colorResource);
+ Log.i(TAG, "text color: " + colorString);
+ res.recycle();
+ data = getWebViewStyle(colorString) + data;
return null;
}