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

[Android] Speed limit in navigation mode #8897

Merged
merged 6 commits into from
Aug 15, 2024
Merged

Conversation

strump
Copy link
Contributor

@strump strump commented Aug 9, 2024

Changed navigation UI to show speed and speed limit with '/' separator (as in iOS).

Q1. How to test it without having a ride in a car?

How to check it on emulator?

Expected result: speed limit should be displayed in navigation mode:

ios speed limit

Testing:

Screenshot 2024-08-09 at 10 55 04

I used GPX track Florida. Busch Gardens - Pollo Tropical.gpx to emulate city ride.

Signed-off-by: Sergiy Kozyr <s.trump@gmail.com>
@strump strump requested a review from biodranik August 9, 2024 06:55
@biodranik
Copy link
Member

@strump Thanks! Try to google for a gpx file from any car ride in mapped areas (maybe some are available at osm.org) and use it to feed into Android Emulator.
https://stackoverflow.com/questions/72179679/how-can-i-drive-in-android-simulated-phones-when-using-maps

if (mCurrentSpeedLimit > 0.0)
{
Pair<String, String> speedLimitAndUnits = StringUtils.nativeFormatSpeedAndUnits(last.getSpeed());
mSpeedValue.setText(speedAndUnits.first + " / " + speedLimitAndUnits.first);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this narrow non-breaking space look better? https://www.compart.com/en/unicode/U+202F

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can also be used on iOS btw.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean replace " / " with "\u202F/\u202F"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, or just copy the necessary space symbol and insert it directly into the string.

Signed-off-by: Sergiy Kozyr <s.trump@gmail.com>
@strump strump changed the title [Android] Speed limit in bavigation mode [Android] Speed limit in navigation mode Aug 9, 2024
@strump strump marked this pull request as ready for review August 9, 2024 08:16
@biodranik biodranik added this to the Ready for alpha testing milestone Aug 9, 2024
Signed-off-by: Sergiy Kozyr <s.trump@gmail.com>
Fixed speed value color when background is red.

Signed-off-by: Sergiy Kozyr <s.trump@gmail.com>
Copy link
Member

@biodranik biodranik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nits.

// 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Black text for speeding if there's no camera
// Red text for speeding if there's no camera

Or you can drop these comments, the code is self-explanatory.

Copy link
Member

@biodranik biodranik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks and let's proceed with the release!

…java

Signed-off-by: Alexander Borsuk <170263+biodranik@users.noreply.github.com>
…java

Signed-off-by: Alexander Borsuk <170263+biodranik@users.noreply.github.com>
@biodranik biodranik merged commit dd8dd8e into master Aug 15, 2024
5 checks passed
@biodranik biodranik deleted the android-speed-limit branch August 15, 2024 10:23
meenbeese pushed a commit to meenbeese/organicmaps that referenced this pull request Nov 28, 2024
* Changed navigation UI to show speed and speed limit with '/' separator.

Signed-off-by: Sergiy Kozyr <s.trump@gmail.com>

* Fixed speed limit display

Signed-off-by: Sergiy Kozyr <s.trump@gmail.com>

* Removed red background for speedometer

Signed-off-by: Sergiy Kozyr <s.trump@gmail.com>

* Renamed `isSpeedLimitExceeded` to `isSpeedCamLimitExceeded`.
Fixed speed value color when background is red.

Signed-off-by: Sergiy Kozyr <s.trump@gmail.com>

* Update android/app/src/main/java/app/organicmaps/widget/menu/NavMenu.java

Signed-off-by: Alexander Borsuk <170263+biodranik@users.noreply.github.com>

* Update android/app/src/main/java/app/organicmaps/widget/menu/NavMenu.java

Signed-off-by: Alexander Borsuk <170263+biodranik@users.noreply.github.com>

---------

Signed-off-by: Sergiy Kozyr <s.trump@gmail.com>
Signed-off-by: Alexander Borsuk <170263+biodranik@users.noreply.github.com>
Co-authored-by: Alexander Borsuk <170263+biodranik@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants