luiisca / floating-views

Kotlin library for effortlessly creating customizable floating UI elements in Android apps.
https://central.sonatype.com/artifact/io.github.luiisca/floating.views
MIT License
8 stars 1 forks source link

fix: close view fails to render sometimes #76

Closed luiisca closed 3 months ago

linear[bot] commented 3 months ago

GIT-436 fix: close view fails to render when ...

luiisca commented 3 months ago

it was a bit tricky to find the root cause, but it seems like it was b/c isCloseVisible was set to true in a launched effect before isCloseMounted causing the conditional to add the close view to fail.

luiisca commented 3 months ago

I added an extra check in that LE so it wouldn't set isCLoseVisible to true unless isCloseMOunted was true as well.

            LaunchedEffect(key1 = closeAnimatedX, key2 = closeAnimatedY) {
              if (isCloseMounted) {
                windowManager.updateViewLayout(closeView, closeLayoutParams.apply {
                  x = closeAnimatedX
                  y = closeAnimatedY
                })
                closeView.visibility = View.VISIBLE
                isCloseVisible = true
              }
            }