Update exit
This commit is contained in:
parent
d10b9d97c6
commit
c9c2a26525
4 changed files with 45 additions and 6 deletions
|
@ -58,6 +58,7 @@
|
|||
<meta-data android:name="com.sec.minimode.icon.portrait.normal" android:resource="@drawable/icon" android:value="" />
|
||||
<meta-data android:name="com.sec.minimode.icon.landscape.normal" android:resource="@drawable/icon" android:value="" />
|
||||
<activity android:name="net.osmand.plus.activities.HelpActivity" />
|
||||
<activity android:name="net.osmand.plus.activities.ExitActivity" />
|
||||
|
||||
<activity android:name="net.osmand.plus.activities.MapActivity" android:label="@string/app_name"
|
||||
android:screenOrientation="unspecified" android:launchMode="singleTop">
|
||||
|
|
|
@ -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) {
|
||||
|
|
30
OsmAnd/src/net/osmand/plus/activities/ExitActivity.java
Normal file
30
OsmAnd/src/net/osmand/plus/activities/ExitActivity.java
Normal file
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue