mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Fix cloning playlists in the create playlist dialog
This commit is contained in:
parent
326df3970a
commit
1eb50adf5e
@ -1,6 +1,7 @@
|
|||||||
package com.github.libretube.ui.dialogs
|
package com.github.libretube.ui.dialogs
|
||||||
|
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
@ -24,11 +25,12 @@ class CreatePlaylistDialog(
|
|||||||
|
|
||||||
binding.clonePlaylist.setOnClickListener {
|
binding.clonePlaylist.setOnClickListener {
|
||||||
val playlistUrl = binding.playlistUrl.text.toString()
|
val playlistUrl = binding.playlistUrl.text.toString()
|
||||||
if (!TextUtils.validateUrl(playlistUrl)) {
|
val playlistId = Uri.parse(playlistUrl).getQueryParameter("list")
|
||||||
|
if (!TextUtils.validateUrl(playlistUrl) || playlistId == null) {
|
||||||
Toast.makeText(context, R.string.invalid_url, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, R.string.invalid_url, Toast.LENGTH_SHORT).show()
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
PlaylistsHelper.clonePlaylist(requireContext().applicationContext, playlistUrl)
|
PlaylistsHelper.clonePlaylist(requireContext().applicationContext, playlistId)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user