This commit is contained in:
Bnyro 2022-05-27 19:22:45 +02:00
parent 5c7bfc78a9
commit ce801b59c7
4 changed files with 8 additions and 5 deletions

View File

@ -91,7 +91,7 @@ class BackgroundMode {
/**
* Gets the video data and prepares the [player].
*/
fun playOnBackgroundMode(c: Context, videoId: String, seekToPosition : Long) {
fun playOnBackgroundMode(c: Context, videoId: String, seekToPosition: Long) {
runBlocking {
val job = launch {
response = RetrofitInstance.api.getStreams(videoId)
@ -111,7 +111,6 @@ class BackgroundMode {
}
}
/**
* Creates a singleton of this class, to not create a new [player] every time.
*/

View File

@ -40,7 +40,9 @@ class VideoOptionsDialog(private val videoId: String, context: Context) : Dialog
when (which) {
// This for example will be the "Background mode" option
0 -> {
BackgroundMode.getInstance().playOnBackgroundMode(requireContext(), videoId, 0)
BackgroundMode
.getInstance()
.playOnBackgroundMode(requireContext(), videoId, 0)
}
else -> {
dialog.dismiss()

View File

@ -86,7 +86,8 @@ class SubscriptionAdapter(
}
holder.v.setOnLongClickListener {
val videoId = trending.url!!.replace("/watch?v=", "")
VideoOptionsDialog(videoId, holder.v.context).show(childFragmentManager, VideoOptionsDialog.TAG)
VideoOptionsDialog(videoId, holder.v.context)
.show(childFragmentManager, VideoOptionsDialog.TAG)
true
}
}

View File

@ -82,7 +82,8 @@ class TrendingAdapter(
}
holder.v.setOnLongClickListener {
val videoId = trending.url!!.replace("/watch?v=", "")
VideoOptionsDialog(videoId, holder.v.context).show(childFragmentManager, VideoOptionsDialog.TAG)
VideoOptionsDialog(videoId, holder.v.context)
.show(childFragmentManager, VideoOptionsDialog.TAG)
true
}
}