Skip to content

Commit

Permalink
Merge pull request #213 from jorritsmit/reduce_gesture_detection_area
Browse files Browse the repository at this point in the history
Do not detect gestures in top of screen
  • Loading branch information
Maxr1998 committed Oct 30, 2020
2 parents d3fb5b7 + ead02a4 commit 7351e01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Expand Up @@ -30,6 +30,7 @@ import org.jellyfin.mobile.utils.*
import org.jellyfin.mobile.utils.Constants.DEFAULT_CENTER_OVERLAY_TIMEOUT_MS
import org.jellyfin.mobile.utils.Constants.DEFAULT_CONTROLS_TIMEOUT_MS
import org.jellyfin.mobile.utils.Constants.DEFAULT_SEEK_TIME_MS
import org.jellyfin.mobile.utils.Constants.GESTURE_EXCLUSION_AREA_TOP
import org.koin.android.ext.android.inject
import timber.log.Timber
import kotlin.math.abs
Expand Down Expand Up @@ -280,6 +281,10 @@ class PlayerFragment : Fragment() {
if (!swipeGesturesEnabled)
return false

// Check whether swipe was started in excluded region
if (firstEvent.y < GESTURE_EXCLUSION_AREA_TOP * resources.displayMetrics.density)
return false

// Check whether swipe was oriented vertically
if (abs(distanceY / distanceX) < 2)
return false
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/org/jellyfin/mobile/utils/Constants.kt
Expand Up @@ -82,6 +82,7 @@ object Constants {
const val TICKS_PER_MILLISECOND = 10000
const val PLAYER_TIME_UPDATE_RATE = 3000L
const val DEFAULT_CONTROLS_TIMEOUT_MS = 2500
const val GESTURE_EXCLUSION_AREA_TOP = 48
const val DEFAULT_CENTER_OVERLAY_TIMEOUT_MS = 250
const val DEFAULT_SEEK_TIME_MS = 5000L
const val SUPPORTED_VIDEO_PLAYER_PLAYBACK_ACTIONS: Long = PlaybackState.ACTION_PLAY_PAUSE or
Expand Down

0 comments on commit 7351e01

Please sign in to comment.