Version 0.6.5. Fix first location after onResume.Fix exit functionality.

This commit is contained in:
Victor Shcherb 2011-06-13 02:09:04 +02:00
parent c1b89d468c
commit 2f1d7cf6c5
4 changed files with 31 additions and 13 deletions

View file

@ -5,13 +5,10 @@ public class Version {
public static final String APP_NAME = "OsmAnd"; //$NON-NLS-1$
public static final String APP_MAP_CREATOR_NAME = "OsmAndMapCreator"; //$NON-NLS-1$
public static final String APP_VERSION = "0.6.5"; //$NON-NLS-1$
public static final String APP_DESCRIPTION = "alpha"; //$NON-NLS-1$
public static final String APP_DESCRIPTION = "beta"; //$NON-NLS-1$
public static final String APP_NAME_VERSION = APP_NAME + " " + APP_VERSION; //$NON-NLS-1$
public static final String APP_FULL_NAME = APP_NAME + " " + APP_VERSION + " " +APP_DESCRIPTION; //$NON-NLS-1$ //$NON-NLS-2$
public static final String APP_MAP_CREATOR_FULL_NAME = APP_MAP_CREATOR_NAME + " " + APP_VERSION + " " +APP_DESCRIPTION; //$NON-NLS-1$ //$NON-NLS-2$
}

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.osmand.plus" android:installLocation="auto" android:versionName="0.6.4" android:versionCode="33">
package="net.osmand.plus" android:installLocation="auto" android:versionName="0.6.5" android:versionCode="34">
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:debuggable="true" android:name=".activities.OsmandApplication" android:description="@string/app_description">
android:debuggable="false" android:name=".activities.OsmandApplication" android:description="@string/app_description">
<activity android:name=".activities.MainMenuActivity"
android:label="@string/app_name">
<intent-filter>

View file

@ -43,6 +43,7 @@ public class MainMenuActivity extends Activity {
private static final String CONTRIBUTION_VERSION_FLAG = "CONTRIBUTION_VERSION_FLAG";
public static final int APP_EXIT_CODE = 4;
public static final String APP_EXIT_KEY = "APP_EXIT_KEY";
public void checkPreviousRunsForExceptions(boolean firstTime) {
@ -163,6 +164,12 @@ public class MainMenuActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(getIntent() != null){
Intent intent = getIntent();
if(intent.getExtras() != null && intent.getExtras().containsKey(APP_EXIT_KEY)){
finish();
}
}
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.menu);
@ -202,6 +209,7 @@ public class MainMenuActivity extends Activity {
@Override
public void onClick(View v) {
((OsmandApplication) activity.getApplication()).closeApplication();
//moveTaskToBack(true);
activity.finish();
}
});

View file

@ -322,10 +322,20 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
closeButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
((OsmandApplication) getApplication()).closeApplication();
dlg.dismiss();
MapActivity.this.setResult(MainMenuActivity.APP_EXIT_CODE);
MapActivity.this.finish();
((OsmandApplication) getApplication()).closeApplication();
// 1. Work for almost all cases when user open apps from main menu
Intent newIntent = new Intent(MapActivity.this, MainMenuActivity.class);
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
newIntent.putExtra(MainMenuActivity.APP_EXIT_KEY, MainMenuActivity.APP_EXIT_CODE);
startActivity(newIntent);
// 2. good analogue but user will come back to the current activity onResume()
// so application is not reloaded !!!
// moveTaskToBack(true);
// 3. bad results if user comes from favorites
//MapActivity.this.setResult(MainMenuActivity.APP_EXIT_CODE);
//MapActivity.this.finish();
}
});
@ -347,8 +357,6 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
});
dlg.show();
// Intent newIntent = new Intent(MapActivity.this, MainMenuActivity.class);
//newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// startActivity(newIntent);
@ -454,7 +462,6 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
private void updateSpeedBearing(Location location) {
// For network/gps it's bad way (not accurate). It's widely used for testing purposes
// possibly keep using only for emulator case
// if (!providerSupportsSpeed
PointLocationLayer locationLayer = mapLayers.getLocationLayer();
if (isRunningOnEmulator()
&& locationLayer.getLastKnownLocation() != null && location != null) {
@ -467,7 +474,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
} else {
speed = ((float) d * 1000) / time ;
}
// incorrect in case of airplane
// Be aware only for emulator ! code is incorrect in case of airplane
if (speed > 100) {
speed = 100;
}
@ -747,7 +754,13 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
updateApplicationModeSettings();
mapLayers.getPoiMapLayer().setFilter(settings.getPoiFilterForMap((OsmandApplication) getApplication()));
backToLocation.setVisibility(View.INVISIBLE);
if(isMapLinkedToLocation() && !routingHelper.isFollowingMode()){
// by default turn off causing unexpected movements due to network establishing
// best to show previous location
settings.setSyncMapToGpsLocation(false);
}
routingHelper.setUiActivity(this);