diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index 5fc4817c71..a18b62017b 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -58,6 +58,7 @@ + diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index ac227bc380..4700b49e28 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -18,6 +18,7 @@ import net.osmand.osm.MapPoiTypes; import net.osmand.plus.AppInitializer.AppInitializeListener; import net.osmand.plus.access.AccessibilityMode; import net.osmand.plus.activities.DayNightHelper; +import net.osmand.plus.activities.ExitActivity; import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.activities.SettingsActivity; import net.osmand.plus.api.SQLiteAPI; @@ -395,27 +396,34 @@ public class OsmandApplication extends Application { bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - closeApplicationAnyway(activity, true); + closeApplicationAnywayImpl(activity, true); } }); bld.setNegativeButton(R.string.shared_string_no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - closeApplicationAnyway(activity, false); + closeApplicationAnywayImpl(activity, false); } }); bld.show(); } else { - closeApplicationAnyway(activity, true); + closeApplicationAnywayImpl(activity, true); } } - + private void closeApplicationAnyway(final Activity activity, boolean disableService) { + activity.finish(); + Intent newIntent = new Intent(activity, ExitActivity.class); + newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); + newIntent.putExtra(ExitActivity.DISABLE_SERVICE, disableService); + startActivity(newIntent); + } + + public void closeApplicationAnywayImpl(final Activity activity, boolean disableService) { if (appInitializer.isAppInitializing()) { resourceManager.close(); } activity.finish(); - if (getNavigationService() == null) { fullExit(); } else if (disableService) { diff --git a/OsmAnd/src/net/osmand/plus/activities/ExitActivity.java b/OsmAnd/src/net/osmand/plus/activities/ExitActivity.java new file mode 100644 index 0000000000..67beabb1ad --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/activities/ExitActivity.java @@ -0,0 +1,30 @@ +package net.osmand.plus.activities; + +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import android.app.Activity; +import android.os.Bundle; + + +public class ExitActivity extends Activity { + public final static String DISABLE_SERVICE = "DISABLE_SERVICE"; + private boolean dis; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.help_activity); + dis = getIntent().getBooleanExtra(DISABLE_SERVICE, true); + + } + + @Override + protected void onResume() { + super.onResume(); + getMyApplication().closeApplicationAnywayImpl(this, dis); + } + + private OsmandApplication getMyApplication() { + return (OsmandApplication) getApplication(); + } +} diff --git a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java index 905016717d..87fb234be5 100644 --- a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java @@ -92,7 +92,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu int locationY = tb.getPixYFromLatNoRot(ip.getLatitude()); canvas.rotate(-tb.getRotate(), locationX, locationY); canvas.drawBitmap(intermediatePoint, locationX - marginX, locationY - marginY, bitmapPaint); - marginX = intermediatePoint.getWidth() / 5; + marginX = intermediatePoint.getWidth() / 4; canvas.drawText(index + "", locationX + marginX, locationY - 3 * marginY / 5, textPaint); canvas.rotate(tb.getRotate(), locationX, locationY); }