lukaspili / Mortar-architect

[DISCONTINUED] Navigation stack for Mortar. Alternative to Flow. Focuses on Mortar scopes, simplicity, seamless integration and killing boilerplate code.
MIT License
164 stars 12 forks source link

Execute setSupportActionBar(toolbar) from a View #15

Open jjvargas opened 9 years ago

jjvargas commented 9 years ago

I can't seem to find how to get a reference from the Main Activity from a View, something like getActivity(). I would like to execute setSupportActionBar(toolbar) from the view.

0xjohnnycagewins commented 9 years ago

check issue #6 to know how to access the Activity's methods from a presenter/view

jjvargas commented 9 years ago

I have read this but I am able to make it work, it would be nice if someone can integrate an example on the sample app. Cheers.

lukaspili commented 9 years ago

I'll write an example when 0.2 is out.

But in practice, in my own experience, you don't need to call setSupportActionBar(toolbar) from a view. The toolbar contains all the methods to setup a title, a menu, etc on itself without the need of the container activity.

jjvargas commented 9 years ago

So I have the main toolbar from the activity but some of my views have a custom Toolbar , so I hide the main toolbar and show the custom toolbar, but the main toolbar has items that need to be in the custom toolbar thats why I need to setSupportActionBar(customToolbar).

What I am doing right now is just to have an event that is received in the MainActivity and switches accordingly.