diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/TracksAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/TracksAdapter.kt index 8ac045f9..6700e56e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/TracksAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/TracksAdapter.kt @@ -9,6 +9,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners import com.bumptech.glide.request.RequestOptions import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.dialogs.ConfirmationDialog +import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.views.FastScroller @@ -64,6 +65,7 @@ class TracksAdapter(activity: SimpleActivity, var tracks: ArrayList, val when (id) { R.id.cab_add_to_playlist -> addToPlaylist() R.id.cab_add_to_queue -> addToQueue() + R.id.cab_properties -> showProperties() R.id.cab_remove_from_playlist -> removeFromPlaylist() R.id.cab_delete -> askConfirmDelete() } @@ -94,6 +96,16 @@ class TracksAdapter(activity: SimpleActivity, var tracks: ArrayList, val } } + private fun showProperties() { + val selectedTracks = getSelectedTracks() + if (selectedTracks.size <= 1) { + PropertiesDialog(activity, selectedTracks.first().path, false) + } else { + val paths = selectedTracks.map { it.path } + PropertiesDialog(activity, paths, false) + } + } + private fun removeFromPlaylist() { ensureBackgroundThread { val positions = ArrayList() diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/extensions/Context.kt index 0ad620bc..7c290ef6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/extensions/Context.kt @@ -210,6 +210,7 @@ fun Context.getAlbumTracksSync(albumId: Long): ArrayList { val projection = arrayOf( Audio.Media._ID, Audio.Media.DURATION, + Audio.Media.DATA, Audio.Media.TITLE, Audio.Media.ARTIST, Audio.Media.ALBUM, @@ -230,7 +231,7 @@ fun Context.getAlbumTracksSync(albumId: Long): ArrayList { val title = cursor.getStringValue(Audio.Media.TITLE) val duration = cursor.getIntValue(Audio.Media.DURATION) / 1000 val trackId = cursor.getIntValue(Audio.Media.TRACK) % 1000 - val path = "" + val path = cursor.getStringValue(Audio.Media.DATA) val artist = cursor.getStringValue(Audio.Media.ARTIST) ?: MediaStore.UNKNOWN_STRING val album = cursor.getStringValue(Audio.Media.ALBUM) val track = Track(0, id, title, artist, path, duration, album, coverArt, 0, trackId) diff --git a/app/src/main/res/menu/cab_tracks.xml b/app/src/main/res/menu/cab_tracks.xml index c9b126c6..8e397a59 100644 --- a/app/src/main/res/menu/cab_tracks.xml +++ b/app/src/main/res/menu/cab_tracks.xml @@ -11,6 +11,11 @@ android:icon="@drawable/ic_delete_vector" android:title="@string/delete" app:showAsAction="ifRoom" /> +