Skip to content
This repository has been archived by the owner on Jan 9, 2020. It is now read-only.

Allowing to implement RosiePresenter.View interfaces in base Fragments or Activity classes #90

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

felHR85
Copy link

@felHR85 felHR85 commented Jun 17, 2017

Hello guys! First of all thank you very much for Rosie. It has been very helpful in the project We are working on.

I tried to implement my View interface in a Base Fragment class and I realized that was not possible because in RosiePresenter.class getViewInterfaceClass method was not looking for interfaces in any available super classes. I added a method that is called inside getViewInterfaceClass for seeking any RosiePresenter.View interfaces in any super class available if there is no RosiePresenter.View interfaces in the current class.

PS: I ran the tests but I got this error while testing the app sample:
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: (with id: com.karumi.rosie.sample:id/snackbar_text and with text...

Thank you!

Copy link
Contributor

@pedrovgs pedrovgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @felHR85! First of all, thank you so much for your contribution :) I have two major comments about this change and a question.

  1. Instead of having a new method to get the interfaces to the super class, why don't we append the array of interfaces to the already created interfaces array.

  2. I'd like to cover this new behavior with a unit test before merging this PR. Could you add it?

My question about this implementation is related to big hierarchies. What if the class has three super classes? Could we implement this to support a deeper dependency tree?

@felHR85
Copy link
Author

felHR85 commented Jun 25, 2017

Both comments are OK for me. I will proceed to add the unit test and simplify the method
About your question about big hierarchies: getViewInterfaceSuperClass is a recursive call so it should look for the first instance of RosiePresenter.View in all available super classes.

@pedrovgs
Copy link
Contributor

Great @felHR85. Just let me know once the code is ready to be reviewed again! Thanks 😃

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

Successfully merging this pull request may close these issues.

None yet

2 participants