[Android] Do not stop actionmode too early

Geoffrey Métais git at videolan.org
Thu Jan 5 16:12:53 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan  5 16:12:06 2017 +0100| [2affc765b46008742a28652215f244a0307e895d] | committer: Geoffrey Métais

Do not stop actionmode too early

> https://code.videolan.org/videolan/vlc-android/commit/2affc765b46008742a28652215f244a0307e895d
---

 vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java           | 3 ++-
 vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java    | 6 +++---
 .../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java       | 3 ++-
 vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java   | 3 ++-
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
index 5208e53..86ec903 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
@@ -179,7 +179,6 @@ public class HistoryFragment extends MediaBrowserFragment implements IRefreshabl
 
     @Override
     public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
-        stopActionMode();
         switch (item.getItemId()) {
             case R.id.action_history_play:
                 MediaUtils.openList(getActivity(), mHistoryAdapter.getSelection(), 0);
@@ -191,8 +190,10 @@ public class HistoryFragment extends MediaBrowserFragment implements IRefreshabl
                 showInfoDialog(mHistoryAdapter.getSelection().get(0));
                 break;
             default:
+                stopActionMode();
                 return false;
         }
+        stopActionMode();
         return true;
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java b/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java
index 6a668e8..5bc342b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java
@@ -75,11 +75,11 @@ public abstract class BaseAudioBrowser extends MediaBrowserFragment implements I
 
     @Override
     public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
-        stopActionMode();
         List<MediaLibraryItem> list = getCurrentAdapter().getSelection();
         ArrayList<MediaWrapper> tracks = new ArrayList<>();
         for (MediaLibraryItem mediaItem : list)
             tracks.addAll(Arrays.asList(mediaItem.getTracks(mMediaLibrary)));
+        stopActionMode();
         switch (item.getItemId()) {
             case R.id.action_mode_audio_play:
                 mService.load(tracks, 0);
@@ -91,10 +91,10 @@ public abstract class BaseAudioBrowser extends MediaBrowserFragment implements I
                 UiTools.addToPlaylist(getActivity(), tracks);
                 break;
             case R.id.action_mode_audio_info:
-                showInfoDialog((MediaWrapper) getCurrentAdapter().getSelection().get(0));
+                showInfoDialog((MediaWrapper) list.get(0));
                 break;
             case R.id.action_mode_audio_set_song:
-                AudioUtil.setRingtone((MediaWrapper) getCurrentAdapter().getSelection().get(0), getActivity());
+                AudioUtil.setRingtone((MediaWrapper) list.get(0), getActivity());
                 break;
             default:
                 return false;
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 7c260bd..eea29eb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -661,7 +661,6 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
 
     @Override
     public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
-        stopActionMode();
         switch (item.getItemId()) {
             case R.id.action_mode_file_play:
                 mService.load(mAdapter.getSelection(), 0);
@@ -680,8 +679,10 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
                 showMediaInfo(mAdapter.getSelection().get(0));
                 break;
             default:
+                stopActionMode();
                 return false;
         }
+        stopActionMode();
         return true;
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 19867fe..6fd445c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -514,7 +514,6 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
 
     @Override
     public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
-        stopActionMode();
         switch (item.getItemId()) {
             case R.id.action_video_play:
                 MediaUtils.openList(getActivity(), mVideoAdapter.getSelection(), 0);
@@ -539,8 +538,10 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
                 MediaUtils.openList(getActivity(), list, 0);
                 break;
             default:
+                stopActionMode();
                 return false;
         }
+        stopActionMode();
         return true;
     }
 



More information about the Android mailing list