mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Increase height of boost items to align with subscriptions.
This commit is contained in:
committed by
Cody Henthorne
parent
c5f05f322f
commit
fc145d7367
@@ -1,45 +0,0 @@
|
||||
package org.thoughtcrime.securesms.components.settings.app.subscription.boost
|
||||
|
||||
import android.animation.Animator
|
||||
import android.view.View
|
||||
import com.airbnb.lottie.LottieAnimationView
|
||||
import com.airbnb.lottie.LottieDrawable
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.animation.AnimationCompleteListener
|
||||
import org.thoughtcrime.securesms.components.settings.PreferenceModel
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.LayoutFactory
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingAdapter
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingViewHolder
|
||||
|
||||
/**
|
||||
* A simple mapping model to show a boost animation.
|
||||
*/
|
||||
object BoostAnimation {
|
||||
|
||||
class Model : PreferenceModel<Model>(isEnabled = true) {
|
||||
override fun areItemsTheSame(newItem: Model): Boolean = true
|
||||
}
|
||||
|
||||
class ViewHolder(itemView: View) : MappingViewHolder<Model>(itemView) {
|
||||
|
||||
private val lottie: LottieAnimationView = findViewById(R.id.boost_animation_view)
|
||||
|
||||
override fun bind(model: Model) {
|
||||
lottie.playAnimation()
|
||||
lottie.addAnimatorListener(object : AnimationCompleteListener() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
lottie.removeAnimatorListener(this)
|
||||
lottie.setMinAndMaxFrame(30, 91)
|
||||
lottie.repeatMode = LottieDrawable.RESTART
|
||||
lottie.repeatCount = LottieDrawable.INFINITE
|
||||
lottie.frame = 30
|
||||
lottie.playAnimation()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fun register(adapter: MappingAdapter) {
|
||||
adapter.registerFactory(Model::class.java, LayoutFactory({ ViewHolder(it) }, R.layout.boost_animation_pref))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user