Implement base plugin API

This commit is contained in:
Victor Shcherb 2012-05-21 01:22:53 +02:00
parent 4365899094
commit d9e33f4c81
3 changed files with 18 additions and 3 deletions

View file

@ -92,6 +92,12 @@ public class OsmandApplication extends Application {
if (LOG.isDebugEnabled()) {
LOG.debug("Time to start application " + (System.currentTimeMillis() - timeToStart) + " ms. Should be less < 800 ms");
}
timeToStart = System.currentTimeMillis();
OsmandPlugin.initPlugins(this);
if (LOG.isDebugEnabled()) {
LOG.debug("Time to init plugins " + (System.currentTimeMillis() - timeToStart) + " ms. Should be less < 800 ms");
}
}
@Override

View file

@ -38,6 +38,13 @@ public abstract class OsmandPlugin {
*/
public abstract boolean init(OsmandApplication app);
public static void initPlugins(OsmandApplication app) {
for (OsmandPlugin plugin : plugins) {
plugin.init(app);
}
}
/**
* ????
*/

View file

@ -108,8 +108,8 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
/** Called when the activity is first created. */
private OsmandMapTileView mapView;
final private MapActivityActions mapActions = new MapActivityActions(this);
final private MapActivityLayers mapLayers = new MapActivityLayers(this);
private MapActivityActions mapActions;
private MapActivityLayers mapLayers;
private NavigationInfo navigationInfo;
private SavingTrackHelper savingTrackHelper;
@ -152,7 +152,9 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
settings = getMyApplication().getSettings();
settings = getMyApplication().getSettings();
mapActions = new MapActivityActions(this);
mapLayers = new MapActivityLayers(this);
navigationInfo = new NavigationInfo(this);
requestWindowFeature(Window.FEATURE_NO_TITLE);
// Full screen is not used here