mirror of
https://github.com/mihonapp/mihon.git
synced 2024-10-31 21:20:59 -04:00
78689e7443
* Migrate to AndroidX (automatic conversion by Android Studio) * AndroidX dependency code updates * Fix source preference reparenting * fixes the androidx prefererences icon spacing issue (cherry picked from commit b76a15d960ec2cdf771be16377db0348b66b3179) * Fix source preference screen heading size/list padding Co-authored-by: Carlos <cargo8005@gmail.com>
51 lines
1.7 KiB
Kotlin
51 lines
1.7 KiB
Kotlin
package eu.kanade.tachiyomi.widget
|
|
|
|
import android.content.Context
|
|
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
|
import androidx.interpolator.view.animation.FastOutSlowInInterpolator
|
|
import android.util.AttributeSet
|
|
import android.view.View
|
|
import android.view.animation.Animation
|
|
import android.view.animation.AnimationUtils
|
|
import eu.kanade.tachiyomi.R
|
|
|
|
@Suppress("unused", "UNUSED_PARAMETER")
|
|
class FABAnimationUpDown @JvmOverloads constructor(ctx: Context, attrs: AttributeSet? = null) : FABAnimationBase() {
|
|
|
|
private val INTERPOLATOR = FastOutSlowInInterpolator()
|
|
|
|
private val outAnimation by lazy {
|
|
AnimationUtils.loadAnimation(ctx, R.anim.fab_hide_to_bottom).apply {
|
|
duration = 200
|
|
interpolator = INTERPOLATOR
|
|
}
|
|
}
|
|
private val inAnimation by lazy {
|
|
AnimationUtils.loadAnimation(ctx, R.anim.fab_show_from_bottom).apply {
|
|
duration = 200
|
|
interpolator = INTERPOLATOR
|
|
}
|
|
}
|
|
|
|
override fun animateOut(button: FloatingActionButton) {
|
|
outAnimation.setAnimationListener(object : Animation.AnimationListener {
|
|
override fun onAnimationStart(animation: Animation) {
|
|
isAnimatingOut = true
|
|
}
|
|
|
|
override fun onAnimationEnd(animation: Animation) {
|
|
isAnimatingOut = false
|
|
button.visibility = View.INVISIBLE
|
|
}
|
|
|
|
override fun onAnimationRepeat(animation: Animation) {
|
|
}
|
|
})
|
|
button.startAnimation(outAnimation)
|
|
}
|
|
|
|
override fun animateIn(button: FloatingActionButton) {
|
|
button.visibility = View.VISIBLE
|
|
button.startAnimation(inAnimation)
|
|
}
|
|
}
|