From 9050c488e4040becffd3cbc690076004b631ffd7 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 27 Jan 2022 09:56:41 +0100 Subject: [PATCH 1/4] 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 a7e347949b0..d26553d689a 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 22764ac5bd9..3192be92517 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 5b8dddba22a..83c5cb76b9a 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"> - - - Date: Tue, 22 Feb 2022 22:31:06 +0100 Subject: [PATCH 2/4] Try with 2.0.2 --- vector/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vector/build.gradle b/vector/build.gradle index d26553d689a..f5e01736012 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -446,7 +446,7 @@ dependencies { implementation 'me.leolin:ShortcutBadger:1.1.22@aar' // Chat effects - implementation 'nl.dionsegijn:konfetti-xml:2.0.1' + implementation 'nl.dionsegijn:konfetti-xml:2.0.2' implementation 'com.github.jetradarmobile:android-snowfall:1.2.1' // DI From 4f27ab263f25a31d8f7f425615b65b92d5e16f0d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 4 Apr 2022 16:08:56 +0200 Subject: [PATCH 3/4] Update parameters --- .../im/vector/app/core/animations/Konfetti.kt | 37 ++++++++----------- 1 file changed, 15 insertions(+), 22 deletions(-) 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 3192be92517..882891810b3 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,8 +20,13 @@ import android.content.Context import androidx.annotation.ColorInt import androidx.core.content.ContextCompat import im.vector.app.R +import nl.dionsegijn.konfetti.core.Angle import nl.dionsegijn.konfetti.core.Party +import nl.dionsegijn.konfetti.core.Position +import nl.dionsegijn.konfetti.core.Spread import nl.dionsegijn.konfetti.core.emitter.Emitter +import nl.dionsegijn.konfetti.core.models.Shape +import nl.dionsegijn.konfetti.core.models.Size import nl.dionsegijn.konfetti.xml.KonfettiView fun KonfettiView.play() { @@ -35,33 +40,21 @@ fun KonfettiView.play() { R.color.palette_prune, R.color.palette_kiwi ) - /* - build() - .addColors(confettiColors.toColorInt(context)) - .setDirection(0.0, 359.0) - .setSpeed(2f, 5f) - .setFadeOutEnabled(true) - .setTimeToLive(2000L) - .addShapes(Shape.Square, Shape.Circle) - .addSizes(Size(12)) - .setPosition(-50f, width + 50f, -50f, -50f) - .streamFor(150, 3000L) - */ - + val emitterConfig = Emitter(2000).perSecond(100) val party = Party( + emitter = emitterConfig, colors = confettiColors.toColorInt(context), - /* - // Keep other default setting for now. - timeToLive = 2000L, - fadeOutEnabled = true, + angle = Angle.Companion.BOTTOM, + spread = Spread.ROUND, + shapes = listOf(Shape.Square, Shape.Circle), + size = listOf(Size(12)), speed = 2f, maxSpeed = 5f, - damping = 0.9f, - spread = 360, - position = Position.Relative(0.5, 0.3), - */ - emitter = Emitter(duration = 100).max(100) + fadeOutEnabled = true, + timeToLive = 2000L, + position = Position.Relative(0.0, 0.0).between(Position.Relative(1.0, 0.0)), ) + reset() start(party) } From 930ce0629bfc0ad3c5032b21e4fd3d8de0000a4a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 6 Apr 2022 09:59:26 +0200 Subject: [PATCH 4/4] Changelog --- changelog.d/5079.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/5079.misc diff --git a/changelog.d/5079.misc b/changelog.d/5079.misc new file mode 100644 index 00000000000..c38bf043ea4 --- /dev/null +++ b/changelog.d/5079.misc @@ -0,0 +1 @@ +Upgrade konfetti lib from 1.3.2 to 2.0.2 \ No newline at end of file