-
-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add swipe gesture exclusion size preference #995
base: master
Are you sure you want to change the base?
Add swipe gesture exclusion size preference #995
Conversation
@@ -90,6 +90,7 @@ | |||
<string name="pref_exoplayer_start_landscape_video_in_landscape">Start landscape mode videos in landscape orientation</string> | |||
<string name="pref_exoplayer_allow_brightness_volume_gesture">Brightness and volume gestures</string> | |||
<string name="pref_exoplayer_remember_brightness">Remember display brightness</string> | |||
<string name="pref_exoplayer_swipe_exclusion_size_vertical">Gesture dead zone</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what the desired label would be here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized that my suggestion with insets doesn't really work (the gesture insets are way smaller than what we have now, even), so I prefer your solution. A few small things to fix, then it's good to go.
@@ -91,6 +91,9 @@ class AppPreferences(context: Context) { | |||
val exoPlayerAllowSwipeGestures: Boolean | |||
get() = sharedPreferences.getBoolean(Constants.PREF_EXOPLAYER_ALLOW_SWIPE_GESTURES, true) | |||
|
|||
val exoPlayerSwipeExclusionSizeVertical: Int | |||
get() = sharedPreferences.getInt(Constants.PREF_EXOPLAYER_SWIPE_GESTURE_EXCLUSION_SIZE_VERTICAL, 64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get() = sharedPreferences.getInt(Constants.PREF_EXOPLAYER_SWIPE_GESTURE_EXCLUSION_SIZE_VERTICAL, 64) | |
get() = sharedPreferences.getInt(Constants.PREF_EXOPLAYER_SWIPE_GESTURE_EXCLUSION_SIZE_VERTICAL, 64) |
I think you could still use the previous constant here.
@@ -35,6 +35,7 @@ object Constants { | |||
const val PREF_VIDEO_PLAYER_TYPE = "pref_video_player_type" | |||
const val PREF_EXOPLAYER_START_LANDSCAPE_VIDEO_IN_LANDSCAPE = "pref_exoplayer_start_landscape_video_in_landscape" | |||
const val PREF_EXOPLAYER_ALLOW_SWIPE_GESTURES = "pref_exoplayer_allow_swipe_gestures" | |||
const val PREF_EXOPLAYER_SWIPE_GESTURE_EXCLUSION_SIZE_VERTICAL = "pref_exoplayer_swipe_exclusion_size_vertical" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idk why I originally named it like that, but this is better:
const val PREF_EXOPLAYER_SWIPE_GESTURE_EXCLUSION_SIZE_VERTICAL = "pref_exoplayer_swipe_exclusion_size_vertical" | |
const val PREF_EXOPLAYER_SWIPE_GESTURE_EXCLUSION_ZONE_HEIGHT = "pref_exoplayer_swipe_exclusion_zone_height" |
Please rename the constant/preference/string name in other places as well.
@@ -101,7 +102,6 @@ object Constants { | |||
const val TICKS_PER_MILLISECOND = 10000 | |||
const val PLAYER_TIME_UPDATE_RATE = 10000L | |||
const val DEFAULT_CONTROLS_TIMEOUT_MS = 2500 | |||
const val SWIPE_GESTURE_EXCLUSION_SIZE_VERTICAL = 64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be kept and used as a default for the preference, see above.
@@ -90,6 +90,7 @@ | |||
<string name="pref_exoplayer_start_landscape_video_in_landscape">Start landscape mode videos in landscape orientation</string> | |||
<string name="pref_exoplayer_allow_brightness_volume_gesture">Brightness and volume gestures</string> | |||
<string name="pref_exoplayer_remember_brightness">Remember display brightness</string> | |||
<string name="pref_exoplayer_swipe_exclusion_size_vertical">Gesture dead zone</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine as is.
min = 0 | ||
default = 64 | ||
max = 128 | ||
step = 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preferably use constants here as well.
step = 8 | ||
enabled = appPreferences.videoPlayerType == VideoPlayerType.EXO_PLAYER && appPreferences.exoPlayerAllowSwipeGestures | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -97,6 +99,7 @@ class SettingsFragment : Fragment() { | |||
defaultOnSelectionChange { selection -> | |||
startLandscapeVideoInLandscapePreference.enabled = selection == VideoPlayerType.EXO_PLAYER | |||
swipeGesturesPreference.enabled = selection == VideoPlayerType.EXO_PLAYER | |||
swipeExclusionZoneVertical.enabled = selection == VideoPlayerType.EXO_PLAYER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swipeExclusionZoneVertical.enabled = selection == VideoPlayerType.EXO_PLAYER | |
swipeExclusionZoneVertical.enabled = selection == VideoPlayerType.EXO_PLAYER && swipeGesturesPreference.checked |
Changes
Adds preference to modify the existing
SWIPE_GESTURE_EXCLUSION_SIZE_VERTICAL
constant, allowing the user to configure the size of the vertical exclusion zone when using ExoPlayer. Also implemented the necessary conditionals to enable / disable this setting based on other relevant settings. Retains the current default value of64
, allows for a range between 0-128.NOTE:
SWIPE_GESTURE_EXCLUSION_SIZE_VERTICAL
was changed toPREF_EXOPLAYER_SWIPE_GESTURE_EXCLUSION_SIZE_VERTICAL
to better conform with existing conventions - let me know if a different name is desired.Issues
Implements #994