tinymachine
tinymachine copied to clipboard
StateHandler not invoked
StateHandler does not get invoked if defined with primitive datatypes:
@StateHandler(state = STATE_LOCATION_RESOLUTION_REQUIRED)
public void onEventStateLocationResolutionRequired(boolean success, TinyMachine tm) {
// Code does not flow here.
if (success) tm.transitionTo(STATE_BINDING_SERVICE);
else tm.transitionTo(STATE_FAILED_LOCATION_RESOLUTION);
}
...
mTinyMachine.transitionTo(STATE_LOCATION_RESOLUTION_REQUIRED);
mTinyMachine.fireEvent(true);
This is probably not a bug, but I believe it should be mentioned in the docs. Would definitely save someone else the time.
Aside: thank you for this wonderful library! We're using it extensively in our app. :)
Few more features would be great to have:
- Allowed transitions support, meaning to block transitions to new state which are not allowed
- Undo: support undoing last tranisitions