Handle screen rotating
This commit is contained in:
parent
ad3b42dc73
commit
ab74af6b81
1 changed files with 18 additions and 11 deletions
|
@ -456,7 +456,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
enterMeasurementMode();
|
enterMeasurementMode();
|
||||||
|
|
||||||
if (snapToRoadEnabled) {
|
if (snapToRoadEnabled) {
|
||||||
enableSnapToRoadMode();
|
enableSnapToRoadMode(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newGpxLine != null && !gpxPointsAdded) {
|
if (newGpxLine != null && !gpxPointsAdded) {
|
||||||
|
@ -668,7 +668,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onApplicationModeItemClick(ApplicationMode mode) {
|
public void onApplicationModeItemClick(ApplicationMode mode) {
|
||||||
snapToRoadAppMode = mode;
|
snapToRoadAppMode = mode;
|
||||||
enableSnapToRoadMode();
|
enableSnapToRoadMode(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -749,7 +749,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableSnapToRoadMode() {
|
private void enableSnapToRoadMode(boolean enableAfterRotating) {
|
||||||
if (snapToRoadAppMode != null) {
|
if (snapToRoadAppMode != null) {
|
||||||
toolBarController.setTopBarSwitchVisible(true);
|
toolBarController.setTopBarSwitchVisible(true);
|
||||||
toolBarController.setTopBarSwitchChecked(true);
|
toolBarController.setTopBarSwitchChecked(true);
|
||||||
|
@ -768,16 +768,15 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
});
|
});
|
||||||
snapToRoadBtn.setVisibility(View.VISIBLE);
|
snapToRoadBtn.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if (snapToRoadProgressBar == null) {
|
|
||||||
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 (measurementPoints.size() > 1) {
|
||||||
snapToRoadProgressBar.setVisibility(View.VISIBLE);
|
if (!enableAfterRotating) {
|
||||||
snapToRoadProgressBar.setProgress(0);
|
snapToRoadProgressBar.setProgress(0);
|
||||||
doSnapToRoad(mapActivity);
|
doSnapToRoad(mapActivity);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
}
|
}
|
||||||
|
@ -807,6 +806,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
params.calculationProgressCallback = new RoutingHelper.RouteCalculationProgressCallback() {
|
params.calculationProgressCallback = new RoutingHelper.RouteCalculationProgressCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void updateProgress(int progress) {
|
public void updateProgress(int progress) {
|
||||||
|
snapToRoadProgressBar.setVisibility(View.VISIBLE);
|
||||||
snapToRoadProgressBar.setProgress(progress);
|
snapToRoadProgressBar.setProgress(progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,6 +818,10 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void finish() {
|
public void finish() {
|
||||||
snapToRoadProgressBar.setVisibility(View.GONE);
|
snapToRoadProgressBar.setVisibility(View.GONE);
|
||||||
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
if (mapActivity != null) {
|
||||||
|
mapActivity.refreshMap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
params.listener = new SnapToRoadParams.SnapToRoadListener() {
|
params.listener = new SnapToRoadParams.SnapToRoadListener() {
|
||||||
|
@ -830,8 +834,11 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
pt.lon = loc.getLongitude();
|
pt.lon = loc.getLongitude();
|
||||||
snappedToRoadPoints.add(pt);
|
snappedToRoadPoints.add(pt);
|
||||||
}
|
}
|
||||||
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
if (mapActivity != null) {
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mapActivity.getMyApplication().getRoutingHelper().recalculateSnapToRoad(start, end, intermediates, params);
|
mapActivity.getMyApplication().getRoutingHelper().recalculateSnapToRoad(start, end, intermediates, params);
|
||||||
|
|
Loading…
Reference in a new issue