X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2FDictionaryActivity.java;h=8d1f6fc03b3f347b33ea6c80c5521eb7df4246b5;hb=934313102f9cae5e845ceae738685848a1d272cc;hp=12839caeddcf3d6c351e0a2a137fe4508c38fc1a;hpb=2a18ab8b97ba0254a0655d595f05c492eb0eecd4;p=Dictionary.git diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index 12839ca..8d1f6fc 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -1351,7 +1351,9 @@ public class DictionaryActivity extends AppCompatActivity { Log.d(LOG, "searchFinished: " + searchOperation + ", searchResult=" + searchResult); currentSearchOperation = null; - uiHandler.postDelayed(new Runnable() { + // Note: it's important to post to the ListView, otherwise + // the jumpToRow will randomly not work. + getListView().post(new Runnable() { @Override public void run() { if (currentSearchOperation == null) { @@ -1370,7 +1372,7 @@ public class DictionaryActivity extends AppCompatActivity { Log.d(LOG, "More coming, waiting for currentSearchOperation."); } } - }, 20); + }); } private void jumpToRow(final int row) { @@ -1452,10 +1454,16 @@ public class DictionaryActivity extends AppCompatActivity { private void showHtml(final List 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( - "%s", html), + "%s", style, html), htmlTextToHighlight, false), 0); }