Skip to content

Commit 0225565

Browse files
committed
updating all confetti usages to use design palette colours
1 parent 6c812a1 commit 0225565

File tree

1 file changed

+18
-2
lines changed
  • vector/src/main/java/im/vector/app/core/animations

1 file changed

+18
-2
lines changed

vector/src/main/java/im/vector/app/core/animations/Konfetti.kt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,27 @@
1616

1717
package im.vector.app.core.animations
1818

19-
import android.graphics.Color
19+
import android.content.Context
20+
import androidx.annotation.ColorInt
21+
import androidx.core.content.ContextCompat
22+
import im.vector.app.R
2023
import nl.dionsegijn.konfetti.KonfettiView
2124
import nl.dionsegijn.konfetti.models.Shape
2225
import nl.dionsegijn.konfetti.models.Size
2326

2427
fun KonfettiView.play() {
28+
val confettiColors = listOf(
29+
R.color.palette_azure,
30+
R.color.palette_grape,
31+
R.color.palette_verde,
32+
R.color.palette_polly,
33+
R.color.palette_melon,
34+
R.color.palette_aqua,
35+
R.color.palette_prune,
36+
R.color.palette_kiwi
37+
)
2538
build()
26-
.addColors(Color.YELLOW, Color.GREEN, Color.MAGENTA)
39+
.addColors(confettiColors.toColorInt(context))
2740
.setDirection(0.0, 359.0)
2841
.setSpeed(2f, 5f)
2942
.setFadeOutEnabled(true)
@@ -33,3 +46,6 @@ fun KonfettiView.play() {
3346
.setPosition(-50f, width + 50f, -50f, -50f)
3447
.streamFor(150, 3000L)
3548
}
49+
50+
@ColorInt
51+
private fun List<Int>.toColorInt(context: Context) = map { ContextCompat.getColor(context, it) }

0 commit comments

Comments
 (0)