Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question regarding onDestroyView() #199

Closed
david-perez opened this issue Aug 30, 2016 · 5 comments
Closed

Question regarding onDestroyView() #199

david-perez opened this issue Aug 30, 2016 · 5 comments

Comments

@david-perez
Copy link

@Override
    public void onDestroyView() {
        itemsPresenter.unbindView(this);

        if (unbinder != null) {
            unbinder.unbind();
        }

        super.onDestroyView();
    }

Excerpt from here.

AS code inspection warns that if (unbinder != null) condition is always true. As the unbinder is tied to the activity/fragment lifecycle, and we don't modify the unbinder anywhere, I don't see how it may become null.

Also, we need to unbind the view from the presenter every time onDestroyView()/onDestroy() is called on activities/fragments. Couldn't we hold a reference to a generic Presenter in BaseActivity/BaseFragment to call super() and avoid having to write this method every single time?

@vanniktech
Copy link
Contributor

AFAIK Findbugs complained about this one line and I just added that null check.

@david-perez
Copy link
Author

Any comments about the second part of my question?

@artem-zinnatullin
Copy link
Owner

Second part: yes you can do it in base classes, but personally I just don't
like such inheritance behavior, it makes code implicit.

Also, for example at the moment I use MVVM at work and our app has old
parts in MVP and new in MVVM, since our base classes does not know about
MVP or MVVM we don't have problems with using two different design patterns
in one project :)

On 31 Aug 2016 10:57 am, "david-perez" [email protected] wrote:

Any comments about the second part of my question?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#199 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA7B3O69aasszC4PO0s_bkxeiItiEhq4ks5qlTP7gaJpZM4JxEHv
.

@david-perez
Copy link
Author

I would very much be interested in seeing a rewrite of QualityMatters using MVVM + RxUi (#195, #42).

@artem-zinnatullin
Copy link
Owner

Yeah, me too! Planned to do after vacation

On 1 Sep 2016 1:21 am, "david-perez" [email protected] wrote:

Closed #199
#199.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#199 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA7B3Iv6zytjpxbvbNFqgCttH0aqRT4vks5qlgyBgaJpZM4JxEHv
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants