use of net.osmand.plus.AppInitializer.AppInitializeListener in project Osmand by osmandapp.
the class MapActivity method checkAppInitialization.
private void checkAppInitialization() {
if (app.isApplicationInitializing()) {
findViewById(R.id.init_progress).setVisibility(View.VISIBLE);
initListener = new AppInitializeListener() {
boolean openGlSetup = false;
@Override
public void onProgress(AppInitializer init, InitEvents event) {
String tn = init.getCurrentInitTaskName();
if (tn != null) {
((TextView) findViewById(R.id.ProgressMessage)).setText(tn);
}
if (event == InitEvents.NATIVE_INITIALIZED) {
setupOpenGLView(false);
openGlSetup = true;
}
if (event == InitEvents.MAPS_INITIALIZED) {
// TODO investigate if this false cause any issues!
mapView.refreshMap(false);
if (dashboardOnMap != null) {
dashboardOnMap.updateLocation(true, true, false);
}
app.getTargetPointsHelper().lookupAddessAll();
app.getMapMarkersHelper().lookupAddressAll();
}
}
@Override
public void onFinish(AppInitializer init) {
if (!openGlSetup) {
setupOpenGLView(false);
}
mapView.refreshMap(false);
if (dashboardOnMap != null) {
dashboardOnMap.updateLocation(true, true, false);
}
findViewById(R.id.init_progress).setVisibility(View.GONE);
findViewById(R.id.drawer_layout).invalidate();
}
};
getMyApplication().checkApplicationIsBeingInitialized(this, initListener);
} else {
setupOpenGLView(true);
}
}
Aggregations