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

Initialize plugins and custom maps in MapTrek instead of MainActivity #193

Merged
merged 2 commits into from
Dec 19, 2023

Conversation

qnga
Copy link
Contributor

@qnga qnga commented May 11, 2022

This is necessary because MainActivity can be recreated with a saved bundle in two different cases:

  • on orientation changes, when only the activity is recreated
  • after the process has been killed, when both activity and application are recreated

In the first case, mMapIndex = application.getExtraMapIndex() worked well,
though in the second case, MapTrek.mExtraMapIndex got cleared and maps from content providers hadn't had any chance to get initialized up to now.

I'm not sure if the approach I adopted will be fine with you. Unfortunately, plugin management cannot satisfactorily be restricted to BasePluginActivity because plugins must be initialized on application startup, not when the activity is created.

qnga and others added 2 commits May 11, 2022 10:57
This is necessary because MainActivity can be recreated with a saved bundle in two different cases:
- on orientation changes, when only the activity is recreated
- after the process has been killed

In the first case, mMapIndex = application.getExtraMapIndex() worked well,
though in the second case, MapTrek.mExtraMapIndex got cleared and maps from content providers hadn't had any chance to get initialized up to now.
@andreynovikov andreynovikov merged commit 310d5b7 into andreynovikov:master Dec 19, 2023
1 of 6 checks passed
@qnga qnga deleted the fix/custom-maps-disappear branch February 5, 2024 11:41
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

Successfully merging this pull request may close these issues.

2 participants