[Android] Add support from dropped URLs
Geoffrey Métais
git at videolan.org
Tue Jan 16 17:45:44 CET 2018
vlc-android | branch: chromecast | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jan 10 18:50:14 2018 +0100| [6e64f80d5e5c69247c3cb996e6d4a4c55f898df6] | committer: Geoffrey Métais
Add support from dropped URLs
> https://code.videolan.org/videolan/vlc-android/commit/6e64f80d5e5c69247c3cb996e6d4a4c55f898df6
---
vlc-android/src/org/videolan/vlc/gui/ContentActivity.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/ContentActivity.java b/vlc-android/src/org/videolan/vlc/gui/ContentActivity.java
index dfe1b2596..5f0e6eab8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/ContentActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/ContentActivity.java
@@ -27,6 +27,7 @@ package org.videolan.vlc.gui;
import android.app.SearchManager;
import android.content.ClipData;
import android.content.Intent;
+import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
@@ -39,6 +40,7 @@ import android.view.MenuItem;
import android.view.View;
import org.videolan.libvlc.util.AndroidUtil;
+import org.videolan.medialibrary.media.MediaWrapper;
import org.videolan.vlc.R;
import org.videolan.vlc.gui.audio.EqualizerFragment;
import org.videolan.vlc.gui.browser.ExtensionBrowser;
@@ -68,7 +70,14 @@ public class ContentActivity extends AudioPlayerContainerActivity implements Sea
for (int i = 0; i < itemsCount; i++) {
final DragAndDropPermissions permissions = requestDragAndDropPermissions(event);
if (permissions != null) {
- MediaUtils.openMediaNoUi(clipData.getItemAt(i).getUri());
+ final ClipData.Item item = clipData.getItemAt(i);
+ if (item.getUri() != null) MediaUtils.openUri(ContentActivity.this, item.getUri());
+ else if (item.getText() != null) {
+ final Uri uri = Uri.parse(item.getText().toString());
+ final MediaWrapper media = new MediaWrapper(uri);
+ if (!"file".equals(uri.getScheme())) media.setType(MediaWrapper.TYPE_STREAM);
+ MediaUtils.openMedia(ContentActivity.this, media);
+ }
return true;
}
}
More information about the Android
mailing list