Update compact controls animation

Make the slide animation on the compact controls look better.
This commit is contained in:
OxygenCobalt
2021-02-18 19:08:49 -07:00
parent bd79951c4e
commit 2f8916117e
6 changed files with 19 additions and 24 deletions
@@ -69,6 +69,11 @@ class MainFragment : Fragment() {
binding.lifecycleOwner = this
// Speed up the slide-in effect on the controls view, solely to improve the UX
// and maybe hide the problem where the main view will snap-shrink before the compact
// view can slide.
(binding.controlsContainer as ViewGroup).layoutTransition.setDuration(150)
binding.navBar.apply {
itemIconTintList = navTints
itemTextColor = navTints
@@ -150,11 +155,11 @@ class MainFragment : Fragment() {
if (song == null) {
logD("Hiding CompactPlaybackFragment since no song is being played.")
binding.compactPlayback.visibility =
if (isLandscape(resources))
View.INVISIBLE
else
View.GONE
binding.compactPlayback.visibility = if (isLandscape(resources)) {
View.INVISIBLE
} else {
View.GONE
}
playbackModel.disableAnimation()
} else {
@@ -1,13 +1,11 @@
package org.oxycblt.auxio.ui
import android.animation.LayoutTransition
import android.content.Context
import android.graphics.Canvas
import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import androidx.interpolator.view.animation.FastOutSlowInInterpolator
import org.oxycblt.auxio.logD
import org.oxycblt.auxio.logE
import java.lang.reflect.Field
@@ -40,12 +38,6 @@ class SlideLinearLayout @JvmOverloads constructor(
private var doDrawingTrick: Boolean = false
init {
// Apply custom interpolation for the slide animations
layoutTransition.apply {
setInterpolator(LayoutTransition.APPEARING, FastOutSlowInInterpolator())
setInterpolator(LayoutTransition.DISAPPEARING, FastOutSlowInInterpolator())
}
if (disappearingChildrenField != null) {
// Create a junk view and add it, which makes all the magic happen [I think].
dumpView = View(context)