214 When exit button is pressed all resources are released.
This commit is contained in:
parent
2339b2334e
commit
1b4025ab4a
4 changed files with 19 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="net.osmand.plus" android:installLocation="auto" android:versionName="0.6.2" android:versionCode="31">
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name"
|
||||
android:debuggable="false" android:name=".activities.OsmandApplication" android:description="@string/app_description">
|
||||
android:debuggable="true" android:name=".activities.OsmandApplication" android:description="@string/app_description">
|
||||
<activity android:name=".activities.MainMenuActivity"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
|
|
|
@ -174,6 +174,7 @@ public class MainMenuActivity extends Activity {
|
|||
closeButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((OsmandApplication) getApplication()).closeApplication();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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$
|
||||
|
|
Loading…
Reference in a new issue