mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40:30 +05:30
Merge pull request #3523 from Bnyro/master
Separate swipe gestures and fullscreen gestures
This commit is contained in:
commit
f517d8492f
@ -96,6 +96,7 @@ object PreferenceKeys {
|
||||
const val LBRY_HLS = "lbry_hls"
|
||||
const val AUTO_FULLSCREEN_SHORTS = "auto_fullscreen_shorts"
|
||||
const val PLAY_AUTOMATICALLY = "play_automatically"
|
||||
const val FULLSCREEN_GESTURES = "fullscreen_gestures"
|
||||
|
||||
/**
|
||||
* Background mode
|
||||
|
@ -322,6 +322,12 @@ object PlayerHelper {
|
||||
true
|
||||
)
|
||||
|
||||
val fullscreenGesturesEnabled: Boolean
|
||||
get() = PreferenceHelper.getBoolean(
|
||||
PreferenceKeys.FULLSCREEN_GESTURES,
|
||||
false
|
||||
)
|
||||
|
||||
val pinchGestureEnabled: Boolean
|
||||
get() = PreferenceHelper.getBoolean(
|
||||
PreferenceKeys.PLAYER_PINCH_CONTROL,
|
||||
|
@ -322,14 +322,12 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
}
|
||||
})
|
||||
|
||||
if (PlayerHelper.swipeGestureEnabled) {
|
||||
binding.playerMotionLayout.addSwipeUpListener {
|
||||
if (this::streams.isInitialized) {
|
||||
if (this::streams.isInitialized && PlayerHelper.fullscreenGesturesEnabled) {
|
||||
binding.player.hideController()
|
||||
setFullscreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binding.playerMotionLayout.progress = 1.toFloat()
|
||||
binding.playerMotionLayout.transitionToStart()
|
||||
|
@ -691,16 +691,15 @@ internal class CustomExoPlayerView(
|
||||
}
|
||||
|
||||
override fun onSwipeCenterScreen(distanceY: Float) {
|
||||
if (!PlayerHelper.swipeGestureEnabled) return
|
||||
if (!PlayerHelper.fullscreenGesturesEnabled) return
|
||||
|
||||
if (isControllerFullyVisible) hideController()
|
||||
if (distanceY >= 0) return
|
||||
|
||||
if (distanceY < 0) {
|
||||
playerGestureController.isMoving = false
|
||||
(context as? AppCompatActivity)?.onBackPressedDispatcher?.onBackPressed()
|
||||
playerViewModel?.isFullscreen?.value = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSwipeEnd() {
|
||||
gestureViewBinding.brightnessControlView.visibility = View.GONE
|
||||
|
@ -462,6 +462,7 @@
|
||||
<string name="edit_group">Edit group</string>
|
||||
<string name="play_automatically">Play automatically</string>
|
||||
<string name="play_automatically_summary">Start playing video automatically when selecting</string>
|
||||
<string name="fullscreen_gestures">Enter/exit fullscreen gestures</string>
|
||||
|
||||
<!-- Notification channel strings -->
|
||||
<string name="download_channel_name">Download Service</string>
|
||||
|
@ -11,6 +11,12 @@
|
||||
app:key="player_swipe_controls"
|
||||
app:title="@string/swipe_controls" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:icon="@drawable/ic_fullscreen"
|
||||
app:key="fullscreen_gestures"
|
||||
app:title="@string/fullscreen_gestures" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:icon="@drawable/ic_pinch_gesture"
|
||||
|
Loading…
Reference in New Issue
Block a user