Merge pull request #8574 from osmandapp/clear_dialog_fix

Clear data dialog
This commit is contained in:
max-klaus 2020-02-27 15:34:11 +03:00 committed by GitHub
commit c312461126
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -11,6 +11,7 @@
Thx - Hardy
-->
<string name="clear_recorded_data_warning">Are you sure you want to clear recorded data?</string>
<string name="profile_type_custom_string">Custom profile</string>
<string name="shared_string_angle_param">Angle: %s°</string>
<string name="shared_string_angle">Angle</string>

View file

@ -288,7 +288,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
public void controlDialog(final Activity activity, final boolean showTrackSelection) {
final boolean wasTrackMonitored = settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
boolean nightMode;
final boolean nightMode;
if (activity instanceof MapActivity) {
nightMode = app.getDaynightHelper().isNightModeForMapControls();
} else {
@ -328,7 +328,16 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
startGPXMonitoring(activity, showTrackSelection);
}
} else if (item == R.string.clear_recorded_data) {
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
builder.setTitle(R.string.clear_recorded_data_warning);
builder.setNegativeButton(R.string.shared_string_no, null).setPositiveButton(
R.string.shared_string_clear, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
app.getSavingTrackHelper().clearRecordedData(true);
}
});
builder.show();
} else if(item == R.string.gpx_monitoring_stop) {
stopRecording();
} else if(item == R.string.gpx_start_new_segment) {