[Android] Load last playlist option for Folders
Geoffrey Métais
git at videolan.org
Fri Jan 18 15:50:37 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jan 18 15:26:49 2019 +0100| [cdc172b9fff07bff4268b20bfa047c1620aa4921] | committer: Geoffrey Métais
Load last playlist option for Folders
> https://code.videolan.org/videolan/vlc-android/commit/cdc172b9fff07bff4268b20bfa047c1620aa4921
---
.../src/org/videolan/vlc/gui/ContentActivity.java | 4 +++-
.../org/videolan/vlc/gui/folders/FoldersFragment.kt | 20 ++++++++++++++++----
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/ContentActivity.java b/vlc-android/src/org/videolan/vlc/gui/ContentActivity.java
index 969868180..3be7cc937 100644
--- a/vlc-android/src/org/videolan/vlc/gui/ContentActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/ContentActivity.java
@@ -40,6 +40,7 @@ import org.videolan.vlc.gui.audio.AudioBrowserFragment;
import org.videolan.vlc.gui.browser.ExtensionBrowser;
import org.videolan.vlc.gui.browser.MediaBrowserFragment;
import org.videolan.vlc.gui.dialogs.RenderersDialog;
+import org.videolan.vlc.gui.folders.FoldersFragment;
import org.videolan.vlc.gui.helpers.UiTools;
import org.videolan.vlc.gui.video.VideoGridFragment;
import org.videolan.vlc.interfaces.Filterable;
@@ -201,7 +202,8 @@ public class ContentActivity extends AudioPlayerContainerActivity implements Sea
final MenuItem sortItem = menu.findItem(R.id.ml_menu_sortby);
if (sortItem != null) sortItem.setVisible(!hide && ((MediaBrowserFragment) current).getViewModel().canSortByName());
}
- if (current instanceof VideoGridFragment || current instanceof AudioBrowserFragment) {
+ if (current instanceof VideoGridFragment || current instanceof AudioBrowserFragment
+ || current instanceof FoldersFragment) {
final MenuItem lastItem = menu.findItem(R.id.ml_menu_last_playlist);
if (lastItem != null) lastItem.setVisible(!hide);
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/folders/FoldersFragment.kt b/vlc-android/src/org/videolan/vlc/gui/folders/FoldersFragment.kt
index 496ef1888..ba3f63050 100644
--- a/vlc-android/src/org/videolan/vlc/gui/folders/FoldersFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/folders/FoldersFragment.kt
@@ -18,13 +18,11 @@ import org.videolan.vlc.gui.browser.MediaBrowserFragment
import org.videolan.vlc.gui.dialogs.CtxActionReceiver
import org.videolan.vlc.gui.dialogs.showContext
import org.videolan.vlc.gui.helpers.UiTools
+import org.videolan.vlc.media.MediaUtils
import org.videolan.vlc.media.PlaylistManager
import org.videolan.vlc.media.getAll
import org.videolan.vlc.reload
-import org.videolan.vlc.util.CTX_ADD_TO_PLAYLIST
-import org.videolan.vlc.util.CTX_APPEND
-import org.videolan.vlc.util.CTX_FOLDER_FLAGS
-import org.videolan.vlc.util.CTX_PLAY
+import org.videolan.vlc.util.*
import org.videolan.vlc.viewmodels.paged.PagedFoldersModel
import kotlin.coroutines.CoroutineContext
@@ -91,6 +89,20 @@ class FoldersFragment : MediaBrowserFragment<PagedFoldersModel>(), CoroutineScop
viewModel.refresh()
}
+
+ override fun onPrepareOptionsMenu(menu: Menu?) {
+ super.onPrepareOptionsMenu(menu)
+ menu!!.findItem(R.id.ml_menu_last_playlist).isVisible = true
+ }
+
+ override fun onOptionsItemSelected(item: MenuItem?)= when (item!!.itemId) {
+ R.id.ml_menu_last_playlist -> {
+ MediaUtils.loadlastPlaylist(activity, PLAYLIST_TYPE_VIDEO)
+ true
+ }
+ else -> super.onOptionsItemSelected(item)
+ }
+
override fun onCtxAction(position: Int, option: Int) {
when (option) {
CTX_PLAY -> launch { viewModel.play(position) }
More information about the Android
mailing list