Minor code improvement
This commit is contained in:
parent
aa683a0957
commit
33e7e6595e
2 changed files with 10 additions and 2 deletions
|
@ -101,7 +101,7 @@ class TracksAdapter(
|
|||
R.id.cab_rename -> displayEditDialog()
|
||||
R.id.cab_remove_from_playlist -> removeFromPlaylist()
|
||||
R.id.cab_delete -> askConfirmDelete()
|
||||
R.id.cab_share -> activity.shareTracks(getSelectedTracks())
|
||||
R.id.cab_share -> shareFiles()
|
||||
R.id.cab_select_all -> selectAll()
|
||||
R.id.cab_play_next -> playNext()
|
||||
}
|
||||
|
@ -211,6 +211,10 @@ class TracksAdapter(
|
|||
}
|
||||
}
|
||||
|
||||
private fun shareFiles() {
|
||||
activity.shareTracks(getSelectedTracks())
|
||||
}
|
||||
|
||||
private fun getSelectedTracks(): List<Track> = tracks.filter { selectedKeys.contains(it.hashCode()) }
|
||||
|
||||
fun updateItems(newItems: ArrayList<Track>, highlightText: String = "", forceUpdate: Boolean = false) {
|
||||
|
|
|
@ -97,7 +97,7 @@ class TracksHeaderAdapter(activity: SimpleActivity, var items: ArrayList<ListIte
|
|||
R.id.cab_add_to_queue -> addToQueue()
|
||||
R.id.cab_properties -> showProperties()
|
||||
R.id.cab_delete -> askConfirmDelete()
|
||||
R.id.cab_share -> activity.shareTracks(getSelectedTracks())
|
||||
R.id.cab_share -> shareFiles()
|
||||
R.id.cab_rename -> displayEditDialog()
|
||||
R.id.cab_select_all -> selectAll()
|
||||
R.id.cab_play_next -> playNext()
|
||||
|
@ -172,6 +172,10 @@ class TracksHeaderAdapter(activity: SimpleActivity, var items: ArrayList<ListIte
|
|||
}
|
||||
}
|
||||
|
||||
private fun shareFiles() {
|
||||
activity.shareTracks(getSelectedTracks())
|
||||
}
|
||||
|
||||
private fun getSelectedTracks(): List<Track> = items.filter { it is Track && selectedKeys.contains(it.hashCode()) }.toList() as List<Track>
|
||||
|
||||
fun updateItems(newItems: ArrayList<ListItem>) {
|
||||
|
|
Loading…
Reference in a new issue