playback: fix disabling on playback layout
Fix my haphazard disabling implementation that I copied from umano without realizing that it would actually break everything.
This commit is contained in:
parent
cfc7352571
commit
6b54d4b783
4 changed files with 16 additions and 15 deletions
|
@ -166,7 +166,6 @@ class AlbumDetailFragment : DetailFragment() {
|
|||
val pos = adapter.currentList.indexOfFirst { it.id == id && it is Song }
|
||||
|
||||
if (pos != -1) {
|
||||
logD("IDIOT.")
|
||||
binding.detailRecycler.post {
|
||||
// Make sure to increment the position to make up for the detail header
|
||||
binding.detailRecycler.layoutManager?.startSmoothScroll(
|
||||
|
|
|
@ -22,6 +22,7 @@ import android.content.Context
|
|||
import android.util.AttributeSet
|
||||
import android.view.WindowInsets
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.postDelayed
|
||||
import androidx.core.view.updatePadding
|
||||
import com.google.android.material.color.MaterialColors
|
||||
import org.oxycblt.auxio.R
|
||||
|
@ -47,6 +48,12 @@ class PlaybackBarView @JvmOverloads constructor(
|
|||
id = R.id.playback_bar
|
||||
|
||||
setOnLongClickListener {
|
||||
isPressed = true
|
||||
|
||||
postDelayed(1000) {
|
||||
isPressed = false
|
||||
}
|
||||
|
||||
mCallback?.onNavToItem()
|
||||
true
|
||||
}
|
||||
|
|
|
@ -208,7 +208,12 @@ class PlaybackLayout @JvmOverloads constructor(
|
|||
private fun applyState(state: PanelState) {
|
||||
// Dragging events are really complex and we don't want to mess up the state
|
||||
// while we are in one.
|
||||
if (!isEnabled || state == panelState || panelState == PanelState.DRAGGING) {
|
||||
if (state == panelState || panelState == PanelState.DRAGGING) {
|
||||
return
|
||||
}
|
||||
|
||||
// Disallow events that aren't showing the bar when disabled
|
||||
if (state != PanelState.HIDDEN && state != PanelState.COLLAPSED && !isEnabled) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -426,8 +431,7 @@ class PlaybackLayout @JvmOverloads constructor(
|
|||
|
||||
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
|
||||
if (!canSlide) {
|
||||
dragHelper.abort()
|
||||
return false
|
||||
return super.onInterceptTouchEvent(ev)
|
||||
}
|
||||
|
||||
val adx = abs(ev.x - initMotionX)
|
||||
|
@ -471,11 +475,6 @@ class PlaybackLayout @JvmOverloads constructor(
|
|||
override fun computeScroll() {
|
||||
// I have no idea what this does but it seems important so I keep it around
|
||||
if (dragHelper.continueSettling(true)) {
|
||||
if (!isEnabled) {
|
||||
dragHelper.abort()
|
||||
return
|
||||
}
|
||||
|
||||
postInvalidateOnAnimation()
|
||||
}
|
||||
}
|
||||
|
@ -578,11 +577,6 @@ class PlaybackLayout @JvmOverloads constructor(
|
|||
(computePanelTopPosition(0f) - topPosition).toFloat() / panelRange
|
||||
|
||||
private fun smoothSlideTo(offset: Float) {
|
||||
if (!isEnabled) {
|
||||
// Disabled, do nothing
|
||||
return
|
||||
}
|
||||
|
||||
// Find the new top position and animate the panel to that
|
||||
val panelTop = computePanelTopPosition(offset)
|
||||
|
||||
|
|
|
@ -37,9 +37,11 @@
|
|||
android:id="@+id/playback_cover"
|
||||
style="@style/Widget.Auxio.Image.Full"
|
||||
android:layout_margin="@dimen/spacing_mid_large"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:contentDescription="@{@string/desc_album_cover(song.name)}"
|
||||
app:albumArt="@{song}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_song_container"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/playback_toolbar"
|
||||
tools:src="@drawable/ic_album" />
|
||||
|
@ -50,7 +52,6 @@
|
|||
android:id="@+id/playback_song_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/spacing_mid_large"
|
||||
android:layout_marginEnd="@dimen/spacing_mid_large"
|
||||
app:layout_constraintBottom_toTopOf="@+id/playback_artist"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
Loading…
Reference in a new issue