[Android] Allow 'play as audio' for unknow files
Geoffrey Métais
git at videolan.org
Fri Jan 8 14:13:37 CET 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jan 8 14:13:11 2016 +0100| [83de84e1310ae1074c8efabb9fec0e6218967929] | committer: Geoffrey Métais
Allow 'play as audio' for unknow files
> https://code.videolan.org/videolan/vlc-android/commit/83de84e1310ae1074c8efabb9fec0e6218967929
---
vlc-android/res/menu/directory_view_file.xml | 6 +++---
.../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/vlc-android/res/menu/directory_view_file.xml b/vlc-android/res/menu/directory_view_file.xml
index 39e7aa5..da61406 100644
--- a/vlc-android/res/menu/directory_view_file.xml
+++ b/vlc-android/res/menu/directory_view_file.xml
@@ -4,6 +4,9 @@
android:id="@+id/directory_view_play"
android:title="@string/play" />
<item
+ android:id="@+id/directory_view_play_audio"
+ android:title="@string/play_as_audio" />
+ <item
android:id="@+id/directory_view_append"
android:title="@string/append" />
<item
@@ -12,7 +15,4 @@
<item
android:id="@+id/directory_view_info"
android:title="@string/info" />
- <item
- android:id="@+id/directory_view_play_audio"
- android:title="@string/play_as_audio" />
</menu>
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
index 4bb9780..3e8846e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -369,9 +369,9 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
protected void setContextMenu(MenuInflater inflater, Menu menu, int position) {
MediaWrapper mw = (MediaWrapper) mAdapter.getItem(position);
+ int type = mw.getType();
boolean canWrite = this instanceof FileBrowserFragment && FileUtils.canWrite(mw.getUri().getPath());
- boolean isVideo = mw.getType() == MediaWrapper.TYPE_VIDEO;
- if (mw.getType() == MediaWrapper.TYPE_DIR) {
+ if (type == MediaWrapper.TYPE_DIR) {
boolean isEmpty = mMediaLists.get(position) == null || mMediaLists.get(position).isEmpty();
if (canWrite || !isEmpty) {
inflater.inflate(R.menu.directory_view_dir, menu);
@@ -389,8 +389,8 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
} else {
inflater.inflate(R.menu.directory_view_file, menu);
menu.findItem(R.id.directory_view_delete).setVisible(canWrite);
- menu.findItem(R.id.directory_view_info).setVisible(isVideo);
- menu.findItem(R.id.directory_view_play_audio).setVisible(isVideo);
+ menu.findItem(R.id.directory_view_info).setVisible(type == MediaWrapper.TYPE_VIDEO);
+ menu.findItem(R.id.directory_view_play_audio).setVisible(type != MediaWrapper.TYPE_AUDIO);
}
}
More information about the Android
mailing list