Merge pull request #1693 from gokadzev/md3

Use the latest MDC and improve "MD3" now playing theme UI
This commit is contained in:
Thomas Möller 2024-12-10 16:58:45 +01:00 committed by GitHub
commit fd52f39c4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 23 deletions

View file

@ -186,23 +186,6 @@ fun BottomSheetBehavior<*>.peekHeightAnimate(value: Int): Animator {
}
}
fun MaterialCardView.animateRadius(cornerRadius: Float, pause: Boolean = true) {
ValueAnimator.ofFloat(radius, cornerRadius).apply {
addUpdateListener { radius = animatedValue as Float }
start()
}
ValueAnimator.ofInt(measuredWidth, if (pause) (height * 1.5).toInt() else height).apply {
addUpdateListener {
updateLayoutParams<ViewGroup.LayoutParams> { width = animatedValue as Int }
}
start()
}
}
fun MaterialCardView.animateToCircle() {
animateRadius(measuredHeight / 2F, pause = false)
}
fun View.focusAndShowKeyboard() {
/**
* This is to be called when the window already has focus.

View file

@ -160,10 +160,8 @@ class MD3PlaybackControlsFragment :
private fun updatePlayPauseDrawableState() {
if (MusicPlayerRemote.isPlaying) {
binding.playPauseButton.setImageResource(R.drawable.ic_pause_outline_small)
binding.playPauseCard.animateRadius(40F)
} else {
binding.playPauseButton.setImageResource(R.drawable.ic_play_arrow_outline_small)
binding.playPauseCard.animateToCircle()
}
}

View file

@ -28,8 +28,8 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:maxHeight="2dp"
style="@style/Widget.Retro.Slider"
android:background="@android:color/transparent"
style="@style/Widget.Retro.MD3.Custom.Slider"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toTopOf="parent"

View file

@ -256,9 +256,20 @@
<item name="cornerSize">50%</item>
</style>
<style name="Widget.Retro.Slider" parent="Widget.Material3.Slider">
<style name="Widget.Retro.Slider" parent="Widget.Material3.Slider.Legacy">
<item name="labelBehavior">gone</item>
<item name="thumbRadius">6dp</item>
<item name="haloRadius">18dp</item>
</style>
<style name="Widget.Retro.MD3.Custom.Slider" parent="Widget.Material3.Slider">
<item name="labelBehavior">gone</item>
<item name="thumbHeight">26dp</item>
<item name="thumbWidth">4dp</item>
<item name="thumbTrackGapSize">4dp</item>
<item name="trackHeight">14dp</item>
<item name="thumbElevation">0dp</item>
<item name="background">@android:color/transparent</item>
<item name="haloRadius">0dp</item>
</style>
</resources>

View file

@ -27,7 +27,7 @@ materialIntro = "2.0.0"
mediarouter = "1.6.0"
nanohttpd = "2.3.1"
navigation_version = "2.7.6"
mdc_version = "1.9.0"
mdc_version = "1.12.0"
glide_version = "4.15.1"
orgEclipseEgitGithubCore = "2.1.5"
playServicesCastFramework = "21.3.0"