Remove unnecessary changes

This commit is contained in:
Vitaliy 2020-02-17 15:25:00 +02:00
parent 86bee14939
commit 06b6ca80b0

View file

@ -27,6 +27,9 @@ public class GpxNotification extends OsmandNotification {
public final static String OSMAND_STOP_GPX_SERVICE_ACTION = "OSMAND_STOP_GPX_SERVICE_ACTION"; public final static String OSMAND_STOP_GPX_SERVICE_ACTION = "OSMAND_STOP_GPX_SERVICE_ACTION";
public final static String GROUP_NAME = "GPX"; public final static String GROUP_NAME = "GPX";
private boolean wasNoDataDismissed;
private boolean lastBuiltNoData;
public GpxNotification(OsmandApplication app) { public GpxNotification(OsmandApplication app) {
super(app, GROUP_NAME); super(app, GROUP_NAME);
} }
@ -105,6 +108,13 @@ public class GpxNotification extends OsmandNotification {
return app.getSettings().MAP_ACTIVITY_ENABLED.get() && !app.getSettings().SHOW_TRIP_REC_NOTIFICATION.get(); return app.getSettings().MAP_ACTIVITY_ENABLED.get() && !app.getSettings().SHOW_TRIP_REC_NOTIFICATION.get();
} }
@Override
public void onNotificationDismissed() {
if (!wasNoDataDismissed) {
wasNoDataDismissed = lastBuiltNoData;
}
}
@Override @Override
public Builder buildNotification(boolean wearable) { public Builder buildNotification(boolean wearable) {
if (!isEnabled()) { if (!isEnabled()) {
@ -117,6 +127,7 @@ public class GpxNotification extends OsmandNotification {
boolean isGpxRecording = app.getSavingTrackHelper().getIsRecording(); boolean isGpxRecording = app.getSavingTrackHelper().getIsRecording();
float recordedDistance = app.getSavingTrackHelper().getDistance(); float recordedDistance = app.getSavingTrackHelper().getDistance();
ongoing = true; ongoing = true;
lastBuiltNoData = false;
if (isGpxRecording) { if (isGpxRecording) {
color = app.getResources().getColor(R.color.osmand_orange); color = app.getResources().getColor(R.color.osmand_orange);
notificationTitle = app.getString(R.string.shared_string_trip) + "" notificationTitle = app.getString(R.string.shared_string_trip) + ""
@ -133,10 +144,15 @@ public class GpxNotification extends OsmandNotification {
ongoing = false; ongoing = false;
notificationTitle = app.getString(R.string.shared_string_trip_recording); notificationTitle = app.getString(R.string.shared_string_trip_recording);
notificationText = app.getString(R.string.gpx_logging_no_data); notificationText = app.getString(R.string.gpx_logging_no_data);
lastBuiltNoData = true;
} }
} }
notificationText = notificationText + " (" + Integer.toString(app.getSavingTrackHelper().getTrkPoints()) + ")"; notificationText = notificationText + " (" + Integer.toString(app.getSavingTrackHelper().getTrkPoints()) + ")";
if ((wasNoDataDismissed || !app.getSettings().SHOW_TRIP_REC_NOTIFICATION.get()) && !ongoing) {
return null;
}
final Builder notificationBuilder = createBuilder(wearable) final Builder notificationBuilder = createBuilder(wearable)
.setContentTitle(notificationTitle) .setContentTitle(notificationTitle)
.setStyle(new BigTextStyle().bigText(notificationText)); .setStyle(new BigTextStyle().bigText(notificationText));