rename showQuitDialog and isGpxSaved

This commit is contained in:
Chumva 2018-06-19 17:03:33 +03:00
parent 6f3dd8f9e8
commit 5d344ab811

View file

@ -97,7 +97,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
private boolean lightTheme;
private boolean orientationPortrait;
private boolean isGpxSaved;
private boolean isGpxSaveDialogShowed;
private boolean isSoftKeyboardShown;
private boolean north = true;
@ -121,16 +121,16 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
}
private void quit() {
if (!mapMarkers.isEmpty() && !isGpxSaved) {
showQuitDialog();
if (!mapMarkers.isEmpty() && !isGpxSaveDialogShowed) {
showSaveDialog();
} else {
saveMarkers();
dismiss();
}
}
private void showQuitDialog() {
isGpxSaved = true;
private void showSaveDialog() {
isGpxSaveDialogShowed = true;
SaveAsTrackBottomSheetDialogFragment fragment = new SaveAsTrackBottomSheetDialogFragment();
Bundle args = new Bundle();
args.putInt(ADDED_MARKERS_NUMBER_KEY, mapMarkers.size());
@ -344,7 +344,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
@Override
public void onClick(View view) {
addMapMarker();
isGpxSaved = false;
isGpxSaveDialogShowed = false;
}
});
@ -776,7 +776,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
switchEditText(textView.getId(), true);
} else if (i == EditorInfo.IME_ACTION_DONE) {
addMapMarker();
isGpxSaved = false;
isGpxSaveDialogShowed = false;
}
return false;
}
@ -919,12 +919,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
if (mapMarkers.isEmpty()) {
Toast.makeText(app, getString(R.string.plan_route_no_markers_toast), Toast.LENGTH_SHORT).show();
} else {
SaveAsTrackBottomSheetDialogFragment fragment = new SaveAsTrackBottomSheetDialogFragment();
Bundle args = new Bundle();
args.putInt(ADDED_MARKERS_NUMBER_KEY, mapMarkers.size());
fragment.setArguments(args);
fragment.setListener(createSaveAsTrackFragmentListener());
fragment.show(getChildFragmentManager(), SaveAsTrackBottomSheetDialogFragment.TAG);
showSaveDialog();
}
}
@ -940,7 +935,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
@Override
public void saveGpx(final String fileName) {
final String gpxPath = app.getMapMarkersHelper().generateGpxFromList(fileName, mapMarkers);
isGpxSaved = true;
isGpxSaveDialogShowed = true;
snackbar = Snackbar.make(mainView, fileName + " " + getString(R.string.is_saved) + ".", Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_show, new View.OnClickListener() {
@Override
@ -969,7 +964,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
clearInputs();
}
adapter.removeItem(position);
isGpxSaved = false;
isGpxSaveDialogShowed = false;
snackbar = Snackbar.make(mainView, R.string.marker_moved_to_history, Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
@Override