parent
3b8ffcf8a9
commit
9050c488e4
|
@ -446,7 +446,8 @@ dependencies {
|
||||||
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
|
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
|
||||||
|
|
||||||
// Chat effects
|
// 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'
|
implementation 'com.github.jetradarmobile:android-snowfall:1.2.1'
|
||||||
// DI
|
// DI
|
||||||
implementation libs.dagger.hilt
|
implementation libs.dagger.hilt
|
||||||
|
|
|
@ -20,9 +20,9 @@ import android.content.Context
|
||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import nl.dionsegijn.konfetti.KonfettiView
|
import nl.dionsegijn.konfetti.core.Party
|
||||||
import nl.dionsegijn.konfetti.models.Shape
|
import nl.dionsegijn.konfetti.core.emitter.Emitter
|
||||||
import nl.dionsegijn.konfetti.models.Size
|
import nl.dionsegijn.konfetti.xml.KonfettiView
|
||||||
|
|
||||||
fun KonfettiView.play() {
|
fun KonfettiView.play() {
|
||||||
val confettiColors = listOf(
|
val confettiColors = listOf(
|
||||||
|
@ -35,6 +35,7 @@ fun KonfettiView.play() {
|
||||||
R.color.palette_prune,
|
R.color.palette_prune,
|
||||||
R.color.palette_kiwi
|
R.color.palette_kiwi
|
||||||
)
|
)
|
||||||
|
/*
|
||||||
build()
|
build()
|
||||||
.addColors(confettiColors.toColorInt(context))
|
.addColors(confettiColors.toColorInt(context))
|
||||||
.setDirection(0.0, 359.0)
|
.setDirection(0.0, 359.0)
|
||||||
|
@ -45,6 +46,23 @@ fun KonfettiView.play() {
|
||||||
.addSizes(Size(12))
|
.addSizes(Size(12))
|
||||||
.setPosition(-50f, width + 50f, -50f, -50f)
|
.setPosition(-50f, width + 50f, -50f, -50f)
|
||||||
.streamFor(150, 3000L)
|
.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
|
@ColorInt
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?colorSecondary">
|
android:background="?colorSecondary">
|
||||||
|
|
||||||
<nl.dionsegijn.konfetti.KonfettiView
|
<nl.dionsegijn.konfetti.xml.KonfettiView
|
||||||
android:id="@+id/viewKonfetti"
|
android:id="@+id/viewKonfetti"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<nl.dionsegijn.konfetti.KonfettiView
|
<nl.dionsegijn.konfetti.xml.KonfettiView
|
||||||
android:id="@+id/viewKonfetti"
|
android:id="@+id/viewKonfetti"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
|
@ -188,7 +188,7 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:tint="@android:color/black" />
|
app:tint="@android:color/black" />
|
||||||
|
|
||||||
<nl.dionsegijn.konfetti.KonfettiView
|
<nl.dionsegijn.konfetti.xml.KonfettiView
|
||||||
android:id="@+id/viewKonfetti"
|
android:id="@+id/viewKonfetti"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
Loading…
Reference in New Issue