Increase height of boost items to align with subscriptions.
This commit is contained in:
parent
c5f05f322f
commit
fc145d7367
3 changed files with 7 additions and 72 deletions
|
@ -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))
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:viewBindingIgnore="true"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dsl_settings_gutter"
|
||||
android:layout_marginEnd="@dimen/dsl_settings_gutter"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<com.airbnb.lottie.LottieAnimationView
|
||||
android:id="@+id/boost_animation_view"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="96dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
app:lottie_rawRes="@raw/lottie_rocket" />
|
||||
|
||||
</FrameLayout>
|
|
@ -13,7 +13,7 @@
|
|||
android:id="@+id/boost_1"
|
||||
style="@style/Signal.Widget.Button.Large.Secondary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48sp"
|
||||
android:layout_height="58sp"
|
||||
android:textAppearance="@style/Signal.Text.Body"
|
||||
android:textColor="@color/signal_text_primary"
|
||||
app:backgroundTint="@color/signal_selectable_button_background_tint"
|
||||
|
@ -29,7 +29,7 @@
|
|||
android:id="@+id/boost_2"
|
||||
style="@style/Signal.Widget.Button.Large.Secondary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48sp"
|
||||
android:layout_height="58sp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:textAppearance="@style/Signal.Text.Body"
|
||||
|
@ -47,7 +47,7 @@
|
|||
android:id="@+id/boost_3"
|
||||
style="@style/Signal.Widget.Button.Large.Secondary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48sp"
|
||||
android:layout_height="58sp"
|
||||
android:textAppearance="@style/Signal.Text.Body"
|
||||
android:textColor="@color/signal_text_primary"
|
||||
app:backgroundTint="@color/signal_selectable_button_background_tint"
|
||||
|
@ -63,7 +63,7 @@
|
|||
android:id="@+id/boost_4"
|
||||
style="@style/Signal.Widget.Button.Large.Secondary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48sp"
|
||||
android:layout_height="58sp"
|
||||
android:layout_marginTop="19dp"
|
||||
android:textAppearance="@style/Signal.Text.Body"
|
||||
android:textColor="@color/signal_text_primary"
|
||||
|
@ -80,7 +80,7 @@
|
|||
android:id="@+id/boost_5"
|
||||
style="@style/Signal.Widget.Button.Large.Secondary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48sp"
|
||||
android:layout_height="58sp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="19dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
|
@ -99,7 +99,7 @@
|
|||
android:id="@+id/boost_6"
|
||||
style="@style/Signal.Widget.Button.Large.Secondary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48sp"
|
||||
android:layout_height="58sp"
|
||||
android:layout_marginTop="19dp"
|
||||
android:gravity="center"
|
||||
android:textAppearance="@style/Signal.Text.Body"
|
||||
|
@ -116,7 +116,7 @@
|
|||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/boost_custom"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48sp"
|
||||
android:layout_height="58sp"
|
||||
android:layout_marginTop="19dp"
|
||||
android:background="@drawable/custom_donation_amount_background"
|
||||
android:gravity="center"
|
||||
|
|
Loading…
Add table
Reference in a new issue