From: Reimar Döffinger Date: Fri, 1 May 2020 11:28:24 +0000 (+0200) Subject: Avoid deprecation warnings. X-Git-Url: http://gitweb.fperrin.net/?p=Dictionary.git;a=commitdiff_plain;h=6075de7ee940e23133cf187f44a525e19cccf038 Avoid deprecation warnings. --- diff --git a/src/com/hughes/android/dictionary/AboutActivity.java b/src/com/hughes/android/dictionary/AboutActivity.java index 2f1ee13..91c3430 100644 --- a/src/com/hughes/android/dictionary/AboutActivity.java +++ b/src/com/hughes/android/dictionary/AboutActivity.java @@ -24,6 +24,7 @@ public final class AboutActivity extends Activity { /** Called when the activity is first created. */ @Override + @SuppressWarnings("deprecation") public void onCreate(final Bundle savedInstanceState) { DictionaryApplication.INSTANCE.init(getApplicationContext()); setTheme(DictionaryApplication.INSTANCE.getSelectedTheme().themeId); 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; } }); diff --git a/src/com/hughes/android/dictionary/MyWebView.java b/src/com/hughes/android/dictionary/MyWebView.java index d57ad0b..028ddbc 100644 --- a/src/com/hughes/android/dictionary/MyWebView.java +++ b/src/com/hughes/android/dictionary/MyWebView.java @@ -42,6 +42,7 @@ public class MyWebView extends WebView { final WebViewClient webViewClient = new WebViewClient() { @Override + @SuppressWarnings("deprecation") public boolean shouldOverrideUrlLoading(WebView view, String url) { if (HtmlEntry.isQuickdicUrl(url)) { Log.d(LOG, "Handling Quickdic URL: " + url);