Update compact controls animation
Make the slide animation on the compact controls look better.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".MainFragment">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/main_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -17,6 +17,7 @@
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
app:layout_constraintBottom_toTopOf="@+id/controls_container"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navGraph="@navigation/nav_explore"
|
||||
@@ -53,5 +54,5 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".MainFragment">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/main_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -17,8 +17,7 @@
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/controls_container"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_weight="1"
|
||||
app:navGraph="@navigation/nav_explore"
|
||||
tools:layout="@layout/fragment_library" />
|
||||
|
||||
@@ -37,7 +36,6 @@
|
||||
android:name="org.oxycblt.auxio.playback.CompactPlaybackFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toTopOf="@+id/nav_bar"
|
||||
tools:layout="@layout/fragment_compact_playback" />
|
||||
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
@@ -48,9 +46,8 @@
|
||||
android:background="@color/background"
|
||||
android:elevation="0dp"
|
||||
app:elevation="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:menu="@menu/menu_nav" />
|
||||
|
||||
</org.oxycblt.auxio.ui.SlideLinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
Reference in New Issue
Block a user