luiisca / floaty

Apache License 2.0
0 stars 0 forks source link

copy floating bubble library code and make sense of how they render Composables #21

Closed luiisca closed 1 week ago

luiisca commented 1 week ago

Discovered this library that could simplify implementation a lot. I prefer having more control over it, so I'll just clone it in my project instead of installing it

linear[bot] commented 1 week ago

LUI-389 copy floating bubble library code and make sense of it's general architecture

luiisca commented 1 week ago

realized they are implementing recomposition in the floating Composable view, because apparentely jsut like LifecycleOwner is not really implemented by default.

luiisca commented 1 week ago

well that was wrong. recomposition works by default, the reason why it didn't was because the service wasn't calling:

    fun onStart() {
        lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_START)
    }

. Now I don't know why they added this then:

    fun onCreate() {
        savedStateRegistryController.performRestore(null)
        lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE)

        runRecomposeScope?.cancel()
        runRecomposeScope = CoroutineScope(coroutineContext!!)
        recomposer = Recomposer(coroutineContext!!)
        this._view?.compositionContext = recomposer

        runRecomposeScope!!.launch {
            recomposer!!.runRecomposeAndApplyChanges()
        }
    }

But it's okay. no need to have perfect understanding