[Android] Add network favorites context options

Geoffrey Métais git at videolan.org
Tue Jun 12 17:16:54 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jun 12 17:16:31 2018 +0200| [82280a47b6695a3f4a02e4573ad373e330b4138c] | committer: Geoffrey Métais

Add network favorites context options

> https://code.videolan.org/videolan/vlc-android/commit/82280a47b6695a3f4a02e4573ad373e330b4138c
---

 vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt | 2 +-
 vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt        | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
index bb30bcb29..31739c610 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
@@ -393,7 +393,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
             if (mw.type == MediaWrapper.TYPE_DIR) {
                 val isEmpty = viewModel.isFolderEmpty(mw)
                 if (!isEmpty) flags = flags or Constants.CTX_PLAY
-                if (this is NetworkBrowserFragment) {
+                if (this at BaseBrowserFragment is NetworkBrowserFragment) {
                     val favExists = withContext(VLCIO) { MediaDatabase.getInstance().networkFavExists(mw.uri) }
                     flags = if (favExists) flags or Constants.CTX_NETWORK_EDIT or Constants.CTX_NETWORK_REMOVE
                     else flags or Constants.CTX_NETWORK_ADD
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt b/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
index 8aecfa74a..716381a67 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
@@ -92,6 +92,9 @@ class ContextSheet : BottomSheetDialogFragment() {
         if (flags and Constants.CTX_PLAY_NEXT != 0) add(Simple(Constants.CTX_PLAY_NEXT, getString(R.string.insert_next), R.drawable.ic_am_append_normal))
         if (flags and Constants.CTX_ADD_TO_PLAYLIST != 0) add(Simple(Constants.CTX_ADD_TO_PLAYLIST, getString(R.string.add_to_playlist), R.drawable.ic_am_addtoplaylist_normal))
         if (flags and Constants.CTX_SET_RINGTONE != 0 && AndroidDevices.isPhone) add(Simple(Constants.CTX_SET_RINGTONE, getString(R.string.set_song), R.drawable.ic_am_ringtone_normal))
+        if (flags and Constants.CTX_NETWORK_ADD != 0) add(Simple(Constants.CTX_NETWORK_ADD, getString(R.string.favorites_add), R.drawable.ic_menu_network))
+        if (flags and Constants.CTX_NETWORK_EDIT != 0) add(Simple(Constants.CTX_NETWORK_EDIT, getString(R.string.favorites_edit), R.drawable.ic_menu_network))
+        if (flags and Constants.CTX_NETWORK_REMOVE != 0) add(Simple(Constants.CTX_NETWORK_REMOVE, getString(R.string.favorites_remove), R.drawable.ic_menu_network))
     }
 
     inner class ContextAdapter : RecyclerView.Adapter<ContextAdapter.ViewHolder>() {



More information about the Android mailing list