Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
84034beb2f
2 changed files with 16 additions and 11 deletions
|
@ -249,14 +249,16 @@ public class NavigationService extends Service implements LocationListener {
|
|||
|
||||
@Override
|
||||
public void onTaskRemoved(Intent rootIntent) {
|
||||
if (((OsmandApplication) getApplication()).getNavigationService() != null &&
|
||||
((OsmandApplication) getApplication()).getSettings().DISABLE_RECORDING_ONCE_APP_KILLED.get()) {
|
||||
OsmandApplication app = ((OsmandApplication) getApplication());
|
||||
if (app.getNavigationService() != null &&
|
||||
app.getSettings().DISABLE_RECORDING_ONCE_APP_KILLED.get()) {
|
||||
OsMoPlugin plugin = OsmandPlugin.getEnabledPlugin(OsMoPlugin.class);
|
||||
if (plugin != null) {
|
||||
if (plugin.getTracker().isEnabledTracker()) {
|
||||
plugin.getTracker().disableTracker();
|
||||
}
|
||||
}
|
||||
app.getNotificationHelper().removeServiceNotificationCompletely();
|
||||
NavigationService.this.stopSelf();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,27 +118,30 @@ public class NotificationHelper {
|
|||
.setContentTitle(Version.getAppName(app)).setContentText(notificationText).setSmallIcon(icon)
|
||||
.setContentIntent(contentPendingIntent).setOngoing(service != null);
|
||||
if (monitoringPlugin != null) {
|
||||
if(service != null && (service.getUsedBy() & NavigationService.USED_BY_GPX) != 0) {
|
||||
Intent saveIntent = new Intent(OSMAND_SAVE_GPX_SERVICE_ACTION);
|
||||
PendingIntent savePendingIntent = PendingIntent.getBroadcast(app, 0, saveIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
if(service != null && service.getUsedBy() == NavigationService.USED_BY_GPX) {
|
||||
Intent stopIntent = new Intent(OSMAND_STOP_GPX_SERVICE_ACTION);
|
||||
PendingIntent stopPendingIntent = PendingIntent.getBroadcast(app, 0, stopIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
notificationBuilder.addAction(R.drawable.ic_action_rec_stop,
|
||||
app.getString(R.string.shared_string_control_stop), stopPendingIntent);
|
||||
} else {
|
||||
app.getString(R.string.shared_string_control_stop), stopPendingIntent);
|
||||
notificationBuilder.addAction(R.drawable.ic_action_save, app.getString(R.string.shared_string_save),
|
||||
savePendingIntent);
|
||||
} else if(service == null) {
|
||||
Intent startIntent = new Intent(OSMAND_START_GPX_SERVICE_ACTION);
|
||||
PendingIntent startPendingIntent = PendingIntent.getBroadcast(app, 0, startIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
notificationBuilder.addAction(R.drawable.ic_action_rec_start,
|
||||
app.getString(R.string.shared_string_control_start), startPendingIntent);
|
||||
notificationBuilder.addAction(R.drawable.ic_action_save, app.getString(R.string.shared_string_save),
|
||||
savePendingIntent);
|
||||
}
|
||||
|
||||
Intent saveIntent = new Intent(OSMAND_SAVE_GPX_SERVICE_ACTION);
|
||||
PendingIntent savePendingIntent = PendingIntent.getBroadcast(app, 0, saveIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
notificationBuilder.addAction(R.drawable.ic_action_save, app.getString(R.string.shared_string_save),
|
||||
savePendingIntent);
|
||||
|
||||
}
|
||||
return notificationBuilder;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue