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 LBRY_HLS = "lbry_hls"
|
||||||
const val AUTO_FULLSCREEN_SHORTS = "auto_fullscreen_shorts"
|
const val AUTO_FULLSCREEN_SHORTS = "auto_fullscreen_shorts"
|
||||||
const val PLAY_AUTOMATICALLY = "play_automatically"
|
const val PLAY_AUTOMATICALLY = "play_automatically"
|
||||||
|
const val FULLSCREEN_GESTURES = "fullscreen_gestures"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Background mode
|
* Background mode
|
||||||
|
@ -322,6 +322,12 @@ object PlayerHelper {
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val fullscreenGesturesEnabled: Boolean
|
||||||
|
get() = PreferenceHelper.getBoolean(
|
||||||
|
PreferenceKeys.FULLSCREEN_GESTURES,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
val pinchGestureEnabled: Boolean
|
val pinchGestureEnabled: Boolean
|
||||||
get() = PreferenceHelper.getBoolean(
|
get() = PreferenceHelper.getBoolean(
|
||||||
PreferenceKeys.PLAYER_PINCH_CONTROL,
|
PreferenceKeys.PLAYER_PINCH_CONTROL,
|
||||||
|
@ -322,14 +322,12 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if (PlayerHelper.swipeGestureEnabled) {
|
|
||||||
binding.playerMotionLayout.addSwipeUpListener {
|
binding.playerMotionLayout.addSwipeUpListener {
|
||||||
if (this::streams.isInitialized) {
|
if (this::streams.isInitialized && PlayerHelper.fullscreenGesturesEnabled) {
|
||||||
binding.player.hideController()
|
binding.player.hideController()
|
||||||
setFullscreen()
|
setFullscreen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
binding.playerMotionLayout.progress = 1.toFloat()
|
binding.playerMotionLayout.progress = 1.toFloat()
|
||||||
binding.playerMotionLayout.transitionToStart()
|
binding.playerMotionLayout.transitionToStart()
|
||||||
|
@ -691,16 +691,15 @@ internal class CustomExoPlayerView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onSwipeCenterScreen(distanceY: Float) {
|
override fun onSwipeCenterScreen(distanceY: Float) {
|
||||||
if (!PlayerHelper.swipeGestureEnabled) return
|
if (!PlayerHelper.fullscreenGesturesEnabled) return
|
||||||
|
|
||||||
if (isControllerFullyVisible) hideController()
|
if (isControllerFullyVisible) hideController()
|
||||||
|
if (distanceY >= 0) return
|
||||||
|
|
||||||
if (distanceY < 0) {
|
|
||||||
playerGestureController.isMoving = false
|
playerGestureController.isMoving = false
|
||||||
(context as? AppCompatActivity)?.onBackPressedDispatcher?.onBackPressed()
|
(context as? AppCompatActivity)?.onBackPressedDispatcher?.onBackPressed()
|
||||||
playerViewModel?.isFullscreen?.value = false
|
playerViewModel?.isFullscreen?.value = false
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSwipeEnd() {
|
override fun onSwipeEnd() {
|
||||||
gestureViewBinding.brightnessControlView.visibility = View.GONE
|
gestureViewBinding.brightnessControlView.visibility = View.GONE
|
||||||
|
@ -462,6 +462,7 @@
|
|||||||
<string name="edit_group">Edit group</string>
|
<string name="edit_group">Edit group</string>
|
||||||
<string name="play_automatically">Play automatically</string>
|
<string name="play_automatically">Play automatically</string>
|
||||||
<string name="play_automatically_summary">Start playing video automatically when selecting</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 -->
|
<!-- Notification channel strings -->
|
||||||
<string name="download_channel_name">Download Service</string>
|
<string name="download_channel_name">Download Service</string>
|
||||||
|
@ -11,6 +11,12 @@
|
|||||||
app:key="player_swipe_controls"
|
app:key="player_swipe_controls"
|
||||||
app:title="@string/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
|
<SwitchPreferenceCompat
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:icon="@drawable/ic_pinch_gesture"
|
android:icon="@drawable/ic_pinch_gesture"
|
||||||
|
Loading…
Reference in New Issue
Block a user