all: reformat
This commit is contained in:
@@ -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
|
||||||
@@ -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.
|
||||||
@@ -278,11 +276,15 @@ class PlaybackPanelFragment :
|
|||||||
// 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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,9 +72,12 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
|
|||||||
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, _, _, _, _, _, _, _, _ ->
|
||||||
@@ -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 {
|
||||||
@@ -181,26 +182,22 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
|
|||||||
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
|
||||||
}
|
}
|
||||||
@@ -246,11 +243,12 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
|
|||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user