]> gitweb.fperrin.net Git - Dictionary.git/commitdiff
Avoid deprecation warnings.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Fri, 1 May 2020 11:28:24 +0000 (13:28 +0200)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Fri, 1 May 2020 11:28:24 +0000 (13:28 +0200)
src/com/hughes/android/dictionary/AboutActivity.java
src/com/hughes/android/dictionary/DictionaryActivity.java
src/com/hughes/android/dictionary/MyWebView.java

index 2f1ee139b478be23628d1b377b67414ae58f1fe5..91c34300f0222690f1dd4d9046f1c9418057085d 100644 (file)
@@ -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);
index e2558a0773605615ff629cb7aab682a9605a2de3..8590d90fbf7f13103895f305d61ba2f67d3a6e35 100644 (file)
@@ -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<String, String>());
+                    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<String, String>());
+                    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<String, String>());
+                    speak(text);
                     return false;
                 }
             });
index d57ad0bc80cd621a82addb20d739a706317fb7e8..028ddbcdd964ec8e4df19bd38d245ce3a3ef766f 100644 (file)
@@ -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);