mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
Inline AddToPlaylistDialog binding field, fix file name.
This commit is contained in:
parent
00b5d0a12a
commit
f938e16a83
@ -12,7 +12,7 @@ import androidx.lifecycle.lifecycleScope
|
|||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.api.PlaylistsHelper
|
import com.github.libretube.api.PlaylistsHelper
|
||||||
import com.github.libretube.api.RetrofitInstance
|
import com.github.libretube.api.RetrofitInstance
|
||||||
import com.github.libretube.databinding.DialogAddtoplaylistBinding
|
import com.github.libretube.databinding.DialogAddToPlaylistBinding
|
||||||
import com.github.libretube.extensions.TAG
|
import com.github.libretube.extensions.TAG
|
||||||
import com.github.libretube.extensions.toastFromMainThread
|
import com.github.libretube.extensions.toastFromMainThread
|
||||||
import com.github.libretube.ui.models.PlaylistViewModel
|
import com.github.libretube.ui.models.PlaylistViewModel
|
||||||
@ -27,26 +27,25 @@ import kotlinx.coroutines.launch
|
|||||||
class AddToPlaylistDialog(
|
class AddToPlaylistDialog(
|
||||||
private val videoId: String? = null
|
private val videoId: String? = null
|
||||||
) : DialogFragment() {
|
) : DialogFragment() {
|
||||||
private lateinit var binding: DialogAddtoplaylistBinding
|
|
||||||
private val viewModel: PlaylistViewModel by activityViewModels()
|
private val viewModel: PlaylistViewModel by activityViewModels()
|
||||||
|
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
binding = DialogAddtoplaylistBinding.inflate(layoutInflater)
|
val binding = DialogAddToPlaylistBinding.inflate(layoutInflater)
|
||||||
|
|
||||||
binding.createPlaylist.setOnClickListener {
|
binding.createPlaylist.setOnClickListener {
|
||||||
CreatePlaylistDialog {
|
CreatePlaylistDialog {
|
||||||
fetchPlaylists()
|
fetchPlaylists(binding)
|
||||||
}.show(childFragmentManager, null)
|
}.show(childFragmentManager, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchPlaylists()
|
fetchPlaylists(binding)
|
||||||
|
|
||||||
return MaterialAlertDialogBuilder(requireContext())
|
return MaterialAlertDialogBuilder(requireContext())
|
||||||
.setView(binding.root)
|
.setView(binding.root)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fetchPlaylists() {
|
private fun fetchPlaylists(binding: DialogAddToPlaylistBinding) {
|
||||||
lifecycleScope.launchWhenCreated {
|
lifecycleScope.launchWhenCreated {
|
||||||
val response = try {
|
val response = try {
|
||||||
PlaylistsHelper.getPlaylists()
|
PlaylistsHelper.getPlaylists()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user