Renamed isSpeedLimitExceeded to isSpeedCamLimitExceeded.

Fixed speed value color when background is red.

Signed-off-by: Sergiy Kozyr <s.trump@gmail.com>
This commit is contained in:
Sergiy Kozyr 2024-08-14 16:06:05 +03:00
parent 39a6a0ca14
commit 8bcdeb9b77
2 changed files with 14 additions and 6 deletions

View file

@ -37,7 +37,7 @@ public class RoutingInfo
// Current speed limit in meters per second.
// If no info about speed limit then speedLimitMps < 0.
public final double speedLimitMps;
private final boolean speedLimitExceeded;
private final boolean speedCamLimitExceeded;
private final boolean shouldPlayWarningSignal;
/**
@ -159,13 +159,13 @@ public class RoutingInfo
this.exitNum = exitNum;
this.pedestrianTurnDirection = PedestrianTurnDirection.values()[pedestrianTurnOrdinal];
this.speedLimitMps = speedLimitMps;
this.speedLimitExceeded = speedLimitExceeded;
this.speedCamLimitExceeded = speedLimitExceeded;
this.shouldPlayWarningSignal = shouldPlayWarningSignal;
}
public boolean isSpeedLimitExceeded()
public boolean isSpeedCamLimitExceeded()
{
return speedLimitExceeded;
return speedCamLimitExceeded;
}
public boolean shouldPlayWarningSignal()

View file

@ -222,12 +222,20 @@ public class NavMenu
else
mSpeedValue.setText(speedAndUnits.first);
if (info.isSpeedLimitExceeded())
mSpeedValue.setTextColor(ContextCompat.getColor(mActivity, R.color.base_red));
if (last.getSpeed() > info.speedLimitMps)
{
if (info.isSpeedCamLimitExceeded())
// White text on red background for camera speeding
mSpeedValue.setTextColor(ContextCompat.getColor(mActivity, R.color.white_primary));
else
// Black text for speeding if there's no camera
mSpeedValue.setTextColor(ContextCompat.getColor(mActivity, R.color.base_red));
}
else
mSpeedValue.setTextColor(ThemeUtils.getColor(mActivity, android.R.attr.textColorPrimary));
mSpeedUnits.setText(speedAndUnits.second);
mSpeedViewContainer.setActivated(info.isSpeedCamLimitExceeded());
}
public void update(@NonNull RoutingInfo info)