[Android] Convert VLC transcode warning to Toast

Geoffrey Métais git at videolan.org
Fri Jan 26 15:16:35 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jan 19 17:59:18 2018 +0100| [ad39c9540e8270dfa0a8a068589bcb56ed8e6174] | committer: Geoffrey Métais

Convert VLC transcode warning to Toast

> https://code.videolan.org/videolan/vlc-android/commit/ad39c9540e8270dfa0a8a068589bcb56ed8e6174
---

 vlc-android/src/org/videolan/vlc/VLCApplication.java |  4 +---
 vlc-android/src/org/videolan/vlc/util/Util.java      | 17 +++++++++++++----
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java
index 5d74f6555..8d45e63d9 100644
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java
@@ -208,9 +208,7 @@ public class VLCApplication extends Application {
 
         @Override
         public void onDisplay(Dialog.QuestionDialog dialog) {
-            if ("Insecure site".equals(dialog.getTitle())) {
-                Util.byPassChromecastDialog(dialog);
-            } else {
+            if (!Util.byPassChromecastDialog(dialog)) {
                 final String key = DialogActivity.KEY_QUESTION + sDialogCounter++;
                 fireDialog(dialog, key);
             }
diff --git a/vlc-android/src/org/videolan/vlc/util/Util.java b/vlc-android/src/org/videolan/vlc/util/Util.java
index c30681602..5992a7c41 100644
--- a/vlc-android/src/org/videolan/vlc/util/Util.java
+++ b/vlc-android/src/org/videolan/vlc/util/Util.java
@@ -27,6 +27,7 @@ import android.content.pm.ResolveInfo;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.text.TextUtils;
+import android.widget.Toast;
 
 import org.videolan.libvlc.Dialog;
 import org.videolan.libvlc.util.AndroidUtil;
@@ -187,9 +188,17 @@ public class Util {
             ctx.startForegroundService(intent);
     }
 
-    public static void byPassChromecastDialog(Dialog.QuestionDialog dialog) {
-        if ("View certificate".equals(dialog.getAction1Text())) dialog.postAction(1);
-        else if ("Accept permanently".equals(dialog.getAction2Text())) dialog.postAction(2);
-        dialog.dismiss();
+    public static boolean byPassChromecastDialog(Dialog.QuestionDialog dialog) {
+        if ("Insecure site".equals(dialog.getTitle())) {
+            if ("View certificate".equals(dialog.getAction1Text())) dialog.postAction(1);
+            else if ("Accept permanently".equals(dialog.getAction2Text())) dialog.postAction(2);
+            dialog.dismiss();
+            return true;
+        } else if ("Performance warning".equals(dialog.getTitle())) {
+            Toast.makeText(VLCApplication.getAppContext(), dialog.getText(), Toast.LENGTH_LONG).show();
+            dialog.dismiss();
+            return true;
+        }
+        return false;
     }
 }



More information about the Android mailing list