-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
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);
}
stanmots, zantic and SergeyChelak
Metadata
Metadata
Assignees
Labels
No labels