Remove unnecessary method
This commit is contained in:
parent
8e391b1925
commit
40b7e1b8e5
3 changed files with 18 additions and 22 deletions
|
@ -247,7 +247,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (!pointsListOpened
|
if (!pointsListOpened
|
||||||
&& measurementLayer.getPointsCount() > 0
|
&& measurementPoints.size() > 0
|
||||||
&& !measurementLayer.isInMovePointMode()
|
&& !measurementLayer.isInMovePointMode()
|
||||||
&& !measurementLayer.isInAddPointAfterMode()
|
&& !measurementLayer.isInAddPointAfterMode()
|
||||||
&& !measurementLayer.isInAddPointBeforeMode()) {
|
&& !measurementLayer.isInAddPointBeforeMode()) {
|
||||||
|
@ -314,7 +314,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
disable(undoBtn);
|
disable(undoBtn);
|
||||||
}
|
}
|
||||||
hidePointsListIfNoPoints();
|
hidePointsListIfNoPoints();
|
||||||
if (measurementLayer.getPointsCount() > 0) {
|
if (measurementPoints.size() > 0) {
|
||||||
enable(upDownBtn);
|
enable(upDownBtn);
|
||||||
}
|
}
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
|
@ -334,7 +334,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
disable(redoBtn);
|
disable(redoBtn);
|
||||||
}
|
}
|
||||||
hidePointsListIfNoPoints();
|
hidePointsListIfNoPoints();
|
||||||
if (measurementLayer.getPointsCount() > 0) {
|
if (measurementPoints.size() > 0) {
|
||||||
enable(upDownBtn);
|
enable(upDownBtn);
|
||||||
}
|
}
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
|
@ -393,7 +393,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
if (!commandManager.canRedo()) {
|
if (!commandManager.canRedo()) {
|
||||||
disable(redoBtn);
|
disable(redoBtn);
|
||||||
}
|
}
|
||||||
if (measurementLayer.getPointsCount() < 1) {
|
if (measurementPoints.size() < 1) {
|
||||||
disable(upDownBtn);
|
disable(upDownBtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
toolBarController.setOnSaveViewClickListener(new View.OnClickListener() {
|
toolBarController.setOnSaveViewClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (measurementLayer.getPointsCount() > 0) {
|
if (measurementPoints.size() > 0) {
|
||||||
addToGpx(mapActivity);
|
addToGpx(mapActivity);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
|
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
|
||||||
|
@ -557,7 +557,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void addToGpxOnClick() {
|
public void addToGpxOnClick() {
|
||||||
if (mapActivity != null && measurementLayer != null) {
|
if (mapActivity != null && measurementLayer != null) {
|
||||||
if (measurementLayer.getPointsCount() > 0) {
|
if (measurementPoints.size() > 0) {
|
||||||
addToGpx(mapActivity);
|
addToGpx(mapActivity);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
|
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
|
||||||
|
@ -568,7 +568,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void saveAsNewTrackOnClick() {
|
public void saveAsNewTrackOnClick() {
|
||||||
if (mapActivity != null && measurementLayer != null) {
|
if (mapActivity != null && measurementLayer != null) {
|
||||||
if (measurementLayer.getPointsCount() > 0) {
|
if (measurementPoints.size() > 0) {
|
||||||
openSaveAsNewTrackMenu(mapActivity);
|
openSaveAsNewTrackMenu(mapActivity);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
|
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
|
||||||
|
@ -579,7 +579,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void addToTheTrackOnClick() {
|
public void addToTheTrackOnClick() {
|
||||||
if (mapActivity != null && measurementLayer != null) {
|
if (mapActivity != null && measurementLayer != null) {
|
||||||
if (measurementLayer.getPointsCount() > 0) {
|
if (measurementPoints.size() > 0) {
|
||||||
showAddToTrackDialog(mapActivity);
|
showAddToTrackDialog(mapActivity);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
|
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
|
||||||
|
@ -772,11 +772,9 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
snapToRoadProgressBar = (ProgressBar) mainView.findViewById(R.id.snap_to_road_progress_bar);
|
snapToRoadProgressBar = (ProgressBar) mainView.findViewById(R.id.snap_to_road_progress_bar);
|
||||||
snapToRoadProgressBar.setMinimumHeight(0);
|
snapToRoadProgressBar.setMinimumHeight(0);
|
||||||
|
|
||||||
if (measurementPoints.size() > 1) {
|
if (!enableAfterRotating) {
|
||||||
if (!enableAfterRotating) {
|
snapToRoadProgressBar.setProgress(0);
|
||||||
snapToRoadProgressBar.setProgress(0);
|
doSnapToRoad();
|
||||||
doSnapToRoad();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
|
@ -786,7 +784,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
|
|
||||||
private void doSnapToRoad() {
|
private void doSnapToRoad() {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null && measurementPoints.size() > 1) {
|
||||||
Location start = new Location("");
|
Location start = new Location("");
|
||||||
WptPt first = measurementPoints.get(0);
|
WptPt first = measurementPoints.get(0);
|
||||||
start.setLatitude(first.getLatitude());
|
start.setLatitude(first.getLatitude());
|
||||||
|
@ -845,6 +843,8 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
};
|
};
|
||||||
|
|
||||||
mapActivity.getMyApplication().getRoutingHelper().recalculateSnapToRoad(start, end, intermediates, params);
|
mapActivity.getMyApplication().getRoutingHelper().recalculateSnapToRoad(start, end, intermediates, params);
|
||||||
|
} else {
|
||||||
|
calculationProgress.isCancelled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1181,7 +1181,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
private void hidePointsListIfNoPoints() {
|
private void hidePointsListIfNoPoints() {
|
||||||
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
if (measurementLayer.getPointsCount() < 1) {
|
if (measurementPoints.size() < 1) {
|
||||||
disable(upDownBtn);
|
disable(upDownBtn);
|
||||||
if (pointsListOpened) {
|
if (pointsListOpened) {
|
||||||
hidePointsList();
|
hidePointsList();
|
||||||
|
@ -1445,7 +1445,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
distanceTv.setText(measurementLayer.getDistanceSt() + ",");
|
distanceTv.setText(measurementLayer.getDistanceSt() + ",");
|
||||||
pointsTv.setText((portrait ? pointsSt + ": " : "") + measurementLayer.getPointsCount());
|
pointsTv.setText((portrait ? pointsSt + ": " : "") + measurementPoints.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1547,7 +1547,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
hidePointsList();
|
hidePointsList();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (measurementLayer.getPointsCount() < 1 || saved) {
|
if (measurementPoints.size() < 1 || saved) {
|
||||||
dismiss(mapActivity);
|
dismiss(mapActivity);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,10 +127,6 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
this.inMeasurementMode = inMeasurementMode;
|
this.inMeasurementMode = inMeasurementMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPointsCount() {
|
|
||||||
return measurementPoints.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<WptPt> getMeasurementPoints() {
|
public List<WptPt> getMeasurementPoints() {
|
||||||
return measurementPoints;
|
return measurementPoints;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class AddPointCommand extends MeasurementModeCommand {
|
||||||
public AddPointCommand(MeasurementToolLayer measurementLayer, boolean center) {
|
public AddPointCommand(MeasurementToolLayer measurementLayer, boolean center) {
|
||||||
this.measurementLayer = measurementLayer;
|
this.measurementLayer = measurementLayer;
|
||||||
this.center = center;
|
this.center = center;
|
||||||
position = measurementLayer.getPointsCount();
|
position = measurementLayer.getMeasurementPoints().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue