From 9050c488e4040becffd3cbc690076004b631ffd7 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 27 Jan 2022 09:56:41 +0100 Subject: [PATCH] konfetti 2.0.1 Does not compile --- vector/build.gradle | 3 ++- .../im/vector/app/core/animations/Konfetti.kt | 24 ++++++++++++++++--- .../layout/fragment_ftue_account_created.xml | 2 +- ...fragment_ftue_personalization_complete.xml | 2 +- .../src/main/res/layout/fragment_timeline.xml | 2 +- 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/vector/build.gradle b/vector/build.gradle index a7e347949b..d26553d689 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -446,7 +446,8 @@ dependencies { implementation 'me.leolin:ShortcutBadger:1.1.22@aar' // Chat effects - implementation 'nl.dionsegijn:konfetti:1.3.2' + implementation 'nl.dionsegijn:konfetti-xml:2.0.1' + implementation 'com.github.jetradarmobile:android-snowfall:1.2.1' // DI implementation libs.dagger.hilt diff --git a/vector/src/main/java/im/vector/app/core/animations/Konfetti.kt b/vector/src/main/java/im/vector/app/core/animations/Konfetti.kt index 22764ac5bd..3192be9251 100644 --- a/vector/src/main/java/im/vector/app/core/animations/Konfetti.kt +++ b/vector/src/main/java/im/vector/app/core/animations/Konfetti.kt @@ -20,9 +20,9 @@ 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.models.Shape -import nl.dionsegijn.konfetti.models.Size +import nl.dionsegijn.konfetti.core.Party +import nl.dionsegijn.konfetti.core.emitter.Emitter +import nl.dionsegijn.konfetti.xml.KonfettiView fun KonfettiView.play() { val confettiColors = listOf( @@ -35,6 +35,7 @@ fun KonfettiView.play() { R.color.palette_prune, R.color.palette_kiwi ) + /* build() .addColors(confettiColors.toColorInt(context)) .setDirection(0.0, 359.0) @@ -45,6 +46,23 @@ fun KonfettiView.play() { .addSizes(Size(12)) .setPosition(-50f, width + 50f, -50f, -50f) .streamFor(150, 3000L) + */ + + val party = Party( + colors = confettiColors.toColorInt(context), + /* + // Keep other default setting for now. + timeToLive = 2000L, + fadeOutEnabled = true, + speed = 2f, + maxSpeed = 5f, + damping = 0.9f, + spread = 360, + position = Position.Relative(0.5, 0.3), + */ + emitter = Emitter(duration = 100).max(100) + ) + start(party) } @ColorInt diff --git a/vector/src/main/res/layout/fragment_ftue_account_created.xml b/vector/src/main/res/layout/fragment_ftue_account_created.xml index 5b8dddba22..83c5cb76b9 100644 --- a/vector/src/main/res/layout/fragment_ftue_account_created.xml +++ b/vector/src/main/res/layout/fragment_ftue_account_created.xml @@ -6,7 +6,7 @@ android:layout_height="match_parent" android:background="?colorSecondary"> - - -