You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've read Guide to UI programming with coroutines. Event conflation. But unfortunately didn't catch one moment. For example I have switching button (with 3 or more states), which starts some "long" task depending on button state. Button should change state quickly on every click, but task (as it can't switch so fast) should switch only to most recent state from eventActor. So how to realize it? Should I keep two actors in fun Node.onClick>: one for UI (with capacity = default) and another for processing (with capacity = Channel.CONFLATED). Or it can be done other way?
The text was updated successfully, but these errors were encountered:
I don't think that you need an actor to keep track of a synchronous updates that should happen in your application. Actors are designed to help you manage your asynchronous jobs. If you have a switching button with 3 states then you should directly change its state on every click without adding a layer of indirection via actor. You should use an actor to launch whatever asynchronous job you need to be tied to those synchronous changes in state.
Thank you for answer. I used button to check technology. Actual use is RecyclerView filled by query from database. Tap on item of RecyclerView update field of record in database (UI state) forcing to refresh RecyclerView item state. At the same time this tap on RecyclerView item should try to change long time task.
I've read Guide to UI programming with coroutines. Event conflation. But unfortunately didn't catch one moment. For example I have switching button (with 3 or more states), which starts some "long" task depending on button state. Button should change state quickly on every click, but task (as it can't switch so fast) should switch only to most recent state from eventActor. So how to realize it? Should I keep two actors in fun Node.onClick>: one for UI (with capacity = default) and another for processing (with capacity = Channel.CONFLATED). Or it can be done other way?
The text was updated successfully, but these errors were encountered: