use of net.osmand.plus.AppInitializer.InitEvents in project Osmand by osmandapp.
the class GeoIntentActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.search_address_offline);
getSupportActionBar().setTitle(R.string.search_osm_offline);
getMyApplication().checkApplicationIsBeingInitialized(this, new AppInitializeListener() {
@Override
public void onProgress(AppInitializer init, InitEvents event) {
}
@Override
public void onFinish(AppInitializer init) {
}
});
location = getMyApplication().getSettings().getLastKnownMapLocation();
final Intent intent = getIntent();
if (intent != null) {
final ProgressDialog progress = ProgressDialog.show(GeoIntentActivity.this, getString(R.string.searching), getString(R.string.searching_address));
final GeoIntentTask task = new GeoIntentTask(progress, intent);
progress.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
task.cancel(true);
}
});
progress.setCancelable(true);
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
setIntent(null);
}
}
use of net.osmand.plus.AppInitializer.InitEvents 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