add an Open playlist actionmenu button
This commit is contained in:
parent
e5bd96a7b2
commit
527f1e6b7c
7 changed files with 18 additions and 0 deletions
|
@ -12,10 +12,12 @@ import android.view.Menu
|
|||
import android.view.MenuItem
|
||||
import android.widget.SeekBar
|
||||
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_MULTISELECT
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_OTTO
|
||||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.commons.models.Release
|
||||
import com.simplemobiletools.commons.views.RecyclerViewDivider
|
||||
import com.simplemobiletools.musicplayer.BuildConfig
|
||||
|
@ -87,6 +89,7 @@ class MainActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListener {
|
|||
when (item.itemId) {
|
||||
R.id.sort -> showSortingDialog()
|
||||
R.id.toggle_song_repetition -> toggleSongRepetition()
|
||||
R.id.open_playlist -> openPlaylist()
|
||||
R.id.toggle_shuffle -> toggleShuffle()
|
||||
R.id.add_folder_to_playlist -> addFolderToPlaylist()
|
||||
R.id.add_file_to_playlist -> addFileToPlaylist()
|
||||
|
@ -135,6 +138,16 @@ class MainActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListener {
|
|||
toast(if (config.repeatSong) R.string.song_repetition_enabled else R.string.song_repetition_disabled)
|
||||
}
|
||||
|
||||
private fun openPlaylist() {
|
||||
dbHelper.getPlaylists {
|
||||
val items = arrayListOf<RadioItem>()
|
||||
it.mapTo(items) { RadioItem(it.id, it.title) }
|
||||
RadioGroupDialog(this, items, config.currentPlaylist) {
|
||||
playlistChanged(it as Int)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun addFolderToPlaylist() {
|
||||
val initialPath = if (mSongs.isEmpty()) Environment.getExternalStorageDirectory().toString() else mSongs[0].path
|
||||
FilePickerDialog(this, initialPath, pickFile = false) {
|
||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_open_playlist.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_open_playlist.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 143 B |
BIN
app/src/main/res/drawable-mdpi/ic_open_playlist.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_open_playlist.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 117 B |
BIN
app/src/main/res/drawable-xhdpi/ic_open_playlist.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_open_playlist.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 160 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_open_playlist.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_open_playlist.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 188 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_open_playlist.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_open_playlist.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 219 B |
|
@ -11,6 +11,11 @@
|
|||
android:icon="@drawable/ic_repeat"
|
||||
android:title="@string/disable_song_repetition"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/open_playlist"
|
||||
android:icon="@drawable/ic_open_playlist"
|
||||
android:title="@string/open_playlist"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/toggle_shuffle"
|
||||
android:icon="@drawable/ic_shuffle"
|
||||
|
|
Loading…
Reference in a new issue