[Android] Allow opening media info from audio player

Nicolas Pomepuy git at videolan.org
Tue Sep 24 16:29:42 CEST 2019


vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Sep 16 15:08:04 2019 +0200| [9bdb7fb6d3c7f3ef104072cb2343e96f96c42f8d] | committer: Geoffrey Métais

Allow opening media info from audio player
Refs #1032

(cherry picked from commit 88a555463b29ed4d1d2f9f5338ea35871d846a44)

> https://code.videolan.org/videolan/vlc-android/commit/9bdb7fb6d3c7f3ef104072cb2343e96f96c42f8d
---

 vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
index 52bfcb2fc..d345bb644 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
@@ -23,6 +23,7 @@ package org.videolan.vlc.gui.audio
 import android.Manifest
 import android.annotation.TargetApi
 import android.content.Context
+import android.content.Intent
 import android.content.SharedPreferences
 import android.content.res.Configuration
 import android.net.Uri
@@ -63,6 +64,7 @@ import org.videolan.vlc.R
 import org.videolan.vlc.VLCApplication
 import org.videolan.vlc.databinding.AudioPlayerBinding
 import org.videolan.vlc.gui.AudioPlayerContainerActivity
+import org.videolan.vlc.gui.InfoActivity
 import org.videolan.vlc.gui.dialogs.CtxActionReceiver
 import org.videolan.vlc.gui.dialogs.showContext
 import org.videolan.vlc.gui.helpers.*
@@ -193,14 +195,21 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, CoroutineS
                     playlistModel.remove(position)
                 }
                 CTX_STOP_AFTER_THIS -> playlistModel.stopAfter(position)
+                CTX_INFORMATION -> showInfoDialog(playlistAdapter.getItem(position))
             }
         }
     }
 
+    private fun showInfoDialog(media: AbstractMediaWrapper) {
+        val i = Intent(requireActivity(), InfoActivity::class.java)
+        i.putExtra(TAG_ITEM, media)
+        startActivity(i)
+    }
+
     override fun onPopupMenu(view: View, position: Int, item: AbstractMediaWrapper?) {
         val activity = activity
         if (activity === null || position >= playlistAdapter.itemCount) return
-        val flags = CTX_REMOVE_FROM_PLAYLIST or CTX_SET_RINGTONE or CTX_ADD_TO_PLAYLIST or CTX_STOP_AFTER_THIS
+        val flags = CTX_REMOVE_FROM_PLAYLIST or CTX_SET_RINGTONE or CTX_ADD_TO_PLAYLIST or CTX_STOP_AFTER_THIS or CTX_INFORMATION
         showContext(activity, ctxReceiver, position, item?.title ?: "", flags)
     }
 



More information about the Android mailing list