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
protected void onResume() {
Log.d(LOG, "onResume");
super.onResume();
- if (PreferenceActivity.prefsMightHaveChanged) {
- PreferenceActivity.prefsMightHaveChanged = false;
+ if (SettingsActivity.settingsMightHaveChanged) {
+ SettingsActivity.settingsMightHaveChanged = false;
finish();
startActivity(getIntent());
}
@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);
}
}
}
});
+ final MenuItem share = menu.add("Share");
+ share.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+ public boolean onMenuItemClick(MenuItem item) {
+ Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
+ shareIntent.setType("text/plain");
+ shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, row.getTokenRow(true).getToken());
+ shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, row.getRawText(saveOnlyFirstSubentry));
+ startActivity(shareIntent);
+ return false;
+ }
+ });
+
final MenuItem copy = menu.add(android.R.string.copy);
copy.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
textView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- final String html = HtmlEntry.htmlBody(htmlEntries, index.shortName);
+ String html = HtmlEntry.htmlBody(htmlEntries, index.shortName);
+ //Log.d(LOG, "html=" + html);
startActivityForResult(
HtmlDisplayActivity.getHtmlIntent(String.format(
"<html><head></head><body>%s</body></html>", html),