Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Route Details widget if display mode changed #21851

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class RouteInfoWidget extends MapWidget implements ISupportVerticalPanel,
private TextState textState;
private final RouteInfoCalculator calculator;
private List<DestinationInfo> cachedRouteInfo;
private RouteInfoDisplayMode cachedDisplayMode;
private int cachedContentLayoutId;
private Integer cachedMetricSystem;
private boolean forceUpdate = false;
Expand Down Expand Up @@ -252,6 +253,11 @@ private boolean isUpdateNeeded(@NonNull List<DestinationInfo> routeInfo) {
if (metricSystemChanged) {
return true;
}
RouteInfoDisplayMode displayMode = widgetState.getDisplayMode();
if (cachedDisplayMode != displayMode) {
cachedDisplayMode = displayMode;
return true;
}
if (Algorithms.isEmpty(cachedRouteInfo) || isDataChanged(cachedRouteInfo.get(0), routeInfo.get(0))) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public RouteInfoWidgetState(@NonNull OsmandApplication app, @Nullable String cus
displayModePref = registerDisplayModePreference(customId);
}

@NonNull
public RouteInfoDisplayMode getDisplayMode() {
return getDisplayMode(settings.getApplicationMode());
}

@NonNull
public RouteInfoDisplayMode getDisplayMode(@NonNull ApplicationMode appMode) {
return displayModePref.getModeValue(appMode);
Expand Down
Loading