mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
cleanup
This commit is contained in:
parent
c996b584a5
commit
283e74062d
@ -17,7 +17,6 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
|||||||
import com.squareup.picasso.Picasso
|
import com.squareup.picasso.Picasso
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
@ -7,8 +7,6 @@ import android.util.Log
|
|||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import androidx.navigation.findNavController
|
|
||||||
import androidx.navigation.fragment.findNavController
|
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.obj.PlaylistId
|
import com.github.libretube.obj.PlaylistId
|
||||||
import com.github.libretube.preferences.PreferenceHelper
|
import com.github.libretube.preferences.PreferenceHelper
|
||||||
@ -16,7 +14,6 @@ import com.github.libretube.util.RetrofitInstance
|
|||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
@ -36,8 +33,8 @@ class PlaylistOptionsDialog(
|
|||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
if (isOwner) {
|
if (isOwner) {
|
||||||
optionsList = optionsList +
|
optionsList = optionsList +
|
||||||
context?.getString(R.string.deletePlaylist)!! -
|
context?.getString(R.string.deletePlaylist)!! -
|
||||||
context?.getString(R.string.clonePlaylist)!!
|
context?.getString(R.string.clonePlaylist)!!
|
||||||
}
|
}
|
||||||
|
|
||||||
val dialog = MaterialAlertDialogBuilder(requireContext())
|
val dialog = MaterialAlertDialogBuilder(requireContext())
|
||||||
|
@ -43,14 +43,14 @@ class VideoOptionsDialog(private val videoId: String, context: Context) : Dialog
|
|||||||
) { _, which ->
|
) { _, which ->
|
||||||
// For now, this checks the position of the option with the position that is in the
|
// For now, this checks the position of the option with the position that is in the
|
||||||
// list. I don't like it, but we will do like this for now.
|
// list. I don't like it, but we will do like this for now.
|
||||||
when (which) {
|
when (optionsList[which]) {
|
||||||
// This for example will be the "Background mode" option
|
// This for example will be the "Background mode" option
|
||||||
0 -> {
|
context?.getString(R.string.playOnBackground) -> {
|
||||||
BackgroundMode.getInstance()
|
BackgroundMode.getInstance()
|
||||||
.playOnBackgroundMode(requireContext(), videoId)
|
.playOnBackgroundMode(requireContext(), videoId)
|
||||||
}
|
}
|
||||||
// Add Video to Playlist Dialog
|
// Add Video to Playlist Dialog
|
||||||
1 -> {
|
context?.getString(R.string.addToPlaylist) -> {
|
||||||
val token = PreferenceHelper.getToken(requireContext())
|
val token = PreferenceHelper.getToken(requireContext())
|
||||||
if (token != "") {
|
if (token != "") {
|
||||||
val newFragment = AddtoPlaylistDialog()
|
val newFragment = AddtoPlaylistDialog()
|
||||||
@ -62,7 +62,7 @@ class VideoOptionsDialog(private val videoId: String, context: Context) : Dialog
|
|||||||
Toast.makeText(context, R.string.login_first, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, R.string.login_first, Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
2 -> {
|
context?.getString(R.string.share) -> {
|
||||||
val shareDialog = ShareDialog(videoId, false)
|
val shareDialog = ShareDialog(videoId, false)
|
||||||
// using parentFragmentManager is important here
|
// using parentFragmentManager is important here
|
||||||
shareDialog.show(parentFragmentManager, "ShareDialog")
|
shareDialog.show(parentFragmentManager, "ShareDialog")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user