mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30: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,12 +322,10 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
}
|
||||
})
|
||||
|
||||
if (PlayerHelper.swipeGestureEnabled) {
|
||||
binding.playerMotionLayout.addSwipeUpListener {
|
||||
if (this::streams.isInitialized) {
|
||||
binding.player.hideController()
|
||||
setFullscreen()
|
||||
}
|
||||
binding.playerMotionLayout.addSwipeUpListener {
|
||||
if (this::streams.isInitialized && PlayerHelper.fullscreenGesturesEnabled) {
|
||||
binding.player.hideController()
|
||||
setFullscreen()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -691,15 +691,14 @@ 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
|
||||
}
|
||||
playerGestureController.isMoving = false
|
||||
(context as? AppCompatActivity)?.onBackPressedDispatcher?.onBackPressed()
|
||||
playerViewModel?.isFullscreen?.value = false
|
||||
}
|
||||
|
||||
override fun onSwipeEnd() {
|
||||
|
@ -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