Fix #7608
This commit is contained in:
parent
b6032abbc6
commit
a2da336ff0
3 changed files with 22 additions and 5 deletions
|
@ -106,6 +106,10 @@ public class WaypointHelper {
|
|||
public int getRouteDistance(LocationPointWrapper point) {
|
||||
return route.getDistanceToPoint(point.routeIndex);
|
||||
}
|
||||
|
||||
public boolean isPointPassed(LocationPointWrapper point) {
|
||||
return route.isPointPassed(point.routeIndex);
|
||||
}
|
||||
|
||||
public void removeVisibleLocationPoint(LocationPointWrapper lp) {
|
||||
if (lp.type < locationPoints.size()) {
|
||||
|
|
|
@ -35,12 +35,13 @@ import net.osmand.plus.helpers.WaypointDialogHelper;
|
|||
import net.osmand.plus.helpers.WaypointHelper;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.routing.IRouteInformationListener;
|
||||
import net.osmand.plus.routing.IRoutingDataUpdateListener;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment implements IRouteInformationListener {
|
||||
public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment implements IRouteInformationListener, IRoutingDataUpdateListener {
|
||||
|
||||
public static final String TAG = "ShowAlongTheRouteBottomSheet";
|
||||
|
||||
|
@ -149,10 +150,11 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
|||
if (tp != null && tp.size() > 0) {
|
||||
for (int j = 0; j < tp.size(); j++) {
|
||||
WaypointHelper.LocationPointWrapper pointWrapper = tp.get(j);
|
||||
PointItem subheaderItem = new PointItem(pointWrapper.type);
|
||||
|
||||
headerItem.subItems.add(subheaderItem);
|
||||
subheaderItem.point = pointWrapper;
|
||||
if (!waypointHelper.isPointPassed(pointWrapper)) {
|
||||
PointItem subheaderItem = new PointItem(pointWrapper.type);
|
||||
subheaderItem.point = pointWrapper;
|
||||
headerItem.subItems.add(subheaderItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -182,12 +184,14 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
|||
public void onPause() {
|
||||
super.onPause();
|
||||
app.getRoutingHelper().removeListener(this);
|
||||
app.getRoutingHelper().removeRouteDataListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
app.getRoutingHelper().addListener(this);
|
||||
app.getRoutingHelper().addRouteDataListener(this);
|
||||
if (expandIndex != -1) {
|
||||
expListView.expandGroup(expandIndex);
|
||||
setupHeightAndBackground(getView());
|
||||
|
@ -203,6 +207,11 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRoutingDataUpdate() {
|
||||
updateAdapter();
|
||||
}
|
||||
|
||||
class ExpandableListAdapter extends OsmandBaseExpandableListAdapter {
|
||||
|
||||
private Context context;
|
||||
|
|
|
@ -1021,6 +1021,10 @@ public class RouteCalculationResult {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public boolean isPointPassed(int locationIndex) {
|
||||
return locationIndex <= currentRoute;
|
||||
}
|
||||
|
||||
public int getDistanceToFinish(Location fromLoc) {
|
||||
if(listDistance != null && currentRoute < listDistance.length){
|
||||
int dist = listDistance[currentRoute];
|
||||
|
|
Loading…
Reference in a new issue