Added animation collapse when navigating to details

This commit is contained in:
Hemanth S 2020-09-22 13:50:43 +05:30
parent e9c1559c57
commit c495c66a38
5 changed files with 42 additions and 22 deletions

View file

@ -14,6 +14,7 @@
package code.name.monkey.retromusic.extensions
import android.animation.ObjectAnimator
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -21,6 +22,7 @@ import android.widget.EditText
import androidx.annotation.LayoutRes
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.TintHelper
import com.google.android.material.bottomsheet.BottomSheetBehavior
@Suppress("UNCHECKED_CAST")
fun <T : View> ViewGroup.inflate(@LayoutRes layout: Int): T {
@ -45,3 +47,21 @@ fun EditText.appHandleColor(): EditText {
TintHelper.colorHandles(this, ThemeStore.accentColor(context))
return this
}
fun View.translateXAnimate(value: Float) {
ObjectAnimator.ofFloat(this, "translationY", value)
.apply {
duration = 300
start()
}
}
fun BottomSheetBehavior<*>.peekHeightAnimate(value: Int) {
ObjectAnimator.ofInt(this, "peekHeight", value)
.apply {
duration = 300
start()
}
}