adding back the Properties dialog
This commit is contained in:
parent
f69618166f
commit
5551ee6f39
3 changed files with 19 additions and 1 deletions
|
@ -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<Track>, 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<Track>, 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<Int>()
|
||||
|
|
|
@ -210,6 +210,7 @@ fun Context.getAlbumTracksSync(albumId: Long): ArrayList<Track> {
|
|||
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<Track> {
|
|||
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)
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
android:icon="@drawable/ic_delete_vector"
|
||||
android:title="@string/delete"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/cab_properties"
|
||||
android:icon="@drawable/ic_info"
|
||||
android:title="@string/properties"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/cab_add_to_playlist"
|
||||
android:title="@string/add_to_playlist"
|
||||
|
|
Loading…
Reference in a new issue