Improve current playing song visibility

Disable scroll animation because not visible and causing bugs on first interaction
This commit is contained in:
Maxence G 2023-06-04 22:51:44 +02:00
parent 03d06896e9
commit dc9b261c48
No known key found for this signature in database
GPG Key ID: DC1FD9409E3FE284
3 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,6 @@
package org.moire.ultrasonic.adapters
import android.graphics.PorterDuff
import android.view.View
import android.widget.Checkable
import android.widget.CheckedTextView
@ -45,6 +46,7 @@ class TrackViewHolder(val view: View) :
var entry: Track? = null
private set
var songLayout: LinearLayout = view.findViewById(R.id.song_layout)
var check: CheckedTextView = view.findViewById(R.id.song_check)
var drag: ImageView = view.findViewById(R.id.song_drag)
var observableChecked = MutableLiveData(false)
@ -170,11 +172,13 @@ class TrackViewHolder(val view: View) :
title.setCompoundDrawablesWithIntrinsicBounds(
playingIcon, null, null, null
)
songLayout.backgroundTintMode = PorterDuff.Mode.ADD
} else if (!isPlaying && isPlayingCached) {
isPlayingCached = false
title.setCompoundDrawablesWithIntrinsicBounds(
0, 0, 0, 0
)
songLayout.backgroundTintMode = PorterDuff.Mode.MULTIPLY
}
}

View File

@ -481,9 +481,7 @@ class PlayerFragment :
val index = mediaPlayerManager.currentMediaItemIndex
if (index != -1) {
val smoothScroller = LinearSmoothScroller(context)
smoothScroller.targetPosition = index
viewManager.startSmoothScroll(smoothScroller)
viewManager.scrollToPosition(index)
}
}

View File

@ -5,6 +5,9 @@
a:id="@+id/song_layout"
a:layout_width="fill_parent"
a:layout_height="?android:attr/listPreferredItemHeight"
a:background="#00000000"
a:backgroundTint="@color/material_on_surface_stroke"
a:backgroundTintMode="multiply"
a:minHeight="?android:attr/listPreferredItemHeight"
a:orientation="horizontal">