File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
vector/src/main/java/im/vector/app/core/animations Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 16
16
17
17
package im.vector.app.core.animations
18
18
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
20
23
import nl.dionsegijn.konfetti.KonfettiView
21
24
import nl.dionsegijn.konfetti.models.Shape
22
25
import nl.dionsegijn.konfetti.models.Size
23
26
24
27
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
+ )
25
38
build()
26
- .addColors(Color . YELLOW , Color . GREEN , Color . MAGENTA )
39
+ .addColors(confettiColors.toColorInt(context) )
27
40
.setDirection(0.0 , 359.0 )
28
41
.setSpeed(2f , 5f )
29
42
.setFadeOutEnabled(true )
@@ -33,3 +46,6 @@ fun KonfettiView.play() {
33
46
.setPosition(- 50f , width + 50f , - 50f , - 50f )
34
47
.streamFor(150 , 3000L )
35
48
}
49
+
50
+ @ColorInt
51
+ private fun List<Int>.toColorInt (context : Context ) = map { ContextCompat .getColor(context, it) }
You can’t perform that action at this time.
0 commit comments