use of net.osmand.plus.measurementtool.OptionsBottomSheetDialogFragment.OptionsFragmentListener in project Osmand by osmandapp.
the class MeasurementToolFragment method createOptionsFragmentListener.
private OptionsFragmentListener createOptionsFragmentListener() {
return new OptionsFragmentListener() {
final MapActivity mapActivity = getMapActivity();
final MeasurementToolLayer measurementLayer = getMeasurementLayer();
@Override
public void snapToRoadOnCLick() {
if (!editingCtx.isInSnapToRoadMode()) {
showSnapToRoadMenu(true);
} else {
disableSnapToRoadMode();
}
}
@Override
public void addToGpxOnClick() {
if (mapActivity != null && measurementLayer != null) {
if (editingCtx.getPointsCount() > 0) {
addToGpx(mapActivity);
} else {
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void saveAsNewTrackOnClick() {
if (mapActivity != null && measurementLayer != null) {
if (editingCtx.getPointsCount() > 0) {
openSaveAsNewTrackMenu(mapActivity);
} else {
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void addToTheTrackOnClick() {
if (mapActivity != null && measurementLayer != null) {
if (editingCtx.getPointsCount() > 0) {
showAddToTrackDialog(mapActivity);
} else {
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void clearAllOnClick() {
editingCtx.getCommandManager().execute(new ClearPointsCommand(measurementLayer));
editingCtx.cancelSnapToRoad();
if (pointsListOpened) {
hidePointsList();
}
disable(redoBtn, upDownBtn);
updateText();
saved = false;
}
};
}
Aggregations