[Android] Fix browsers context action at root level

Geoffrey Métais git at videolan.org
Tue Feb 6 17:24:30 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb  6 17:24:10 2018 +0100| [8a48e7840e8b429f8f067a44062e15c326bc2e63] | committer: Geoffrey Métais

Fix browsers context action at root level

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

 .../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java    | 9 ++-------
 .../src/org/videolan/vlc/gui/browser/FileBrowserFragment.java    | 7 ++-----
 2 files changed, 4 insertions(+), 12 deletions(-)

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 8fde04d3b..ee03ec4cc 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -508,7 +508,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
 //                    menu.findItem(R.id.directory_view_show_media).setVisible(false);
 //                }
             menu.findItem(R.id.directory_view_play_folder).setVisible(!isEmpty);
-            menu.findItem(R.id.directory_view_delete).setVisible(canWrite);
+            menu.findItem(R.id.directory_view_delete).setVisible(!mRoot && canWrite);
             if (this instanceof NetworkBrowserFragment) {
                 MediaDatabase db = MediaDatabase.getInstance();
                 if (db.networkFavExists(mw.getUri())) {
@@ -570,12 +570,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
                 }
                 return true;
             case R.id.directory_view_play_folder:
-                List<MediaWrapper> newMediaList = new ArrayList<>();
-                for (MediaLibraryItem mediaItem : mFoldersContentLists.get(mAdapter.get(position))){
-                    if (((MediaWrapper)mediaItem).getType() == MediaWrapper.TYPE_AUDIO || (AndroidUtil.isHoneycombOrLater && ((MediaWrapper)mediaItem).getType() == MediaWrapper.TYPE_VIDEO))
-                        newMediaList.add((MediaWrapper)mediaItem);
-                }
-                MediaUtils.openList(getActivity(), newMediaList, 0);
+                MediaUtils.openMedia(getActivity(), mw);
                 return true;
             case R.id.directory_view_add_playlist:
                 FragmentManager fm = getActivity().getSupportFragmentManager();
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
index af6016149..155ebe151 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
@@ -196,17 +196,14 @@ public class FileBrowserFragment extends BaseBrowserFragment {
 
     @Override
     protected boolean handleContextItemSelected(MenuItem item, int position) {
-        if (mRoot) {
-            if (item.getItemId() == R.id.directory_remove_custom_path){
+        if (mRoot && item.getItemId() == R.id.directory_remove_custom_path){
                 Storage storage = (Storage) mAdapter.getItem(position);
                 MediaDatabase.getInstance().recursiveRemoveDir(storage.getUri().getPath());
                 CustomDirectories.removeCustomDirectory(storage.getUri().getPath());
                 mAdapter.removeItem(position);
                 ((AudioPlayerContainerActivity)getActivity()).updateLib();
                 return true;
-            } else
-                return false;
-        } else
+        }else
             return super.handleContextItemSelected(item, position);
     }
 



More information about the Android mailing list