mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
Add control to open the video from the audio player
This commit is contained in:
parent
7ffe3a6ed9
commit
ee0607fb07
@ -12,6 +12,7 @@ import android.text.format.DateUtils
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.api.obj.StreamItem
|
import com.github.libretube.api.obj.StreamItem
|
||||||
import com.github.libretube.databinding.FragmentAudioPlayerBinding
|
import com.github.libretube.databinding.FragmentAudioPlayerBinding
|
||||||
@ -24,6 +25,7 @@ import com.github.libretube.ui.base.BaseFragment
|
|||||||
import com.github.libretube.ui.dialogs.ShareDialog
|
import com.github.libretube.ui.dialogs.ShareDialog
|
||||||
import com.github.libretube.ui.sheets.PlaybackOptionsSheet
|
import com.github.libretube.ui.sheets.PlaybackOptionsSheet
|
||||||
import com.github.libretube.ui.sheets.PlayingQueueSheet
|
import com.github.libretube.ui.sheets.PlayingQueueSheet
|
||||||
|
import com.github.libretube.util.BackgroundHelper
|
||||||
import com.github.libretube.util.ImageHelper
|
import com.github.libretube.util.ImageHelper
|
||||||
import com.github.libretube.util.NavigationHelper
|
import com.github.libretube.util.NavigationHelper
|
||||||
import com.github.libretube.util.PlayingQueue
|
import com.github.libretube.util.PlayingQueue
|
||||||
@ -101,6 +103,17 @@ class AudioPlayerFragment : BaseFragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.openVideo.setOnClickListener {
|
||||||
|
NavigationHelper.navigateVideo(
|
||||||
|
context = requireContext(),
|
||||||
|
videoId = PlayingQueue.getCurrent()?.url?.toID(),
|
||||||
|
keepQueue = true,
|
||||||
|
forceVideo = true
|
||||||
|
)
|
||||||
|
BackgroundHelper.stopBackgroundPlay(requireContext())
|
||||||
|
findNavController().popBackStack()
|
||||||
|
}
|
||||||
|
|
||||||
binding.share.setOnClickListener {
|
binding.share.setOnClickListener {
|
||||||
val currentVideo = PlayingQueue.getCurrent() ?: return@setOnClickListener
|
val currentVideo = PlayingQueue.getCurrent() ?: return@setOnClickListener
|
||||||
ShareDialog(
|
ShareDialog(
|
||||||
|
@ -60,11 +60,12 @@ object NavigationHelper {
|
|||||||
playlistId: String? = null,
|
playlistId: String? = null,
|
||||||
channelId: String? = null,
|
channelId: String? = null,
|
||||||
keepQueue: Boolean = false,
|
keepQueue: Boolean = false,
|
||||||
timeStamp: Long? = null
|
timeStamp: Long? = null,
|
||||||
|
forceVideo: Boolean = false
|
||||||
) {
|
) {
|
||||||
if (videoId == null) return
|
if (videoId == null) return
|
||||||
|
|
||||||
if (PreferenceHelper.getBoolean(PreferenceKeys.AUDIO_ONLY_MODE, false)) {
|
if (PreferenceHelper.getBoolean(PreferenceKeys.AUDIO_ONLY_MODE, false) && !forceVideo) {
|
||||||
BackgroundHelper.stopBackgroundPlay(context)
|
BackgroundHelper.stopBackgroundPlay(context)
|
||||||
BackgroundHelper.playOnBackground(
|
BackgroundHelper.playOnBackground(
|
||||||
context,
|
context,
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
<vector android:height="24dp" android:tint="#000000"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:viewportHeight="24" android:viewportWidth="24"
|
android:width="24dp"
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:height="24dp"
|
||||||
<path android:fillColor="@android:color/white" android:pathData="M21,3L3,3c-1.11,0 -2,0.89 -2,2v12c0,1.1 0.89,2 2,2h5v2h8v-2h5c1.1,0 1.99,-0.9 1.99,-2L23,5c0,-1.11 -0.9,-2 -2,-2zM21,17L3,17L3,5h18v12zM16,11l-7,4L9,7z"/>
|
android:tint="?attr/colorControlNormal"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M21,3L3,3c-1.11,0 -2,0.89 -2,2v12c0,1.1 0.89,2 2,2h5v2h8v-2h5c1.1,0 1.99,-0.9 1.99,-2L23,5c0,-1.11 -0.9,-2 -2,-2zM21,17L3,17L3,5h18v12zM16,11l-7,4L9,7z" />
|
||||||
</vector>
|
</vector>
|
||||||
|
@ -84,7 +84,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginVertical="36dp">
|
android:layout_marginTop="24dp"
|
||||||
|
android:layout_marginBottom="36dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/prev"
|
android:id="@+id/prev"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user