Merge branch 'sasha_pasha_branch' of ssh://github.com/osmandapp/Osmand into sasha_pasha_branch
This commit is contained in:
commit
5e3a87de0e
2 changed files with 19 additions and 21 deletions
|
@ -16,11 +16,11 @@ import net.osmand.router.RouteCalculationProgress;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class MeasurementEditingContext {
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class MeasurementEditingContext {
|
|||
private ApplicationMode snapToRoadAppMode;
|
||||
private RouteCalculationProgress calculationProgress;
|
||||
private Queue<Pair<WptPt, WptPt>> snapToRoadPairsToCalculate = new LinkedList<>();
|
||||
private Map<Pair<WptPt, WptPt>, List<WptPt>> snappedToRoadPoints = new HashMap<>();
|
||||
private Map<Pair<WptPt, WptPt>, List<WptPt>> snappedToRoadPoints = new ConcurrentHashMap<>();
|
||||
|
||||
private List<WptPt> measurementPoints = new LinkedList<>();
|
||||
|
||||
|
@ -117,11 +117,7 @@ public class MeasurementEditingContext {
|
|||
}
|
||||
|
||||
public void setInSnapToRoadMode(boolean inSnapToRoadMode) {
|
||||
inSnapToRoadMode = inSnapToRoadMode;
|
||||
}
|
||||
|
||||
public SnapToRoadProgressListener getProgressListener() {
|
||||
return progressListener;
|
||||
this.inSnapToRoadMode = inSnapToRoadMode;
|
||||
}
|
||||
|
||||
public void setProgressListener(SnapToRoadProgressListener progressListener) {
|
||||
|
@ -136,14 +132,6 @@ public class MeasurementEditingContext {
|
|||
this.snapToRoadAppMode = snapToRoadAppMode;
|
||||
}
|
||||
|
||||
public Queue<Pair<WptPt, WptPt>> getSnapToRoadPairsToCalculate() {
|
||||
return snapToRoadPairsToCalculate;
|
||||
}
|
||||
|
||||
public void setSnapToRoadPairsToCalculate(Queue<Pair<WptPt, WptPt>> snapToRoadPairsToCalculate) {
|
||||
this.snapToRoadPairsToCalculate = snapToRoadPairsToCalculate;
|
||||
}
|
||||
|
||||
public Map<Pair<WptPt, WptPt>, List<WptPt>> getSnappedPoints() {
|
||||
return snappedToRoadPoints;
|
||||
}
|
||||
|
@ -229,6 +217,7 @@ public class MeasurementEditingContext {
|
|||
|
||||
void cancelSnapToRoad() {
|
||||
progressListener.hideProgressBar();
|
||||
snapToRoadPairsToCalculate.clear();
|
||||
if (calculationProgress != null) {
|
||||
calculationProgress.isCancelled = true;
|
||||
}
|
||||
|
@ -281,8 +270,6 @@ public class MeasurementEditingContext {
|
|||
pts.add(pt);
|
||||
}
|
||||
snappedToRoadPoints.put(currentPair, pts);
|
||||
// todo change logic
|
||||
// todo fix strange exceptions when snap to road calculates
|
||||
recreateSegments();
|
||||
progressListener.refreshMap();
|
||||
if (!snapToRoadPairsToCalculate.isEmpty()) {
|
||||
|
|
|
@ -101,6 +101,7 @@ public class MeasurementToolFragment extends Fragment {
|
|||
private ImageView mainIcon;
|
||||
|
||||
private boolean wasCollapseButtonVisible;
|
||||
private boolean progressBarVisible;
|
||||
private boolean pointsListOpened;
|
||||
private Boolean saved;
|
||||
private boolean portrait;
|
||||
|
@ -130,10 +131,7 @@ public class MeasurementToolFragment extends Fragment {
|
|||
editingCtx.setProgressListener(new MeasurementEditingContext.SnapToRoadProgressListener() {
|
||||
@Override
|
||||
public void showProgressBar() {
|
||||
ProgressBar progressBar = (ProgressBar) mainView.findViewById(R.id.snap_to_road_progress_bar);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
progressBar.setMinimumHeight(0);
|
||||
progressBar.setProgress(0);
|
||||
MeasurementToolFragment.this.showProgressBar();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -144,6 +142,7 @@ public class MeasurementToolFragment extends Fragment {
|
|||
@Override
|
||||
public void hideProgressBar() {
|
||||
((ProgressBar) mainView.findViewById(R.id.snap_to_road_progress_bar)).setVisibility(View.GONE);
|
||||
progressBarVisible = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -201,6 +200,10 @@ public class MeasurementToolFragment extends Fragment {
|
|||
pointsListContainer.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
if (progressBarVisible) {
|
||||
showProgressBar();
|
||||
}
|
||||
|
||||
distanceTv = (TextView) mainView.findViewById(R.id.measurement_distance_text_view);
|
||||
pointsTv = (TextView) mainView.findViewById(R.id.measurement_points_text_view);
|
||||
distanceToCenterTv = (TextView) mainView.findViewById(R.id.distance_to_center_text_view);
|
||||
|
@ -521,6 +524,14 @@ public class MeasurementToolFragment extends Fragment {
|
|||
return iconsCache.getIcon(id, nightMode ? R.color.osmand_orange : R.color.color_myloc_distance);
|
||||
}
|
||||
|
||||
private void showProgressBar() {
|
||||
ProgressBar progressBar = (ProgressBar) mainView.findViewById(R.id.snap_to_road_progress_bar);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
progressBar.setMinimumHeight(0);
|
||||
progressBar.setProgress(0);
|
||||
progressBarVisible = true;
|
||||
}
|
||||
|
||||
private void showSnapToRoadMenu(boolean rememberPreviousTitle) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
|
|
Loading…
Reference in a new issue