mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Merge pull request #1883 from Bnyro/master
Option to open queue from background notification
This commit is contained in:
commit
7a19f00a99
@ -8,4 +8,5 @@ object IntentData {
|
|||||||
const val timeStamp = "timeStamp"
|
const val timeStamp = "timeStamp"
|
||||||
const val position = "position"
|
const val position = "position"
|
||||||
const val fileName = "fileName"
|
const val fileName = "fileName"
|
||||||
|
const val openQueueOnce = "openQueue"
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,7 @@ object PreferenceKeys {
|
|||||||
* Background mode
|
* Background mode
|
||||||
*/
|
*/
|
||||||
const val BACKGROUND_PLAYBACK_SPEED = "background_playback_speed"
|
const val BACKGROUND_PLAYBACK_SPEED = "background_playback_speed"
|
||||||
|
const val NOTIFICATION_OPEN_QUEUE = "notification_open_queue"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifications
|
* Notifications
|
||||||
|
@ -319,6 +319,10 @@ class MainActivity : BaseActivity() {
|
|||||||
"library" ->
|
"library" ->
|
||||||
navController.navigate(R.id.libraryFragment)
|
navController.navigate(R.id.libraryFragment)
|
||||||
}
|
}
|
||||||
|
if (intent?.getBooleanExtra(IntentData.openQueueOnce, false) == true) {
|
||||||
|
PlayingQueueSheet()
|
||||||
|
.show(supportFragmentManager)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadVideo(videoId: String, timeStamp: Long?) {
|
private fun loadVideo(videoId: String, timeStamp: Long?) {
|
||||||
|
@ -4,7 +4,6 @@ import android.os.Bundle
|
|||||||
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.fragment.app.FragmentManager
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.github.libretube.databinding.BottomSheetBinding
|
import com.github.libretube.databinding.BottomSheetBinding
|
||||||
import com.github.libretube.obj.BottomSheetItem
|
import com.github.libretube.obj.BottomSheetItem
|
||||||
@ -47,11 +46,6 @@ open class BaseBottomSheet : ExpandedBottomSheet() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun show(fragmentManager: FragmentManager) = show(
|
|
||||||
fragmentManager,
|
|
||||||
null
|
|
||||||
)
|
|
||||||
|
|
||||||
override fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean) {
|
override fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean) {
|
||||||
super.onPictureInPictureModeChanged(isInPictureInPictureMode)
|
super.onPictureInPictureModeChanged(isInPictureInPictureMode)
|
||||||
dialog?.dismiss()
|
dialog?.dismiss()
|
||||||
|
@ -5,6 +5,7 @@ import android.content.res.Configuration
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
|
import androidx.fragment.app.FragmentManager
|
||||||
import com.google.android.material.R
|
import com.google.android.material.R
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
@ -27,4 +28,9 @@ open class ExpandedBottomSheet : BottomSheetDialogFragment() {
|
|||||||
|
|
||||||
return dialog
|
return dialog
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun show(fragmentManager: FragmentManager) = show(
|
||||||
|
fragmentManager,
|
||||||
|
null
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import android.os.Bundle
|
|||||||
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.fragment.app.FragmentManager
|
|
||||||
import com.github.libretube.databinding.PlaybackBottomSheetBinding
|
import com.github.libretube.databinding.PlaybackBottomSheetBinding
|
||||||
import com.github.libretube.extensions.round
|
import com.github.libretube.extensions.round
|
||||||
import com.google.android.exoplayer2.PlaybackParameters
|
import com.google.android.exoplayer2.PlaybackParameters
|
||||||
@ -55,9 +54,4 @@ class PlaybackSpeedSheet(
|
|||||||
binding.pitch.value.round(2)
|
binding.pitch.value.round(2)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun show(fragmentManager: FragmentManager) = show(
|
|
||||||
fragmentManager,
|
|
||||||
null
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import com.github.libretube.api.obj.Streams
|
|||||||
import com.github.libretube.constants.BACKGROUND_CHANNEL_ID
|
import com.github.libretube.constants.BACKGROUND_CHANNEL_ID
|
||||||
import com.github.libretube.constants.IntentData
|
import com.github.libretube.constants.IntentData
|
||||||
import com.github.libretube.constants.PLAYER_NOTIFICATION_ID
|
import com.github.libretube.constants.PLAYER_NOTIFICATION_ID
|
||||||
|
import com.github.libretube.constants.PreferenceKeys
|
||||||
import com.github.libretube.ui.activities.MainActivity
|
import com.github.libretube.ui.activities.MainActivity
|
||||||
import com.google.android.exoplayer2.ExoPlayer
|
import com.google.android.exoplayer2.ExoPlayer
|
||||||
import com.google.android.exoplayer2.Player
|
import com.google.android.exoplayer2.Player
|
||||||
@ -74,7 +75,11 @@ class NowPlayingNotification(
|
|||||||
// that's the only way to launch back into the previous activity (e.g. the player view
|
// that's the only way to launch back into the previous activity (e.g. the player view
|
||||||
val intent = Intent(context, MainActivity::class.java).apply {
|
val intent = Intent(context, MainActivity::class.java).apply {
|
||||||
if (isBackgroundPlayerNotification) {
|
if (isBackgroundPlayerNotification) {
|
||||||
|
if (PreferenceHelper.getBoolean(PreferenceKeys.NOTIFICATION_OPEN_QUEUE, true)) {
|
||||||
|
putExtra(IntentData.openQueueOnce, true)
|
||||||
|
} else {
|
||||||
putExtra(IntentData.videoId, videoId)
|
putExtra(IntentData.videoId, videoId)
|
||||||
|
}
|
||||||
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -377,6 +377,7 @@
|
|||||||
<string name="hls_instead_of_dash_summary">Use HLS instead of DASH (will be slower, not recommended)</string>
|
<string name="hls_instead_of_dash_summary">Use HLS instead of DASH (will be slower, not recommended)</string>
|
||||||
<string name="auto_quality">Auto</string>
|
<string name="auto_quality">Auto</string>
|
||||||
<string name="limit_to_runtime">Limit to runtime</string>
|
<string name="limit_to_runtime">Limit to runtime</string>
|
||||||
|
<string name="open_queue_from_notification">Open queue from notification</string>
|
||||||
|
|
||||||
<!-- Notification channel strings -->
|
<!-- Notification channel strings -->
|
||||||
<string name="download_channel_name">Download Service</string>
|
<string name="download_channel_name">Download Service</string>
|
||||||
|
@ -98,6 +98,12 @@
|
|||||||
app:valueFrom="0.2"
|
app:valueFrom="0.2"
|
||||||
app:valueTo="4.0" />
|
app:valueTo="4.0" />
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:icon="@drawable/ic_grid"
|
||||||
|
android:title="@string/open_queue_from_notification"
|
||||||
|
app:key="notification_open_queue" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user