Skip to content

Removing Android framework dependency in the PresenterManager class #7

@vishnuharidas

Description

@vishnuharidas

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);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions