🗑Deleted unwanted files
This commit is contained in:
parent
25fbbce11e
commit
41e8aa8a03
19 changed files with 172 additions and 579 deletions
|
@ -1,77 +1,73 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import code.name.monkey.retromusic.EXTRA_PLAYLISTS
|
||||
import code.name.monkey.retromusic.EXTRA_SONG
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.db.PlaylistEntity
|
||||
import code.name.monkey.retromusic.db.SongEntity
|
||||
import code.name.monkey.retromusic.extensions.colorButtons
|
||||
import code.name.monkey.retromusic.extensions.extraNotNull
|
||||
import code.name.monkey.retromusic.extensions.materialDialog
|
||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||
import code.name.monkey.retromusic.fragments.ReloadType.Playlists
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.repository.PlaylistRepository
|
||||
import code.name.monkey.retromusic.util.PlaylistsUtil
|
||||
import org.koin.android.ext.android.inject
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||
|
||||
class AddToPlaylistDialog : BottomSheetDialogFragment() {
|
||||
private val libraryViewModel by sharedViewModel<LibraryViewModel>()
|
||||
|
||||
class AddToPlaylistDialog : DialogFragment() {
|
||||
private val playlistRepository by inject<PlaylistRepository>()
|
||||
override fun onCreateDialog(
|
||||
savedInstanceState: Bundle?
|
||||
): Dialog {
|
||||
val playlists = playlistRepository.playlists()
|
||||
companion object {
|
||||
fun create(playlistEntities: List<PlaylistEntity>, song: Song): AddToPlaylistDialog {
|
||||
val list = mutableListOf<Song>()
|
||||
list.add(song)
|
||||
return create(playlistEntities, list)
|
||||
}
|
||||
|
||||
fun create(playlistEntities: List<PlaylistEntity>, songs: List<Song>): AddToPlaylistDialog {
|
||||
return AddToPlaylistDialog().apply {
|
||||
arguments = bundleOf(
|
||||
EXTRA_SONG to songs,
|
||||
EXTRA_PLAYLISTS to playlistEntities
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val playlistEntities = extraNotNull<List<PlaylistEntity>>(EXTRA_PLAYLISTS).value
|
||||
val songs = extraNotNull<List<Song>>(EXTRA_SONG).value
|
||||
val playlistNames = mutableListOf<String>()
|
||||
playlistNames.add(requireContext().resources.getString(R.string.action_new_playlist))
|
||||
for (p in playlists) {
|
||||
playlistNames.add(p.name)
|
||||
for (p in playlistEntities) {
|
||||
playlistNames.add(p.playlistName)
|
||||
}
|
||||
return materialDialog(R.string.add_playlist_title)
|
||||
.setItems(playlistNames.toTypedArray()) { _, which ->
|
||||
val songs = extraNotNull<ArrayList<Song>>(EXTRA_SONG).value
|
||||
if (which == 0) {
|
||||
CreatePlaylistDialog.create(songs)
|
||||
.show(requireActivity().supportFragmentManager, "ADD_TO_PLAYLIST")
|
||||
.show(requireActivity().supportFragmentManager, "Dialog")
|
||||
} else {
|
||||
PlaylistsUtil.addToPlaylist(
|
||||
requireContext(),
|
||||
songs,
|
||||
playlists[which - 1].id,
|
||||
true
|
||||
)
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val songEntities = songs.toSongEntity(playlistEntities[which - 1])
|
||||
libraryViewModel.insertSongs(songEntities)
|
||||
libraryViewModel.forceReload(Playlists)
|
||||
}
|
||||
}
|
||||
dismiss()
|
||||
}
|
||||
.create().colorButtons()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun create(song: Song): AddToPlaylistDialog {
|
||||
val list = ArrayList<Song>()
|
||||
list.add(song)
|
||||
return create(list)
|
||||
}
|
||||
|
||||
fun create(songs: List<Song>): AddToPlaylistDialog {
|
||||
val dialog = AddToPlaylistDialog()
|
||||
val args = Bundle()
|
||||
args.putParcelableArrayList(EXTRA_SONG, ArrayList(songs))
|
||||
dialog.arguments = args
|
||||
return dialog
|
||||
}
|
||||
private fun List<Song>.toSongEntity(playlistEntity: PlaylistEntity): List<SongEntity> {
|
||||
return map {
|
||||
it.toSongEntity(playlistEntity.playListId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import code.name.monkey.retromusic.EXTRA_PLAYLISTS
|
||||
import code.name.monkey.retromusic.EXTRA_SONG
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.db.PlaylistEntity
|
||||
import code.name.monkey.retromusic.db.SongEntity
|
||||
import code.name.monkey.retromusic.extensions.colorButtons
|
||||
import code.name.monkey.retromusic.extensions.extraNotNull
|
||||
import code.name.monkey.retromusic.extensions.materialDialog
|
||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||
import code.name.monkey.retromusic.fragments.ReloadType.Playlists
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||
|
||||
class AddToRetroPlaylist : BottomSheetDialogFragment() {
|
||||
private val libraryViewModel by sharedViewModel<LibraryViewModel>()
|
||||
|
||||
companion object {
|
||||
fun create(playlistEntities: List<PlaylistEntity>, song: Song): AddToRetroPlaylist {
|
||||
val list = mutableListOf<Song>()
|
||||
list.add(song)
|
||||
return create(playlistEntities, list)
|
||||
}
|
||||
|
||||
fun create(playlistEntities: List<PlaylistEntity>, songs: List<Song>): AddToRetroPlaylist {
|
||||
return AddToRetroPlaylist().apply {
|
||||
arguments = bundleOf(
|
||||
EXTRA_SONG to songs,
|
||||
EXTRA_PLAYLISTS to playlistEntities
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val playlistEntities = extraNotNull<List<PlaylistEntity>>(EXTRA_PLAYLISTS).value
|
||||
val songs = extraNotNull<List<Song>>(EXTRA_SONG).value
|
||||
val playlistNames = mutableListOf<String>()
|
||||
playlistNames.add(requireContext().resources.getString(R.string.action_new_playlist))
|
||||
for (p in playlistEntities) {
|
||||
playlistNames.add(p.playlistName)
|
||||
}
|
||||
return materialDialog(R.string.add_playlist_title)
|
||||
.setItems(playlistNames.toTypedArray()) { _, which ->
|
||||
if (which == 0) {
|
||||
CreateRetroPlaylist.create(songs)
|
||||
.show(requireActivity().supportFragmentManager, "Dialog")
|
||||
} else {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val songEntities = songs.toSongEntity(playlistEntities[which - 1])
|
||||
libraryViewModel.insertSongs(songEntities)
|
||||
libraryViewModel.forceReload(Playlists)
|
||||
}
|
||||
}
|
||||
dismiss()
|
||||
}
|
||||
.create().colorButtons()
|
||||
}
|
||||
}
|
||||
|
||||
private fun List<Song>.toSongEntity(playlistEntity: PlaylistEntity): List<SongEntity> {
|
||||
return map {
|
||||
it.toSongEntity(playlistEntity.playListId)
|
||||
}
|
||||
}
|
|
@ -1,88 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.Toast
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import code.name.monkey.retromusic.EXTRA_SONG
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.db.PlaylistEntity
|
||||
import code.name.monkey.retromusic.extensions.colorButtons
|
||||
import code.name.monkey.retromusic.extensions.extraNotNull
|
||||
import code.name.monkey.retromusic.extensions.materialDialog
|
||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||
import code.name.monkey.retromusic.fragments.ReloadType.Playlists
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.util.PlaylistsUtil
|
||||
import code.name.monkey.retromusic.repository.RealRepository
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import kotlinx.android.synthetic.main.dialog_playlist.view.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.koin.android.ext.android.inject
|
||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||
|
||||
class CreatePlaylistDialog : DialogFragment() {
|
||||
private val repository by inject<RealRepository>()
|
||||
private val libraryViewModel by sharedViewModel<LibraryViewModel>()
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
override fun onCreateDialog(
|
||||
savedInstanceState: Bundle?
|
||||
): Dialog {
|
||||
companion object {
|
||||
fun create(song: Song): CreatePlaylistDialog {
|
||||
val list = mutableListOf<Song>()
|
||||
list.add(song)
|
||||
return create(list)
|
||||
}
|
||||
|
||||
fun create(songs: List<Song>): CreatePlaylistDialog {
|
||||
return CreatePlaylistDialog().apply {
|
||||
arguments = bundleOf(EXTRA_SONG to songs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val view = LayoutInflater.from(requireActivity()).inflate(R.layout.dialog_playlist, null)
|
||||
val songs = extraNotNull<List<Song>>(EXTRA_SONG).value
|
||||
val playlistView: TextInputEditText = view.actionNewPlaylist
|
||||
val playlistContainer: TextInputLayout = view.actionNewPlaylistContainer
|
||||
MaterialUtil.setTint(playlistContainer, false)
|
||||
|
||||
return materialDialog(R.string.new_playlist_title)
|
||||
.setView(view)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(
|
||||
R.string.create_action
|
||||
) { _, _ ->
|
||||
val extra = extraNotNull<ArrayList<Song>>(EXTRA_SONG)
|
||||
val playlistName = playlistView.text.toString()
|
||||
if (!TextUtils.isEmpty(playlistName)) {
|
||||
val playlistId = PlaylistsUtil.createPlaylist(
|
||||
requireContext(),
|
||||
playlistView.text.toString()
|
||||
)
|
||||
if (playlistId != -1) {
|
||||
PlaylistsUtil.addToPlaylist(requireContext(), extra.value, playlistId, true)
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
if (repository.checkPlaylistExists(playlistName).isEmpty()) {
|
||||
val playlistId = repository.createPlaylist(PlaylistEntity(playlistName))
|
||||
println(playlistId)
|
||||
repository.insertSongs(songs.map { it.toSongEntity(playlistId.toInt()) })
|
||||
libraryViewModel.forceReload(Playlists)
|
||||
} else {
|
||||
Toast.makeText(requireContext(), "Playlist exists", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
playlistContainer.error = "Playlist is can't be empty"
|
||||
}
|
||||
}
|
||||
.create()
|
||||
.colorButtons()
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmOverloads
|
||||
@JvmStatic
|
||||
fun create(song: Song? = null): CreatePlaylistDialog {
|
||||
val list = ArrayList<Song>()
|
||||
if (song != null) {
|
||||
list.add(song)
|
||||
}
|
||||
return create(list)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun create(songs: ArrayList<Song>): CreatePlaylistDialog {
|
||||
val dialog = CreatePlaylistDialog()
|
||||
val args = Bundle()
|
||||
args.putParcelableArrayList(EXTRA_SONG, songs)
|
||||
dialog.arguments = args
|
||||
return dialog
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.Toast
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import code.name.monkey.retromusic.EXTRA_SONG
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.db.PlaylistEntity
|
||||
import code.name.monkey.retromusic.extensions.colorButtons
|
||||
import code.name.monkey.retromusic.extensions.extraNotNull
|
||||
import code.name.monkey.retromusic.extensions.materialDialog
|
||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||
import code.name.monkey.retromusic.fragments.ReloadType.Playlists
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.repository.RealRepository
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import kotlinx.android.synthetic.main.dialog_playlist.view.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.koin.android.ext.android.inject
|
||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||
|
||||
class CreateRetroPlaylist : DialogFragment() {
|
||||
private val repository by inject<RealRepository>()
|
||||
private val libraryViewModel by sharedViewModel<LibraryViewModel>()
|
||||
|
||||
companion object {
|
||||
fun create(song: Song): CreateRetroPlaylist {
|
||||
val list = mutableListOf<Song>()
|
||||
list.add(song)
|
||||
return create(list)
|
||||
}
|
||||
|
||||
fun create(songs: List<Song>): CreateRetroPlaylist {
|
||||
return CreateRetroPlaylist().apply {
|
||||
arguments = bundleOf(EXTRA_SONG to songs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val view = LayoutInflater.from(requireActivity()).inflate(R.layout.dialog_playlist, null)
|
||||
val songs = extraNotNull<List<Song>>(EXTRA_SONG).value
|
||||
val playlistView: TextInputEditText = view.actionNewPlaylist
|
||||
val playlistContainer: TextInputLayout = view.actionNewPlaylistContainer
|
||||
return materialDialog(R.string.new_playlist_title)
|
||||
.setView(view)
|
||||
.setPositiveButton(
|
||||
R.string.create_action
|
||||
) { _, _ ->
|
||||
val playlistName = playlistView.text.toString()
|
||||
if (!TextUtils.isEmpty(playlistName)) {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
if (repository.checkPlaylistExists(playlistName).isEmpty()) {
|
||||
val playlistId = repository.createPlaylist(PlaylistEntity(playlistName))
|
||||
println(playlistId)
|
||||
repository.insertSongs(songs.map { it.toSongEntity(playlistId.toInt()) })
|
||||
libraryViewModel.forceReload(Playlists)
|
||||
} else {
|
||||
Toast.makeText(requireContext(), "Playlist exists", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
playlistContainer.error = "Playlist is can't be empty"
|
||||
}
|
||||
}
|
||||
.create()
|
||||
.colorButtons()
|
||||
}
|
||||
}
|
|
@ -1,35 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import code.name.monkey.retromusic.EXTRA_PLAYLIST
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.db.PlaylistEntity
|
||||
import code.name.monkey.retromusic.extensions.colorButtons
|
||||
import code.name.monkey.retromusic.extensions.extraNotNull
|
||||
import code.name.monkey.retromusic.extensions.materialDialog
|
||||
import code.name.monkey.retromusic.model.Playlist
|
||||
import code.name.monkey.retromusic.util.PlaylistsUtil
|
||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||
import code.name.monkey.retromusic.fragments.ReloadType
|
||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||
|
||||
class DeletePlaylistDialog : DialogFragment() {
|
||||
|
||||
private val libraryViewModel by sharedViewModel<LibraryViewModel>()
|
||||
|
||||
companion object {
|
||||
|
||||
fun create(playlist: PlaylistEntity): DeletePlaylistDialog {
|
||||
val list = mutableListOf<PlaylistEntity>()
|
||||
list.add(playlist)
|
||||
return create(list)
|
||||
}
|
||||
|
||||
fun create(playlists: List<PlaylistEntity>): DeletePlaylistDialog {
|
||||
return DeletePlaylistDialog().apply {
|
||||
arguments = bundleOf(EXTRA_PLAYLIST to playlists)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val playlists = extraNotNull<List<Playlist>>(EXTRA_PLAYLIST).value
|
||||
val playlists = extraNotNull<List<PlaylistEntity>>(EXTRA_PLAYLIST).value
|
||||
val title: Int
|
||||
val message: CharSequence
|
||||
//noinspection ConstantConditions
|
||||
|
@ -42,7 +48,7 @@ class DeletePlaylistDialog : DialogFragment() {
|
|||
} else {
|
||||
title = R.string.delete_playlist_title
|
||||
message = HtmlCompat.fromHtml(
|
||||
String.format(getString(R.string.delete_playlist_x), playlists[0].name),
|
||||
String.format(getString(R.string.delete_playlist_x), playlists[0].playlistName),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
}
|
||||
|
@ -52,26 +58,12 @@ class DeletePlaylistDialog : DialogFragment() {
|
|||
.setMessage(message)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(R.string.action_delete) { _, _ ->
|
||||
PlaylistsUtil.deletePlaylists(requireContext(), playlists)
|
||||
libraryViewModel.deleteSongsFromPlaylist(playlists)
|
||||
libraryViewModel.deleteRoomPlaylist(playlists)
|
||||
libraryViewModel.forceReload(ReloadType.Playlists)
|
||||
}
|
||||
.create()
|
||||
.colorButtons()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun create(playlist: Playlist): DeletePlaylistDialog {
|
||||
val list = ArrayList<Playlist>()
|
||||
list.add(playlist)
|
||||
return create(list)
|
||||
}
|
||||
|
||||
fun create(playlist: ArrayList<Playlist>): DeletePlaylistDialog {
|
||||
val dialog = DeletePlaylistDialog()
|
||||
val args = Bundle()
|
||||
args.putParcelableArrayList(EXTRA_PLAYLIST, playlist)
|
||||
dialog.arguments = args
|
||||
return dialog
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import code.name.monkey.retromusic.EXTRA_PLAYLIST
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.db.PlaylistEntity
|
||||
import code.name.monkey.retromusic.extensions.colorButtons
|
||||
import code.name.monkey.retromusic.extensions.extraNotNull
|
||||
import code.name.monkey.retromusic.extensions.materialDialog
|
||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||
import code.name.monkey.retromusic.fragments.ReloadType
|
||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||
|
||||
class DeleteRetroPlaylist : DialogFragment() {
|
||||
|
||||
private val libraryViewModel by sharedViewModel<LibraryViewModel>()
|
||||
|
||||
companion object {
|
||||
|
||||
fun create(playlist: PlaylistEntity): DeleteRetroPlaylist {
|
||||
val list = mutableListOf<PlaylistEntity>()
|
||||
list.add(playlist)
|
||||
return create(list)
|
||||
}
|
||||
|
||||
fun create(playlists: List<PlaylistEntity>): DeleteRetroPlaylist {
|
||||
return DeleteRetroPlaylist().apply {
|
||||
arguments = bundleOf(EXTRA_PLAYLIST to playlists)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val playlists = extraNotNull<List<PlaylistEntity>>(EXTRA_PLAYLIST).value
|
||||
val title: Int
|
||||
val message: CharSequence
|
||||
//noinspection ConstantConditions
|
||||
if (playlists.size > 1) {
|
||||
title = R.string.delete_playlists_title
|
||||
message = HtmlCompat.fromHtml(
|
||||
String.format(getString(R.string.delete_x_playlists), playlists.size),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
} else {
|
||||
title = R.string.delete_playlist_title
|
||||
message = HtmlCompat.fromHtml(
|
||||
String.format(getString(R.string.delete_playlist_x), playlists[0].playlistName),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
}
|
||||
|
||||
return materialDialog(title)
|
||||
.setTitle(title)
|
||||
.setMessage(message)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(R.string.action_delete) { _, _ ->
|
||||
libraryViewModel.deleteSongsFromPlaylist(playlists)
|
||||
libraryViewModel.deleteRoomPlaylist(playlists)
|
||||
libraryViewModel.forceReload(ReloadType.Playlists)
|
||||
}
|
||||
.create()
|
||||
.colorButtons()
|
||||
}
|
||||
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import code.name.monkey.retromusic.EXTRA_SONG
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.R.string
|
||||
import code.name.monkey.retromusic.extensions.colorButtons
|
||||
import code.name.monkey.retromusic.extensions.materialDialog
|
||||
import code.name.monkey.retromusic.model.PlaylistSong
|
||||
import code.name.monkey.retromusic.util.PlaylistsUtil
|
||||
|
||||
class RemoveFromPlaylistDialog : DialogFragment() {
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val songs = requireArguments().getParcelableArrayList<PlaylistSong>(EXTRA_SONG)
|
||||
|
||||
var title = 0
|
||||
var message: CharSequence = ""
|
||||
if (songs != null) {
|
||||
if (songs.size > 1) {
|
||||
title = R.string.remove_songs_from_playlist_title
|
||||
message = HtmlCompat.fromHtml(
|
||||
String.format(getString(string.remove_x_songs_from_playlist), songs.size),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
} else {
|
||||
title = R.string.remove_song_from_playlist_title
|
||||
message = HtmlCompat.fromHtml(
|
||||
String.format(
|
||||
getString(string.remove_song_x_from_playlist),
|
||||
songs[0].title
|
||||
),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return materialDialog(title)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(R.string.remove_action) { _, _ ->
|
||||
PlaylistsUtil.removeFromPlaylist(
|
||||
requireContext(),
|
||||
songs as MutableList<PlaylistSong>
|
||||
)
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.create()
|
||||
.colorButtons()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun create(song: PlaylistSong): RemoveFromPlaylistDialog {
|
||||
val list = ArrayList<PlaylistSong>()
|
||||
list.add(song)
|
||||
return create(list)
|
||||
}
|
||||
|
||||
fun create(songs: ArrayList<PlaylistSong>): RemoveFromPlaylistDialog {
|
||||
val dialog = RemoveFromPlaylistDialog()
|
||||
val args = Bundle()
|
||||
args.putParcelableArrayList(EXTRA_SONG, songs)
|
||||
dialog.arguments = args
|
||||
return dialog
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,73 +1,57 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import android.provider.MediaStore.Audio.Playlists.Members.PLAYLIST_ID
|
||||
import android.view.LayoutInflater
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil
|
||||
import code.name.monkey.retromusic.EXTRA_PLAYLIST_ID
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.db.PlaylistEntity
|
||||
import code.name.monkey.retromusic.extensions.accentColor
|
||||
import code.name.monkey.retromusic.extensions.colorButtons
|
||||
import code.name.monkey.retromusic.extensions.extraNotNull
|
||||
import code.name.monkey.retromusic.extensions.materialDialog
|
||||
import code.name.monkey.retromusic.util.PlaylistsUtil
|
||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||
import code.name.monkey.retromusic.fragments.ReloadType
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||
|
||||
class RenamePlaylistDialog : DialogFragment() {
|
||||
|
||||
private val libraryViewModel by sharedViewModel<LibraryViewModel>()
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
override fun onCreateDialog(
|
||||
savedInstanceState: Bundle?
|
||||
): Dialog {
|
||||
val layout = LayoutInflater.from(requireContext())
|
||||
.inflate(R.layout.dialog_playlist, null)
|
||||
companion object {
|
||||
fun create(playlistEntity: PlaylistEntity): RenamePlaylistDialog {
|
||||
return RenamePlaylistDialog().apply {
|
||||
arguments = bundleOf(
|
||||
EXTRA_PLAYLIST_ID to playlistEntity
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val playlistEntity = extraNotNull<PlaylistEntity>(EXTRA_PLAYLIST_ID).value
|
||||
val layout = LayoutInflater.from(requireContext()).inflate(R.layout.dialog_playlist, null)
|
||||
val inputEditText: TextInputEditText = layout.findViewById(R.id.actionNewPlaylist)
|
||||
val nameContainer: TextInputLayout =
|
||||
layout.findViewById(R.id.actionNewPlaylistContainer)
|
||||
MaterialUtil.setTint(nameContainer, false)
|
||||
|
||||
val nameContainer: TextInputLayout = layout.findViewById(R.id.actionNewPlaylistContainer)
|
||||
nameContainer.accentColor()
|
||||
inputEditText.setText(playlistEntity.playlistName)
|
||||
return materialDialog(R.string.rename_playlist_title)
|
||||
.setView(layout)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(R.string.action_rename) { _, _ ->
|
||||
val name = inputEditText.text.toString()
|
||||
if (name.isNotEmpty()) {
|
||||
PlaylistsUtil.renamePlaylist(
|
||||
requireContext(),
|
||||
extraNotNull<Long>(PLAYLIST_ID).value,
|
||||
name
|
||||
)
|
||||
libraryViewModel.renameRoomPlaylist(playlistEntity.playListId, name)
|
||||
libraryViewModel.forceReload(ReloadType.Playlists)
|
||||
} else {
|
||||
nameContainer.error = "Playlist name should'nt be empty"
|
||||
}
|
||||
}
|
||||
.create()
|
||||
.colorButtons()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun create(playlistId: Long): RenamePlaylistDialog {
|
||||
val dialog = RenamePlaylistDialog()
|
||||
val args = Bundle()
|
||||
args.putLong(PLAYLIST_ID, playlistId)
|
||||
dialog.arguments = args
|
||||
return dialog
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import code.name.monkey.retromusic.EXTRA_PLAYLIST_ID
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.db.PlaylistEntity
|
||||
import code.name.monkey.retromusic.extensions.accentColor
|
||||
import code.name.monkey.retromusic.extensions.colorButtons
|
||||
import code.name.monkey.retromusic.extensions.extraNotNull
|
||||
import code.name.monkey.retromusic.extensions.materialDialog
|
||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||
import code.name.monkey.retromusic.fragments.ReloadType
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||
|
||||
class RenameRetroPlaylistDialog : DialogFragment() {
|
||||
|
||||
private val libraryViewModel by sharedViewModel<LibraryViewModel>()
|
||||
|
||||
companion object {
|
||||
fun create(playlistEntity: PlaylistEntity): RenameRetroPlaylistDialog {
|
||||
return RenameRetroPlaylistDialog().apply {
|
||||
arguments = bundleOf(
|
||||
EXTRA_PLAYLIST_ID to playlistEntity
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val playlistEntity = extraNotNull<PlaylistEntity>(EXTRA_PLAYLIST_ID).value
|
||||
val layout = LayoutInflater.from(requireContext()).inflate(R.layout.dialog_playlist, null)
|
||||
val inputEditText: TextInputEditText = layout.findViewById(R.id.actionNewPlaylist)
|
||||
val nameContainer: TextInputLayout = layout.findViewById(R.id.actionNewPlaylistContainer)
|
||||
nameContainer.accentColor()
|
||||
inputEditText.setText(playlistEntity.playlistName)
|
||||
return materialDialog(R.string.rename_playlist_title)
|
||||
.setView(layout)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(R.string.action_rename) { _, _ ->
|
||||
val name = inputEditText.text.toString()
|
||||
if (name.isNotEmpty()) {
|
||||
libraryViewModel.renameRoomPlaylist(playlistEntity.playListId, name)
|
||||
libraryViewModel.forceReload(ReloadType.Playlists)
|
||||
} else {
|
||||
nameContainer.error = "Playlist name should'nt be empty"
|
||||
}
|
||||
}
|
||||
.create()
|
||||
.colorButtons()
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.ArrayAdapter
|
||||
import code.name.monkey.retromusic.R
|
||||
|
||||
class RetroSingleCheckedListAdapter(
|
||||
context: Context,
|
||||
resource: Int = R.layout.dialog_list_item,
|
||||
objects: MutableList<String>
|
||||
) : ArrayAdapter<String>(context, resource, objects)
|
|
@ -0,0 +1,4 @@
|
|||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
class SavePlaylistDialog {
|
||||
}
|
|
@ -24,7 +24,7 @@ import code.name.monkey.retromusic.activities.tageditor.AbsTagEditorActivity
|
|||
import code.name.monkey.retromusic.activities.tageditor.AlbumTagEditorActivity
|
||||
import code.name.monkey.retromusic.adapter.album.HorizontalAlbumAdapter
|
||||
import code.name.monkey.retromusic.adapter.song.SimpleSongAdapter
|
||||
import code.name.monkey.retromusic.dialogs.AddToRetroPlaylist
|
||||
import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
|
||||
import code.name.monkey.retromusic.dialogs.DeleteSongsDialog
|
||||
import code.name.monkey.retromusic.extensions.applyColor
|
||||
import code.name.monkey.retromusic.extensions.applyOutlineColor
|
||||
|
@ -286,7 +286,7 @@ class AlbumDetailsFragment : AbsMainActivityFragment(R.layout.fragment_album_det
|
|||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Dispatchers.Main) {
|
||||
AddToRetroPlaylist.create(playlists, songs)
|
||||
AddToPlaylistDialog.create(playlists, songs)
|
||||
.show(childFragmentManager, "ADD_PLAYLIST")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import code.name.monkey.appthemehelper.ThemeStore
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.adapter.album.HorizontalAlbumAdapter
|
||||
import code.name.monkey.retromusic.adapter.song.SimpleSongAdapter
|
||||
import code.name.monkey.retromusic.dialogs.AddToRetroPlaylist
|
||||
import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
|
||||
import code.name.monkey.retromusic.extensions.applyColor
|
||||
import code.name.monkey.retromusic.extensions.applyOutlineColor
|
||||
import code.name.monkey.retromusic.extensions.show
|
||||
|
@ -229,7 +229,7 @@ class ArtistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_artist_d
|
|||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Dispatchers.Main) {
|
||||
AddToRetroPlaylist.create(playlists, songs)
|
||||
AddToPlaylistDialog.create(playlists, songs)
|
||||
.show(childFragmentManager, "ADD_PLAYLIST")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMainActivityFragme
|
|||
lifecycleScope.launch(IO) {
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Main) {
|
||||
AddToRetroPlaylist.create(playlists, song)
|
||||
AddToPlaylistDialog.create(playlists, song)
|
||||
.show(childFragmentManager, "ADD_PLAYLIST")
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMainActivityFragme
|
|||
return true
|
||||
}
|
||||
R.id.action_save_playing_queue -> {
|
||||
CreateRetroPlaylist.create(ArrayList(MusicPlayerRemote.playingQueue))
|
||||
CreatePlaylistDialog.create(ArrayList(MusicPlayerRemote.playingQueue))
|
||||
.show(childFragmentManager, "ADD_TO_PLAYLIST")
|
||||
return true
|
||||
}
|
||||
|
@ -209,13 +209,11 @@ abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMainActivityFragme
|
|||
withContext(Main) {
|
||||
val icon =
|
||||
if (isFavorite) R.drawable.ic_favorite else R.drawable.ic_favorite_border
|
||||
val drawable: Drawable? =
|
||||
|
||||
RetroUtil.getTintedVectorDrawable(
|
||||
requireContext(),
|
||||
icon,
|
||||
toolbarIconColor()
|
||||
)
|
||||
val drawable: Drawable? = RetroUtil.getTintedVectorDrawable(
|
||||
requireContext(),
|
||||
icon,
|
||||
toolbarIconColor()
|
||||
)
|
||||
if (playerToolbar() != null) {
|
||||
playerToolbar()?.menu?.findItem(R.id.action_toggle_favorite)
|
||||
?.setIcon(drawable)?.title =
|
||||
|
|
|
@ -9,7 +9,7 @@ import androidx.navigation.ui.NavigationUI
|
|||
import code.name.monkey.appthemehelper.common.ATHToolbarActivity.getToolbarBackgroundColor
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.dialogs.CreateRetroPlaylist
|
||||
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog
|
||||
import code.name.monkey.retromusic.extensions.accentColor
|
||||
import code.name.monkey.retromusic.extensions.findNavController
|
||||
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
|
||||
|
@ -34,7 +34,7 @@ class LibraryFragment : AbsMainActivityFragment(R.layout.fragment_library) {
|
|||
addPlaylist.apply {
|
||||
accentColor()
|
||||
setOnClickListener {
|
||||
CreateRetroPlaylist().show(childFragmentManager, "ShowCreatePlaylistDialog")
|
||||
CreatePlaylistDialog().show(childFragmentManager, "ShowCreatePlaylistDialog")
|
||||
}
|
||||
}
|
||||
setupNavigationController()
|
||||
|
|
|
@ -17,7 +17,7 @@ package code.name.monkey.retromusic.helper.menu
|
|||
import android.view.MenuItem
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.dialogs.AddToRetroPlaylist
|
||||
import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.model.Genre
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
|
@ -47,7 +47,7 @@ object GenreMenuHelper : KoinComponent {
|
|||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Dispatchers.Main) {
|
||||
AddToRetroPlaylist.create(playlists, getGenreSongs(genre))
|
||||
AddToPlaylistDialog.create(playlists, getGenreSongs(genre))
|
||||
.show(activity.supportFragmentManager, "ADD_PLAYLIST")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@ import code.name.monkey.retromusic.App
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.db.PlaylistWithSongs
|
||||
import code.name.monkey.retromusic.db.toSongs
|
||||
import code.name.monkey.retromusic.dialogs.AddToRetroPlaylist
|
||||
import code.name.monkey.retromusic.dialogs.DeleteRetroPlaylist
|
||||
import code.name.monkey.retromusic.dialogs.RenameRetroPlaylistDialog
|
||||
import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
|
||||
import code.name.monkey.retromusic.dialogs.DeletePlaylistDialog
|
||||
import code.name.monkey.retromusic.dialogs.RenamePlaylistDialog
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.misc.WeakContextAsyncTask
|
||||
import code.name.monkey.retromusic.model.AbsCustomPlaylist
|
||||
|
@ -60,7 +60,7 @@ object PlaylistMenuHelper : KoinComponent {
|
|||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Dispatchers.Main) {
|
||||
AddToRetroPlaylist.create(playlists, playlistWithSongs.songs.toSongs())
|
||||
AddToPlaylistDialog.create(playlists, playlistWithSongs.songs.toSongs())
|
||||
.show(activity.supportFragmentManager, "ADD_PLAYLIST")
|
||||
}
|
||||
}
|
||||
|
@ -71,17 +71,18 @@ object PlaylistMenuHelper : KoinComponent {
|
|||
return true
|
||||
}
|
||||
R.id.action_rename_playlist -> {
|
||||
RenameRetroPlaylistDialog.create(playlistWithSongs.playlistEntity)
|
||||
RenamePlaylistDialog.create(playlistWithSongs.playlistEntity)
|
||||
.show(activity.supportFragmentManager, "RENAME_PLAYLIST")
|
||||
return true
|
||||
}
|
||||
R.id.action_delete_playlist -> {
|
||||
DeleteRetroPlaylist.create(playlistWithSongs.playlistEntity)
|
||||
DeletePlaylistDialog.create(playlistWithSongs.playlistEntity)
|
||||
.show(activity.supportFragmentManager, "DELETE_PLAYLIST")
|
||||
return true
|
||||
}
|
||||
R.id.action_save_playlist -> {
|
||||
//SavePlaylistAsyncTask(activity).execute(playlistWithSongs.songs.toSongs())
|
||||
Toast.makeText(activity, "Coming soon", Toast.LENGTH_SHORT).show()
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import code.name.monkey.retromusic.EXTRA_ARTIST_ID
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.tageditor.AbsTagEditorActivity
|
||||
import code.name.monkey.retromusic.activities.tageditor.SongTagEditorActivity
|
||||
import code.name.monkey.retromusic.dialogs.AddToRetroPlaylist
|
||||
import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
|
||||
import code.name.monkey.retromusic.dialogs.DeleteSongsDialog
|
||||
import code.name.monkey.retromusic.dialogs.SongDetailDialog
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
|
@ -73,7 +73,7 @@ object SongMenuHelper : KoinComponent {
|
|||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Dispatchers.Main) {
|
||||
AddToRetroPlaylist.create(playlists, song)
|
||||
AddToPlaylistDialog.create(playlists, song)
|
||||
.show(activity.supportFragmentManager, "ADD_PLAYLIST")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ package code.name.monkey.retromusic.helper.menu
|
|||
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.dialogs.AddToRetroPlaylist
|
||||
import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
|
||||
import code.name.monkey.retromusic.dialogs.DeleteSongsDialog
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
|
@ -47,7 +47,7 @@ object SongsMenuHelper : KoinComponent {
|
|||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Dispatchers.Main) {
|
||||
AddToRetroPlaylist.create(playlists, songs)
|
||||
AddToPlaylistDialog.create(playlists, songs)
|
||||
.show(activity.supportFragmentManager, "ADD_PLAYLIST")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue