Compare commits

...

6 Commits

Author SHA1 Message Date
birdbird
a9494626bb Merge branch 'ImprovePlaylistView' into 'develop'
Improve current playing song visibility

See merge request ultrasonic/ultrasonic!1037
2023-06-06 19:20:11 +00:00
tzugen
ec852b0e74
Use elevation 2023-06-06 21:12:44 +02:00
birdbird
1fe13e84ce Merge branch 'renovate/ktlintgradle' into 'develop'
Update dependency org.jlleitschuh.gradle:ktlint-gradle to v11.4.0

See merge request ultrasonic/ultrasonic!1040
2023-06-06 15:30:48 +00:00
Renovate Bot
d8cb11808c Update dependency org.jlleitschuh.gradle:ktlint-gradle to v11.4.0 2023-06-06 14:31:51 +00:00
Maxence G
63296829a8
Lint 2023-06-04 23:00:09 +02:00
Maxence G
dc9b261c48
Improve current playing song visibility
Disable scroll animation because not visible and causing bugs on first interaction
2023-06-04 22:51:44 +02:00
4 changed files with 12 additions and 5 deletions

View File

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

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)
@ -164,17 +166,22 @@ class TrackViewHolder(val view: View) :
ContextCompat.getDrawable(view.context, R.drawable.ic_stat_play)!!
}
@Suppress("MagicNumber")
private fun setPlayIcon(isPlaying: Boolean) {
if (isPlaying && !isPlayingCached) {
isPlayingCached = true
title.setCompoundDrawablesWithIntrinsicBounds(
playingIcon, null, null, null
)
songLayout.backgroundTintMode = PorterDuff.Mode.MULTIPLY
songLayout.elevation = 3F
} else if (!isPlaying && isPlayingCached) {
isPlayingCached = false
title.setCompoundDrawablesWithIntrinsicBounds(
0, 0, 0, 0
)
songLayout.backgroundTintMode = PorterDuff.Mode.ADD
songLayout.elevation = 0F
}
}

View File

@ -51,7 +51,6 @@ import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_DRAG
import androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_IDLE
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearSmoothScroller
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.button.MaterialButton
import com.google.android.material.progressindicator.CircularProgressIndicator
@ -481,9 +480,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="?attr/colorSurface"
a:backgroundTint="?attr/colorPrimaryContainer"
a:backgroundTintMode="add"
a:minHeight="?android:attr/listPreferredItemHeight"
a:orientation="horizontal">