[update] Set gesture protection for the bottom of the screen

This commit is contained in:
acite
2025-09-27 17:31:22 +08:00
parent 22469e1d49
commit cf0c68812d
2 changed files with 9 additions and 7 deletions

View File

@@ -107,17 +107,21 @@ fun VideoPlayerLandscape(videoPlayerViewModel: VideoPlayerViewModel) {
detectDragGestures( detectDragGestures(
onDragStart = { offset -> onDragStart = { offset ->
if (videoPlayerViewModel.locked) return@detectDragGestures if (videoPlayerViewModel.locked) return@detectDragGestures
if (offset.x < size.width / 2) { if(offset.y > size.height * 0.8 || offset.y < size.height * 0.2)
videoPlayerViewModel.draggingPurpose = -1; videoPlayerViewModel.draggingPurpose = -3
// Set gesture protection for the bottom of the screen
// (Prevent conflicts with system gestures, such as dropdown status bar, bottom swipe up menu)
else if (offset.x < size.width / 2) {
videoPlayerViewModel.draggingPurpose = -1
} else { } else {
videoPlayerViewModel.draggingPurpose = -2; videoPlayerViewModel.draggingPurpose = -2
} }
}, },
onDragEnd = { onDragEnd = {
if (videoPlayerViewModel.isPlaying && videoPlayerViewModel.draggingPurpose == 0) if (videoPlayerViewModel.isPlaying && videoPlayerViewModel.draggingPurpose == 0)
exoPlayer.play() exoPlayer.play()
videoPlayerViewModel.draggingPurpose = -1; videoPlayerViewModel.draggingPurpose = -1
}, },
onDrag = { change, dragAmount -> onDrag = { change, dragAmount ->
if (videoPlayerViewModel.locked) return@detectDragGestures if (videoPlayerViewModel.locked) return@detectDragGestures

View File

@@ -89,7 +89,6 @@ class VideoPlayerViewModel @Inject constructor(
var brit by mutableFloatStateOf(0.0f) var brit by mutableFloatStateOf(0.0f)
val database: VideoRecordDatabase = VideoRecordDatabase.getDatabase(context) val database: VideoRecordDatabase = VideoRecordDatabase.getDatabase(context)
var cues by mutableStateOf(listOf<Cue>()) var cues by mutableStateOf(listOf<Cue>())
var currentKlass = mutableStateOf("") var currentKlass = mutableStateOf("")
var currentId = mutableStateOf("") var currentId = mutableStateOf("")
var currentName = mutableStateOf("") var currentName = mutableStateOf("")
@@ -104,7 +103,7 @@ class VideoPlayerViewModel @Inject constructor(
val oId = videoId.hexToString() val oId = videoId.hexToString()
var spec = "-1" var spec = "-1"
var vs = mutableListOf<List<String>>() var vs: MutableList<List<String>>
if(oId.contains("|")) if(oId.contains("|"))
{ {
@@ -126,7 +125,6 @@ class VideoPlayerViewModel @Inject constructor(
val ii = database.userDao().getAll().first() val ii = database.userDao().getAll().first()
val ix = ii.filter { it.id in videos.map{ m -> m.id } }.maxByOrNull { it.time } val ix = ii.filter { it.id in videos.map{ m -> m.id } }.maxByOrNull { it.time }
startPlay( startPlay(
if(spec != "-1") if(spec != "-1")
videos.first { it.id == spec} videos.first { it.id == spec}