X-Git-Url: http://gitweb.fperrin.net/?p=Dictionary.git;a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2FDictionaryActivity.java;h=8590d90fbf7f13103895f305d61ba2f67d3a6e35;hp=e2558a0773605615ff629cb7aab682a9605a2de3;hb=6075de7ee940e23133cf187f44a525e19cccf038;hpb=c76660b2772122109529d3616289980a7084eeeb diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index e2558a0..8590d90 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -880,6 +880,11 @@ public class DictionaryActivity extends AppCompatActivity { updateTTSLanguage(indexIndex); } + @SuppressWarnings("deprecation") + private void speak(String text) { + textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null); + } + private void updateTTSLanguage(int i) { if (!ttsReady || index == null || textToSpeech == null) { Log.d(LOG, "Can't updateTTSLanguage."); @@ -1236,8 +1241,7 @@ public class DictionaryActivity extends AppCompatActivity { speak.setOnMenuItemClickListener(new android.view.MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(android.view.MenuItem item) { - textToSpeech.speak(textToSpeak, TextToSpeech.QUEUE_FLUSH, - new HashMap()); + speak(textToSpeak); return false; } }); @@ -1253,8 +1257,7 @@ public class DictionaryActivity extends AppCompatActivity { String text = ""; for (Pair p : pairs) text += p.get(idx); text = text.replaceAll("\\{[^{}]*\\}", "").replace("{", "").replace("}", ""); - textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, - new HashMap()); + speak(text); return false; } }); @@ -1267,8 +1270,7 @@ public class DictionaryActivity extends AppCompatActivity { String text = ""; for (Pair p : pairs) text += p.get(idx); text = text.replaceAll("\\{[^{}]*\\}", "").replace("{", "").replace("}", ""); - textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, - new HashMap()); + speak(text); return false; } });