Hi, Arkadii, can you provide an example with creat...
# mvikotlin
a
Hi, Arkadii, can you provide an example with creating custom lifecycle from essenty lib?
a
Hello. Could you please elaborate what is "custom lifecycle"? Do you need to manually control the lifecycle?
a
I want to start my own lifecycle with special event and end it with another one event
a
In MVIKotlin the binder works in another way, it accepts the Lifecycle from the Essenty library directly.
a
So, that means that I can't create it by my own?
a
Probably I don't understand the use case. I'm not aware of such an example, but it should be relatively easy. If I understand correctly, you will need to implement the MVICore Lifecycle interface, and pass Essenty's Lifecycle via constructor. Then inside the subscribe method you have to subscribe/unsubscribe from the Essenty Lifecycle.
a
Nope. Sorry for not being clear enough I want to catch a specific event that will start my essenty lifecycle. Then, when I catch another event, I will end my Essenty lifecycle. As an example, I want to display a specific dialog when the lifecycle starts and hide the dialog when the lifecycle ends. the MVICore reference was just to explain what I want: start and end lifecycle
a
Thanks for the clarification, now it is more clear. Do you have a source of the events already?
a
Yes, I do
a
Alright. Then I still don't have any examples. But you should try LifecycleRegistry. Then you can subscribe to the source of events and call lifecycle.resume() and lifecycle.destroy() accordingly.
LifecycleRegistry implements Lifecycle
a
Oh, thanks. I think that it will be great to mention this moment in documentation
a
a
I have looked at documentation for MVIKotlin. thanks again
👍 1