Commit 584bc229 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Allow VLC to receive shared urls

parent e058d8af
...@@ -411,6 +411,11 @@ ...@@ -411,6 +411,11 @@
<data android:pathPattern=".*\\.xspf" /> <data android:pathPattern=".*\\.xspf" />
<data android:pathPattern=".*\\.XSPF" /> <data android:pathPattern=".*\\.XSPF" />
</intent-filter> </intent-filter>
<intent-filter android:label="Play with VLC">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<!-- Search --> <!-- Search -->
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH" /> <action android:name="android.intent.action.SEARCH" />
......
...@@ -23,8 +23,10 @@ ...@@ -23,8 +23,10 @@
package org.videolan.vlc; package org.videolan.vlc;
import android.content.ClipData;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.MediaStore; import android.provider.MediaStore;
...@@ -53,10 +55,19 @@ public class StartActivity extends FragmentActivity implements StoragePermission ...@@ -53,10 +55,19 @@ public class StartActivity extends FragmentActivity implements StoragePermission
final boolean tv = showTvUi(); final boolean tv = showTvUi();
final String action = intent != null ? intent.getAction(): null; final String action = intent != null ? intent.getAction(): null;
if (Intent.ACTION_VIEW.equals(action) && intent.getData() != null) { if (Intent.ACTION_VIEW.equals(action) && intent.getData() != null
if (Permissions.checkReadStoragePermission(this, true)) && Permissions.checkReadStoragePermission(this, true)) {
startPlaybackFromApp(intent); startPlaybackFromApp(intent);
return; return;
} 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.openMediaNoUi(Uri.parse(mrl));
finish();
return;
}
} }
// Start application // Start application
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment