terrakok / Cicerone

🚦 Cicerone is a lightweight library that makes the navigation in an Android app easy.
Other
2.58k stars 218 forks source link

Add lifecycle aware navigation holder #93

Closed OlegSheliakin closed 4 years ago

OlegSheliakin commented 6 years ago

Hi everyone! I have an idea to add lifecycle components to Cicerone.

For now, we need to set and remove navigator in lifecycle methods of activity/fragment. For example

   @Override
    protected void onResume() {
        super.onResume();
        navigatorHolder.setNavigator(navigator);
    }

    @Override
    protected void onPause() {
        navigatorHolder.removeNavigator();
        super.onPause();
    }

I think, it would be interesting to have lifecycle aware NavigatorHolder.

Here you will find my sample: LifeCycleAwareNavigatorHolder

jumpstreet13 commented 6 years ago

Hi, that is great idea, in my opinion. It will reduce some boilerplate code.

terrakok commented 5 years ago

I think that is good idea but not for main library. Special module maybe?
As I see, it's one simple class :) Everyone can copy it to himself project

victorlapin commented 5 years ago

@OlegSheliakin many thanks for the sample, nice idea

OlegSheliakin commented 5 years ago

@OlegSheliakin many thanks for the sample, nice idea

You are welcome!

giperwlad commented 5 years ago

Very useful sample. I will use it!