diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index 4a47c04fa0..7a8595309f 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:debuggable="true" android:name=".activities.OsmandApplication" android:description="@string/app_description"> diff --git a/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java b/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java index d603e56ff8..9ad3f4283b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java @@ -174,6 +174,7 @@ public class MainMenuActivity extends Activity { closeButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { + ((OsmandApplication) getApplication()).closeApplication(); finish(); } }); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 26728f05b2..0c6eab7034 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -196,7 +196,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso settings = OsmandSettings.getPrefs(this); // for voice navigation setVolumeControlStream(AudioManager.STREAM_MUSIC); - requestWindowFeature(Window.FEATURE_NO_TITLE); + requestWindowFeature(Window.FEATURE_NO_TITLE); // Full screen is not used here // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.main); diff --git a/OsmAnd/src/net/osmand/plus/activities/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/activities/OsmandApplication.java index 5a4b4081b9..0c702017b1 100644 --- a/OsmAnd/src/net/osmand/plus/activities/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/activities/OsmandApplication.java @@ -47,6 +47,7 @@ public class OsmandApplication extends Application { private Handler uiHandler; private DayNightHelper daynightHelper; private NavigationService navigationService; + private boolean applicationInitializing = false; public void onCreate(){ @@ -87,6 +88,8 @@ public class OsmandApplication extends Application { } public ProgressDialog checkApplicationIsBeingInitialized(Context uiContext){ + // start application if it was previously closed + startApplication(); synchronized (OsmandApplication.this) { if(startDialog != null){ progressDlg = ProgressDialog.show(uiContext, getString(R.string.loading_data), getString(R.string.reading_indexes), true); @@ -170,8 +173,20 @@ public class OsmandApplication extends Application { public void setNavigationService(NavigationService navigationService) { this.navigationService = navigationService; } + + public synchronized void closeApplication(){ + if(applicationInitializing){ + manager.close(); + } + applicationInitializing = false; + } + - public void startApplication() { + public synchronized void startApplication() { + if(applicationInitializing){ + return; + } + applicationInitializing = true; startDialog = new ProgressDialogImplementation(this, null, false); startDialog.setRunnable("Initializing app", new Runnable() { //$NON-NLS-1$