Support dark theme on reading webview

This commit is contained in:
Mark Anderson 2014-05-22 21:59:26 +01:00
parent 03a9edcaf2
commit 09b8fd85ab
5 changed files with 16 additions and 4 deletions

View file

@ -0,0 +1,4 @@
body {
background-color: #1A1A1A;
color: #FFF;
}

View file

@ -0,0 +1,3 @@
body {
background-color: #FFF;
}

View file

@ -1,5 +1,4 @@
body {
background-color: #FFF;
overflow: hidden;
line-height: 1.5em;
width: 100%;

View file

@ -3,7 +3,7 @@
android:id="@+id/reading_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/item_background" >
style="?itemBackground" >
<LinearLayout
android:layout_width="match_parent"
@ -31,7 +31,7 @@
android:id="@+id/reading_webview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/item_background"
style="?itemBackground"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="12dp"

View file

@ -485,7 +485,13 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
builder.append("<style style=\"text/css\">");
builder.append(String.format("body { font-size: %sem; } ", Float.toString(currentSize)));
builder.append("</style>");
builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"reading.css\" /></head><body><div class=\"NB-story\">");
builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"reading.css\" />");
if (PrefsUtils.isLightThemeSelected(getActivity())) {
builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"light_reading.css\" />");
} else {
builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"dark_reading.css\" />");
}
builder.append("</head><body><div class=\"NB-story\">");
builder.append(storyText);
builder.append("</div></body></html>");
web.loadDataWithBaseURL("file:///android_asset/", builder.toString(), "text/html", "UTF-8", null);