]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/DictionaryActivity.java
Apply theme and font selection also to HTML for web view.
[Dictionary.git] / src / com / hughes / android / dictionary / DictionaryActivity.java
index 77454f9a3e0032af41d5b056de722c577747fdc2..8d1f6fc03b3f347b33ea6c80c5521eb7df4246b5 100644 (file)
@@ -1454,10 +1454,16 @@ public class DictionaryActivity extends AppCompatActivity {
 
     private void showHtml(final List<HtmlEntry> htmlEntries, final String htmlTextToHighlight) {
         String html = HtmlEntry.htmlBody(htmlEntries, index.shortName);
+        String style = "";
+        if (typeface == Typeface.SERIF) { style = "font-family: serif;"; }
+        else if (typeface == Typeface.SANS_SERIF) { style = "font-family: sans-serif;"; }
+        else if (typeface == Typeface.MONOSPACE) { style = "font-family: monospace;"; }
+        if (application.getSelectedTheme() == DictionaryApplication.Theme.DEFAULT)
+            style += "background-color: black; color: white;";
         // Log.d(LOG, "html=" + html);
         startActivityForResult(
             HtmlDisplayActivity.getHtmlIntent(getApplicationContext(), String.format(
-                    "<html><head><meta name=\"viewport\" content=\"width=device-width\"></head><body>%s</body></html>", html),
+                    "<html><head><meta name=\"viewport\" content=\"width=device-width\"></head><body style=\"%s\">%s</body></html>", style, html),
                                               htmlTextToHighlight, false),
             0);
     }