updating all confetti usages to use design palette colours
This commit is contained in:
parent
9575cb5de7
commit
8d0435db77
|
@ -16,14 +16,27 @@
|
||||||
|
|
||||||
package im.vector.app.core.animations
|
package im.vector.app.core.animations
|
||||||
|
|
||||||
import android.graphics.Color
|
import android.content.Context
|
||||||
|
import androidx.annotation.ColorInt
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import im.vector.app.R
|
||||||
import nl.dionsegijn.konfetti.KonfettiView
|
import nl.dionsegijn.konfetti.KonfettiView
|
||||||
import nl.dionsegijn.konfetti.models.Shape
|
import nl.dionsegijn.konfetti.models.Shape
|
||||||
import nl.dionsegijn.konfetti.models.Size
|
import nl.dionsegijn.konfetti.models.Size
|
||||||
|
|
||||||
fun KonfettiView.play() {
|
fun KonfettiView.play() {
|
||||||
|
val confettiColors = listOf(
|
||||||
|
R.color.palette_azure,
|
||||||
|
R.color.palette_grape,
|
||||||
|
R.color.palette_verde,
|
||||||
|
R.color.palette_polly,
|
||||||
|
R.color.palette_melon,
|
||||||
|
R.color.palette_aqua,
|
||||||
|
R.color.palette_prune,
|
||||||
|
R.color.palette_kiwi
|
||||||
|
)
|
||||||
build()
|
build()
|
||||||
.addColors(Color.YELLOW, Color.GREEN, Color.MAGENTA)
|
.addColors(confettiColors.toColorInt(context))
|
||||||
.setDirection(0.0, 359.0)
|
.setDirection(0.0, 359.0)
|
||||||
.setSpeed(2f, 5f)
|
.setSpeed(2f, 5f)
|
||||||
.setFadeOutEnabled(true)
|
.setFadeOutEnabled(true)
|
||||||
|
@ -33,3 +46,6 @@ fun KonfettiView.play() {
|
||||||
.setPosition(-50f, width + 50f, -50f, -50f)
|
.setPosition(-50f, width + 50f, -50f, -50f)
|
||||||
.streamFor(150, 3000L)
|
.streamFor(150, 3000L)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ColorInt
|
||||||
|
private fun List<Int>.toColorInt(context: Context) = map { ContextCompat.getColor(context, it) }
|
||||||
|
|
Loading…
Reference in New Issue