andreynovikov / trekarta

Simple, responsive map for your trek. You decide how to journey today, not the application!
https://trekarta.info
GNU General Public License v3.0
169 stars 25 forks source link

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

Closed qnga closed 7 months ago

qnga commented 2 years ago

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

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.