mirror of
https://github.com/cmclark00/RetroMusicPlayer.git
synced 2025-05-19 16:45:20 +01:00
[BottomNavigation] Better animations for BottomNavigationView
This commit is contained in:
parent
e02e99ed02
commit
91a4282581
5 changed files with 27 additions and 38 deletions
|
@ -37,6 +37,7 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
|
|||
import com.google.android.material.imageview.ShapeableImageView
|
||||
import com.google.android.material.shape.ShapeAppearanceModel
|
||||
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun <T : View> ViewGroup.inflate(@LayoutRes layout: Int): T {
|
||||
return LayoutInflater.from(context).inflate(layout, this, false) as T
|
||||
|
@ -67,21 +68,21 @@ fun View.translateYAnimate(value: Float): Animator {
|
|||
.apply {
|
||||
duration = 300
|
||||
doOnStart {
|
||||
if (value == 0f) {
|
||||
show()
|
||||
}
|
||||
show()
|
||||
}
|
||||
doOnEnd {
|
||||
if (value != 0f) {
|
||||
hide()
|
||||
} else {
|
||||
show()
|
||||
}
|
||||
}
|
||||
start()
|
||||
}
|
||||
}
|
||||
|
||||
fun BottomSheetBehavior<*>.peekHeightAnimate(value: Int) {
|
||||
ObjectAnimator.ofInt(this, "peekHeight", value)
|
||||
fun BottomSheetBehavior<*>.peekHeightAnimate(value: Int): Animator {
|
||||
return ObjectAnimator.ofInt(this, "peekHeight", value)
|
||||
.apply {
|
||||
duration = 300
|
||||
start()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue