[Android] Fix IllegalStateException

Nicolas Pomepuy git at videolan.org
Fri Jul 31 12:59:19 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Jul 31 12:44:34 2020 +0200| [dd1573b4ac94026924f84ffaab1f3cdff32398e3] | committer: Nicolas Pomepuy

Fix IllegalStateException

> https://code.videolan.org/videolan/vlc-android/commit/dd1573b4ac94026924f84ffaab1f3cdff32398e3
---

 .../videolan/vlc/gui/dialogs/VLCBillingDialog.kt   | 24 ++++++++++++----------
 1 file changed, 13 insertions(+), 11 deletions(-)

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 0be1febc3..cfba25f3f 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
@@ -208,17 +208,19 @@ class VLCBillingDialog : VLCBottomSheetDialogFragment() {
                             size = 10
                         }
                     }
-                    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)
-                            .setSpeed(1f, 9f)
-                            .setFadeOutEnabled(true)
-                            .setTimeToLive(2000L)
-                            .addShapes(Shape.Circle)
-                            .addSizes(Size(size))
-                            .setPosition(x, y)
-                            .setRotationEnabled(false)
-                            .burst(50)
+                    activity?.let {
+                        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)
+                                .setSpeed(1f, 9f)
+                                .setFadeOutEnabled(true)
+                                .setTimeToLive(2000L)
+                                .addShapes(Shape.Circle)
+                                .addSizes(Size(size))
+                                .setPosition(x, y)
+                                .setRotationEnabled(false)
+                                .burst(50)
+                    }
                     if (currentIndex > 1) currentIndex = 0 else currentIndex++
                     fireworksHandler.postDelayed(this, 1500)
                 }



More information about the Android mailing list