[Android] Proper management of activity lifecycle for the sponsorship animation
Nicolas Pomepuy
git at videolan.org
Mon Aug 3 13:02:25 CEST 2020
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Jul 31 14:49:51 2020 +0200| [f192c77ec06a79ebfbf80228769999f6f089b5a9] | committer: Nicolas Pomepuy
Proper management of activity lifecycle for the sponsorship animation
> https://code.videolan.org/videolan/vlc-android/commit/f192c77ec06a79ebfbf80228769999f6f089b5a9
---
.../vlc-android/src/org/videolan/vlc/gui/dialogs/VLCBillingDialog.kt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/VLCBillingDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/VLCBillingDialog.kt
index cfba25f3f..32096512c 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/VLCBillingDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/VLCBillingDialog.kt
@@ -34,7 +34,9 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
+import androidx.lifecycle.lifecycleScope
import com.google.android.material.bottomsheet.BottomSheetBehavior
+import kotlinx.coroutines.coroutineScope
import nl.dionsegijn.konfetti.models.Shape
import nl.dionsegijn.konfetti.models.Size
import org.videolan.tools.*
@@ -208,7 +210,7 @@ class VLCBillingDialog : VLCBottomSheetDialogFragment() {
size = 10
}
}
- activity?.let {
+ lifecycleScope.launchWhenStarted {
binding.konfetti.build()
.addColors(ContextCompat.getColor(requireActivity(), R.color.orange100),ContextCompat.getColor(requireActivity(), R.color.orange500),ContextCompat.getColor(requireActivity(), R.color.orange900))
.setDirection(0.0, 359.0)
More information about the Android
mailing list