Compare commits

..

No commits in common. "a9494626bbbc5093ce3e2b665ef8f28e1ffcbca4" and "35334c93cc2749411f09c850a7278cd815760aee" have entirely different histories.

4 changed files with 5 additions and 12 deletions

View File

@ -6,7 +6,7 @@ navigation = "2.5.3"
gradlePlugin = "8.0.2" gradlePlugin = "8.0.2"
androidxcore = "1.10.1" androidxcore = "1.10.1"
ktlint = "0.43.2" ktlint = "0.43.2"
ktlintGradle = "11.4.0" ktlintGradle = "11.3.2"
detekt = "1.23.0" detekt = "1.23.0"
preferences = "1.2.0" preferences = "1.2.0"
media3 = "1.0.2" media3 = "1.0.2"

View File

@ -1,6 +1,5 @@
package org.moire.ultrasonic.adapters package org.moire.ultrasonic.adapters
import android.graphics.PorterDuff
import android.view.View import android.view.View
import android.widget.Checkable import android.widget.Checkable
import android.widget.CheckedTextView import android.widget.CheckedTextView
@ -46,7 +45,6 @@ class TrackViewHolder(val view: View) :
var entry: Track? = null var entry: Track? = null
private set private set
var songLayout: LinearLayout = view.findViewById(R.id.song_layout)
var check: CheckedTextView = view.findViewById(R.id.song_check) var check: CheckedTextView = view.findViewById(R.id.song_check)
var drag: ImageView = view.findViewById(R.id.song_drag) var drag: ImageView = view.findViewById(R.id.song_drag)
var observableChecked = MutableLiveData(false) var observableChecked = MutableLiveData(false)
@ -166,22 +164,17 @@ class TrackViewHolder(val view: View) :
ContextCompat.getDrawable(view.context, R.drawable.ic_stat_play)!! ContextCompat.getDrawable(view.context, R.drawable.ic_stat_play)!!
} }
@Suppress("MagicNumber")
private fun setPlayIcon(isPlaying: Boolean) { private fun setPlayIcon(isPlaying: Boolean) {
if (isPlaying && !isPlayingCached) { if (isPlaying && !isPlayingCached) {
isPlayingCached = true isPlayingCached = true
title.setCompoundDrawablesWithIntrinsicBounds( title.setCompoundDrawablesWithIntrinsicBounds(
playingIcon, null, null, null playingIcon, null, null, null
) )
songLayout.backgroundTintMode = PorterDuff.Mode.MULTIPLY
songLayout.elevation = 3F
} else if (!isPlaying && isPlayingCached) { } else if (!isPlaying && isPlayingCached) {
isPlayingCached = false isPlayingCached = false
title.setCompoundDrawablesWithIntrinsicBounds( title.setCompoundDrawablesWithIntrinsicBounds(
0, 0, 0, 0 0, 0, 0, 0
) )
songLayout.backgroundTintMode = PorterDuff.Mode.ADD
songLayout.elevation = 0F
} }
} }

View File

@ -51,6 +51,7 @@ import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_DRAG import androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_DRAG
import androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_IDLE import androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_IDLE
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearSmoothScroller
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
import com.google.android.material.progressindicator.CircularProgressIndicator import com.google.android.material.progressindicator.CircularProgressIndicator
@ -480,7 +481,9 @@ class PlayerFragment :
val index = mediaPlayerManager.currentMediaItemIndex val index = mediaPlayerManager.currentMediaItemIndex
if (index != -1) { if (index != -1) {
viewManager.scrollToPosition(index) val smoothScroller = LinearSmoothScroller(context)
smoothScroller.targetPosition = index
viewManager.startSmoothScroll(smoothScroller)
} }
} }

View File

@ -5,9 +5,6 @@
a:id="@+id/song_layout" a:id="@+id/song_layout"
a:layout_width="fill_parent" a:layout_width="fill_parent"
a:layout_height="?android:attr/listPreferredItemHeight" a:layout_height="?android:attr/listPreferredItemHeight"
a:background="?attr/colorSurface"
a:backgroundTint="?attr/colorPrimaryContainer"
a:backgroundTintMode="add"
a:minHeight="?android:attr/listPreferredItemHeight" a:minHeight="?android:attr/listPreferredItemHeight"
a:orientation="horizontal"> a:orientation="horizontal">