We often use yours lib for some async operations and after that we inform user about status operation. So almost every time we write something like:
Task.callInBackground(() -> {
// do something extra heavy
return someReturnObject;
})
.onSuccess(new Continuation<SomeReturnObject, Void>() {
@Override
public Void then(Task<SomeReturnObject> task) throws Exception {
Toast.makeText(context, task.getResult().getSomethingNicely(), Toast.LENGTH_SHORT).show();
return null;
}
}, Task.UI_THREAD_EXECUTOR);
As many people we're lazy, forgetful and will be in ecstasy if we can write this in simpler form:
...
.onSuccessInUi(new Continuation<SomeReturnObject, Void>() {
@Override
public Void then(Task<SomeReturnObject> task) throws Exception {
Toast.makeText(context, task.getResult().getSomethingNicely(), Toast.LENGTH_SHORT).show();
return null;
}
});
Any thoughts about this idea? 😉