PlayerGestureHelper
Handles all gesture, volume, brightness, speed-up, zoom, and hardware-key-event input for a PlayerView. Keeps these separate from the player-view setup and lifecycle code in PlayerView itself.
Instantiated and owned by PlayerView; accessed from host fragments via the delegate properties PlayerView exposes.
Properties
White overlay inflated into exo_content_frame; alpha encodes extra brightness (0–1).
Action from the previous touch sequence; guards against mis-detected double-taps after swipes.
Brightness state
Volume state
Current in-progress swipe action, null when no swipe is active.
The matrix the zoom will animate to after the user lifts fingers.
Whether double-tapping left/right seeks backward/forward.
Whether double-tapping the center of the screen pauses (left/right still seeks if doubleTapEnabled).
Seek distance (ms) for each double-tap seek. Read from prefs in initialize.
Hold / speed-up
Touch tracking
Set true by the host when the player occupies the full screen. Controls whether hardware volume-key overrides are active (phones/emulators only).
System time of the most-recent touch end. Updated by callers at the end of every ACTION_UP.
Running snap-back animation, or null.
Gesture settings (read from prefs in initialize)
Whether the player UI was visible when the current swipe gesture began.
When true, read/write system brightness via Settings.System.SCREEN_BRIGHTNESS. Automatically falls back to window-attribute brightness if the permission is missing.
Optional view for showing the snap-hint outline during zoom (set by FullScreenPlayer).
Current zoom+pan matrix, or null when no zoom is active.
Functions
Fades playerRewHolder, playerFfwdHolder, and playerPausePlay to fadeTo (0f or 1f). Always resets the holder alphas to 1f first so any stale fillAfter state is cleared. Called from host fragments' show/hide control animations so both GeneratorPlayer and trailer share the same fade logic.
Applies newMatrix (scale + translation only) to the video surface view.
Clears all zoom state and resets the video surface view to 1:1 scale. Does NOT change the ExoPlayer resize mode - call PlayerView.resize separately.
Returns the current zoom matrix, accounting for RESIZE_MODE_ZOOM which already has an implicit zoom applied.
Plays the fast-forward animation and seeks forward by fastForwardTime.
Reads from Settings.System.SCREEN_BRIGHTNESS, falling back to the window attribute if the permission is absent.
Handles a hardware volume key press. Only active on phones/emulators when isFullScreen is true.
Processes a two-finger zoom/pan gesture event. Handles scale detection, panning, and the snap-back animation after finger lift.
Called from PlayerView.initialize after views are bound.
Called from PlayerView.release.
Nulls keyEventListener. Called from the host fragment's onPause.
Removes the overlay layout listener registered by requestUpdateBrightnessOverlayOnNextLayout.
Attaches a persistent layout-change listener to the ExoPlayer view so updateBrightnessOverlayBounds is called on every layout pass (orientation change, aspect-ratio change, zoom, PiP transition, etc.).
Resets the fast-forward button label to the standard "+Xs" format.
Resets the rewind button label to the standard "–Xs" format.
Resets zoom to fit mode if any zoom is currently active. Calls PlayerView.resize to update the ExoPlayer resize mode.
Plays the rewind animation and seeks back by fastForwardTime.
Sets Settings.System.SCREEN_BRIGHTNESS, falling back to the window attribute if the permission is absent.
Registers the basic volume-key listener on keyEventListener. Called from PlayerView.initialize and from the host fragment's onResume.
Touch gestures
Speed-up
Resizes and repositions brightnessOverlay to exactly match the visible video surface, accounting for zoom scale and translation.
Syncs currentRequestedVolume with the current system stream volume.