all: reformat

This commit is contained in:
Alexander Capehart
2025-08-28 22:38:00 -06:00
parent da49e392b8
commit dc64757a69
2 changed files with 46 additions and 46 deletions
@@ -38,7 +38,6 @@ import org.oxycblt.auxio.list.ListViewModel
import org.oxycblt.auxio.music.resolve import org.oxycblt.auxio.music.resolve
import org.oxycblt.auxio.music.resolveNames import org.oxycblt.auxio.music.resolveNames
import org.oxycblt.auxio.playback.state.RepeatMode import org.oxycblt.auxio.playback.state.RepeatMode
import org.oxycblt.auxio.playback.ui.ControlledCoverView
import org.oxycblt.auxio.playback.ui.StyledSeekBar import org.oxycblt.auxio.playback.ui.StyledSeekBar
import org.oxycblt.auxio.playback.ui.stepper.DisplayPortion import org.oxycblt.auxio.playback.ui.stepper.DisplayPortion
import org.oxycblt.auxio.playback.ui.stepper.PlayerFastSeekOverlay import org.oxycblt.auxio.playback.ui.stepper.PlayerFastSeekOverlay
@@ -101,7 +100,7 @@ class PlaybackPanelFragment :
// Disable swipe gestures on cover for now // Disable swipe gestures on cover for now
binding.playbackCover.onSwipeListener = null binding.playbackCover.onSwipeListener = null
// Set up fast seek overlay // Set up fast seek overlay
binding.playbackFastSeekOverlay?.apply { binding.playbackFastSeekOverlay?.apply {
performListener(this@PlaybackPanelFragment) performListener(this@PlaybackPanelFragment)
@@ -214,7 +213,6 @@ class PlaybackPanelFragment :
playbackModel.seekTo(positionDs) playbackModel.seekTo(positionDs)
} }
private fun updateSong(song: Song?) { private fun updateSong(song: Song?) {
if (song == null) { if (song == null) {
// Nothing to do. // Nothing to do.
@@ -268,26 +266,30 @@ class PlaybackPanelFragment :
private fun navigateToCurrentAlbum() { private fun navigateToCurrentAlbum() {
playbackModel.song.value?.let { detailModel.showAlbum(it.album) } playbackModel.song.value?.let { detailModel.showAlbum(it.album) }
} }
// PlayerFastSeekOverlay.PerformListener implementation // PlayerFastSeekOverlay.PerformListener implementation
override fun onDoubleTap() { override fun onDoubleTap() {
// Already handled by onStepForward/onStepBack // Already handled by onStepForward/onStepBack
} }
override fun onDoubleTapEnd() { override fun onDoubleTapEnd() {
// Animation cleanup is handled by the overlay // Animation cleanup is handled by the overlay
} }
override fun getFastSeekDirection(portion: DisplayPortion): PlayerFastSeekOverlay.PerformListener.FastSeekDirection { override fun getFastSeekDirection(
portion: DisplayPortion
): PlayerFastSeekOverlay.PerformListener.FastSeekDirection {
return when (portion) { return when (portion) {
DisplayPortion.LEFT, DisplayPortion.LEFT_HALF -> DisplayPortion.LEFT,
DisplayPortion.LEFT_HALF ->
PlayerFastSeekOverlay.PerformListener.FastSeekDirection.BACKWARD PlayerFastSeekOverlay.PerformListener.FastSeekDirection.BACKWARD
DisplayPortion.RIGHT, DisplayPortion.RIGHT_HALF -> DisplayPortion.RIGHT,
DisplayPortion.RIGHT_HALF ->
PlayerFastSeekOverlay.PerformListener.FastSeekDirection.FORWARD PlayerFastSeekOverlay.PerformListener.FastSeekDirection.FORWARD
else -> PlayerFastSeekOverlay.PerformListener.FastSeekDirection.NONE else -> PlayerFastSeekOverlay.PerformListener.FastSeekDirection.NONE
} }
} }
override fun seek(forward: Boolean) { override fun seek(forward: Boolean) {
if (forward) { if (forward) {
playbackModel.stepForward() playbackModel.stepForward()
@@ -70,11 +70,14 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
circleClipTapView.alpha = 0f circleClipTapView.alpha = 0f
secondsView.visibility = INVISIBLE secondsView.visibility = INVISIBLE
circleClipTapView.visibility = INVISIBLE circleClipTapView.visibility = INVISIBLE
// Set up gesture detection // Set up gesture detection
gestureDetector = GestureDetector(context, object : GestureDetector.SimpleOnGestureListener() { gestureDetector =
override fun onDown(e: MotionEvent) = true GestureDetector(
}) context,
object : GestureDetector.SimpleOnGestureListener() {
override fun onDown(e: MotionEvent) = true
})
gestureDetector.setOnDoubleTapListener(this) gestureDetector.setOnDoubleTapListener(this)
addOnLayoutChangeListener { view, _, _, _, _, _, _, _, _ -> addOnLayoutChangeListener { view, _, _, _, _, _, _, _, _ ->
@@ -95,7 +98,7 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
// Indicates whether this (double) tap is the first of a series // Indicates whether this (double) tap is the first of a series
// Decides whether to call performListener.onAnimationStart or not // Decides whether to call performListener.onAnimationStart or not
private var initTap: Boolean = false private var initTap: Boolean = false
// Track if we're currently animating to avoid redundant animations // Track if we're currently animating to avoid redundant animations
private var isAnimatingIn: Boolean = false private var isAnimatingIn: Boolean = false
private var fadeOutRunnable: Runnable? = null private var fadeOutRunnable: Runnable? = null
@@ -121,11 +124,11 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
"initTap = [$initTap], ") "initTap = [$initTap], ")
// Cancel any pending fade out // Cancel any pending fade out
fadeOutRunnable?.let { fadeOutRunnable?.let {
removeCallbacks(it) removeCallbacks(it)
fadeOutRunnable = null fadeOutRunnable = null
} }
/* /*
* Check if a initial tap occurred or if direction was switched * Check if a initial tap occurred or if direction was switched
*/ */
@@ -145,15 +148,13 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
isAnimatingIn = true isAnimatingIn = true
secondsView.visibility = VISIBLE secondsView.visibility = VISIBLE
circleClipTapView.visibility = VISIBLE circleClipTapView.visibility = VISIBLE
secondsView.animate() secondsView
.animate()
.alpha(1f) .alpha(1f)
.setDuration(200) .setDuration(200)
.withEndAction { isAnimatingIn = false } .withEndAction { isAnimatingIn = false }
.start() .start()
circleClipTapView.animate() circleClipTapView.animate().alpha(1f).setDuration(200).start()
.alpha(1f)
.setDuration(200)
.start()
} }
} }
} else { } else {
@@ -179,28 +180,24 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
initTap = false initTap = false
secondsView.stopAnimation() secondsView.stopAnimation()
// Cancel any existing fade out // Cancel any existing fade out
fadeOutRunnable?.let { fadeOutRunnable?.let { removeCallbacks(it) }
removeCallbacks(it)
}
// Schedule fade out overlay after a delay // Schedule fade out overlay after a delay
fadeOutRunnable = Runnable { fadeOutRunnable = Runnable {
isAnimatingIn = false isAnimatingIn = false
secondsView.animate() secondsView
.animate()
.alpha(0f) .alpha(0f)
.setDuration(200) .setDuration(200)
.withEndAction { .withEndAction { secondsView.visibility = INVISIBLE }
secondsView.visibility = INVISIBLE
}
.start() .start()
circleClipTapView.animate() circleClipTapView
.animate()
.alpha(0f) .alpha(0f)
.setDuration(200) .setDuration(200)
.withEndAction { .withEndAction { circleClipTapView.visibility = INVISIBLE }
circleClipTapView.visibility = INVISIBLE
}
.start() .start()
fadeOutRunnable = null fadeOutRunnable = null
} }
@@ -238,20 +235,21 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
override fun onTouchEvent(event: MotionEvent): Boolean { override fun onTouchEvent(event: MotionEvent): Boolean {
return gestureDetector.onTouchEvent(event) || super.onTouchEvent(event) return gestureDetector.onTouchEvent(event) || super.onTouchEvent(event)
} }
// GestureDetector.OnDoubleTapListener implementation // GestureDetector.OnDoubleTapListener implementation
override fun onSingleTapConfirmed(e: MotionEvent) = false override fun onSingleTapConfirmed(e: MotionEvent) = false
override fun onDoubleTap(e: MotionEvent): Boolean { override fun onDoubleTap(e: MotionEvent): Boolean {
val width = width val width = width
val tapX = e.x val tapX = e.x
val portion = when { val portion =
tapX < width * 0.33f -> DisplayPortion.LEFT_HALF when {
tapX > width * 0.67f -> DisplayPortion.RIGHT_HALF tapX < width * 0.33f -> DisplayPortion.LEFT_HALF
else -> DisplayPortion.MIDDLE tapX > width * 0.67f -> DisplayPortion.RIGHT_HALF
} else -> DisplayPortion.MIDDLE
}
if (portion != DisplayPortion.MIDDLE) { if (portion != DisplayPortion.MIDDLE) {
onDoubleTapStarted(portion) onDoubleTapStarted(portion)
onDoubleTapProgressDown(portion) onDoubleTapProgressDown(portion)
@@ -260,9 +258,9 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
} }
return false return false
} }
override fun onDoubleTapEvent(e: MotionEvent) = false override fun onDoubleTapEvent(e: MotionEvent) = false
companion object { companion object {
private const val TAG = "PlayerFastSeekOverlay" private const val TAG = "PlayerFastSeekOverlay"
private val DEBUG = BuildConfig.DEBUG private val DEBUG = BuildConfig.DEBUG