GCX-HCI / ThirtyInch

a MVP library for Android favoring a stateful Presenter
Apache License 2.0
1.03k stars 101 forks source link

Add sendToPresenter(p -> {}) analog to sendToView(v -> {}) #70

Closed passsy closed 7 years ago

passsy commented 7 years ago

Like sendToView(v -> {}) the new sendToPresenter(p -> {}) is very useful for permissions and activity results. It can be used in callback methods with can be called before #onCreate(Bundle)


    @Override
    protected void onActivityResult(final int requestCode, final int resultCode,
            final Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        sendToPresenter(presenter -> presenter.onResultReceived());
    }

issues #30

I also created an interface PresenterAccessor bundling getPresenter() and sendToPresenter { }. Now all methods in Activities and Fragment implementations use @Override everywhere. And we don't miss something

passsy commented 7 years ago

My fault. onActivityResult is always called after onCreate this PR doesn't make any sense.

Anyways, this PresenterAccessor interface was a good idea, I'll extract this part