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

Removing Android framework dependency in the PresenterManager class #7

Open
vishnuharidas opened this issue Jul 17, 2016 · 0 comments

Comments

@vishnuharidas
Copy link

The PresenterManager class currently accepts a Bundle object passed via the savePresenter(BasePresenter<?, ?> presenter, Bundle outState) and the restorePresenter(Bundle savedInstanceState) to keep a reference of a presenter. This makes a dependency on the Android framework.

What about passing a unique key string from the Activity (or Fragment) that uses this presenter? This will remove the dependency on the Bundle class as well.

For example,

  • savePresenter(BasePresenter<?, ?> presenter, String key)
  • restorePresenter(String key)

and in Activity's onCreate() method,

    private static final String MY_ACTIVITY_KEY = "login_activity";
    .....
    if (savedInstanceState == null) {
        presenter = new MainPresenter();
    } else {
        presenter = PresenterManager.getInstance().restorePresenter(MY_ACTIVITY_KEY);
    }
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

1 participant