volatile boolean ttsReady;
int textColorFg = Color.BLACK;
+
private final Executor searchExecutor = Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
onUpDownButton(false);
}
});
+ upButton.setVisibility(PreferenceManager.getDefaultSharedPreferences(this)
+ .getBoolean(getString(R.string.showPrevNextButtonsKey), true) ? View.VISIBLE
+ : View.GONE);
+ downButton.setVisibility(PreferenceManager.getDefaultSharedPreferences(this)
+ .getBoolean(getString(R.string.showPrevNextButtonsKey), true) ? View.VISIBLE
+ : View.GONE);
// getListView().setOnItemSelectedListener(new ListView.OnItemSelectedListener() {
// @Override
@Override
public void run() {
Log.d(LOG, "Trying to show soft keyboard.");
+ final boolean searchTextHadFocus = searchText.hasFocus();
+ searchText.requestFocus();
final InputMethodManager manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
manager.showSoftInput(searchText, InputMethodManager.SHOW_IMPLICIT);
+ if (!searchTextHadFocus) {
+ defocusSearchText();
+ }
}}, 100);
}
}
private void updateTTSLanuage() {
- if (!ttsReady) {
+ if (!ttsReady || index == null || textToSpeech == null) {
+ Log.d(LOG, "Can't updateTTSLanguage.");
return;
}
final Locale locale = new Locale(index.sortLanguage.getIsoCode());
Log.d(LOG, "Setting TTS locale to: " + locale);
final int ttsResult = textToSpeech.setLanguage(locale);
- if (ttsResult != TextToSpeech.LANG_AVAILABLE || ttsResult != TextToSpeech.LANG_COUNTRY_AVAILABLE) {
+ if (ttsResult != TextToSpeech.LANG_AVAILABLE ||
+ ttsResult != TextToSpeech.LANG_COUNTRY_AVAILABLE) {
Log.e(LOG, "TTS not available in this language: ttsResult=" + ttsResult);
}
}
@Override
public void onClick(View v) {
String html = HtmlEntry.htmlBody(htmlEntries, index.shortName);
- Log.d(LOG, "html=" + html);
+ //Log.d(LOG, "html=" + html);
startActivityForResult(
HtmlDisplayActivity.getHtmlIntent(String.format(
"<html><head></head><body>%s</body></html>", html),