[Android] Allow subs picker for network files
Geoffrey Métais
git at videolan.org
Tue Jan 31 11:37:21 CET 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 31 11:35:16 2017 +0100| [8cf8dade6fb45e2979c72e3df48c9d23b6e65749] | committer: Geoffrey Métais
Allow subs picker for network files
Closes #209
> https://code.videolan.org/videolan/vlc-android/commit/8cf8dade6fb45e2979c72e3df48c9d23b6e65749
---
.../src/org/videolan/vlc/gui/browser/FilePickerFragment.java | 9 +++++++--
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 5 ++---
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerFragment.java
index 31b2e31..aa4c791 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerFragment.java
@@ -52,6 +52,12 @@ public class FilePickerFragment extends FileBrowserFragment {
@Override
public void onCreate(Bundle bundle) {
+ if (getActivity().getIntent() != null) {
+ Uri uri = getActivity().getIntent().getData();
+ if (uri == null || !TextUtils.equals(uri.getScheme(), "file")) {
+ getActivity().setIntent(null);
+ }
+ }
super.onCreate(bundle);
mAdapter = new FilePickerAdapter(this);
mRoot = defineIsRoot();
@@ -100,9 +106,8 @@ public class FilePickerFragment extends FileBrowserFragment {
return false;
}
return true;
- } else if (TextUtils.isEmpty(Uri.parse(mMrl).getPath()))
+ } else
return true;
- return false;
}
@Override
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index ef74e41..0ef0fe2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2265,7 +2265,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
popupMenu.getMenu().findItem(R.id.video_menu_audio_track).setEnabled(mService.getAudioTracksCount() > 0);
popupMenu.getMenu().findItem(R.id.video_menu_subtitles).setEnabled(mService.getSpuTracksCount() > 0);
//FIXME network subs cannot be enabled & screen cast display is broken with picker
- popupMenu.getMenu().findItem(R.id.video_menu_subtitles_picker).setEnabled(!TextUtils.equals(mUri.getScheme(), "http") && mPresentation == null);
+ popupMenu.getMenu().findItem(R.id.video_menu_subtitles_picker).setEnabled(mPresentation == null);
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
@@ -2279,8 +2279,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (mUri == null)
return false;
Intent filePickerIntent = new Intent(context, FilePickerActivity.class);
- if (!TextUtils.equals(mUri.getScheme(), "http"))
- filePickerIntent.setData(Uri.parse(FileUtils.getParent(mUri.toString())));
+ filePickerIntent.setData(Uri.parse(FileUtils.getParent(mUri.toString())));
context.startActivityForResult(filePickerIntent, 0);
return true;
} else if (item.getItemId() == R.id.video_menu_subtitles_download) {
More information about the Android
mailing list