[Android] Fix opening from 'Share' dialog

Geoffrey Métais git at videolan.org
Fri Jul 27 10:56:18 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jul 27 10:42:37 2018 +0200| [b731f21d1971cfb5693f868b2b887c5940e2407b] | committer: Geoffrey Métais

Fix opening from 'Share' dialog

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

 vlc-android/src/org/videolan/vlc/StartActivity.java | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/StartActivity.java b/vlc-android/src/org/videolan/vlc/StartActivity.java
index ccd068bf9..9af9ef1c8 100644
--- a/vlc-android/src/org/videolan/vlc/StartActivity.java
+++ b/vlc-android/src/org/videolan/vlc/StartActivity.java
@@ -67,11 +67,14 @@ public class StartActivity extends FragmentActivity implements StoragePermission
         } else if (Intent.ACTION_SEND.equals(action)) {
             final ClipData cd = intent.getClipData();
             final ClipData.Item item = cd != null && cd.getItemCount() > 0 ? cd.getItemAt(0) : null;
-            final String mrl = item != null ? item.getText().toString() : null;
-            if (mrl != null) {
-                MediaUtils.INSTANCE.openMediaNoUi(Uri.parse(mrl));
-                finish();
-                return;
+            if (item != null) {
+                Uri uri = item.getUri();
+                if (uri == null && item.getText() != null) uri = Uri.parse(item.getText().toString());
+                if (uri != null) {
+                    MediaUtils.INSTANCE.openMediaNoUi(uri);
+                    finish();
+                    return;
+                }
             }
         }
 



More information about the Android mailing list