-
Notifications
You must be signed in to change notification settings - Fork 319
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
Remove dynamic padding way name adjustment for MapWayname #1473
Conversation
d4460fb
to
7ed6790
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks fine, I've added a single comment in the code.
Also, while this solves the issue with centering the puck (which is what we need), I can't help but think that it could(should?) be a bit more generalized. if you want the puck to be in the top of the screen (e.g. in order to get a better overview when travelling south-bound with NavigationCamera.NAVIGATION_TRACKING_MODE_NORTH
), the puck would still jump between top of screen and either center of screen (if updateLocationIconPosition(true)
) or bottom of screen.
@@ -324,8 +325,8 @@ public void resumeCamera(@NonNull Location location) { | |||
* @param trackingCameraMode the tracking mode | |||
*/ | |||
public void resetCameraPositionWith(@NavigationCamera.TrackingMode int trackingCameraMode) { | |||
updateLocationIconPosition(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably use mapPaddingAdjustor.isCentered()
instead of false
? Otherwise, clicking the recenterButton
will reset the padding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hurrba yeah great catch, thanks!
@hurrba you're saying the API should be more specific rather than just a toggle? |
my point was that instead of keeping track of the logic would be similar, but instead of checking for this would account for people setting the padding to anything other than center or default (bottom of screen). again, the current solution solves our problem, but others might have other needs. edit: this is only an issue when rotating the screen. |
@hurrba yeah I see what you mean - let me work a bit more and see if I run into any snags implementing. If I do, we can ticket as a future improvement. I don't want this PR to sit / continue to block you all for too long. |
192739b
to
9c9706a
Compare
@hurrba I update the APIs here more aligned with what we discussed. A custom This PR also considers the custom padding during rotation / when clicking the re-center button. We will always zero out the padding when clicking the overview button. |
9c9706a
to
4995f62
Compare
@danesfeder I've tested the latest changes and it seems to be working as it should! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left a couple of minor comments.
Also, I'm wondering how's this SEMVER
. I think we're not breaking any APIs here 🤔 Could you clarify? If it's because of NavigationMapboxMapInstanceState#isCameraTracking
, NavigationMapboxMapInstanceState
is already package private so without an instance you cannot access to it so I believe that wouldn't break SemVer. Actually, the "public" methods included in NavigationMapboxMapInstanceState
should be package private - see comment below re Access can be package-private
.
updatePaddingWith(defaultPadding); | ||
} | ||
|
||
void updatePaddingWithZero() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment - What about "exposing" (package private) updatePaddingWith
instead and removing this method?
@@ -30,8 +33,8 @@ public String retrieveWayname() { | |||
return waynameText; | |||
} | |||
|
|||
public boolean isCameraTracking() { | |||
return isCameraTracking; | |||
public MapPaddingInstanceState retrieveMapPadding() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Access can be package-private
The same thing happens with isWaynameVisible
, retrieveWayname
and retrieveMapPadding
methods in NavigationMapboxMapInstanceState
.
4995f62
to
bc41ae2
Compare
bc41ae2
to
2ed7434
Compare
Glad to hear it @hurrba, thanks for the great feedback. @Guardiola31337 this is ready for another round 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the feedback @danesfeder 🚢
Hey @hurrba 👋 friendly reminder that OP landed and as you mentioned fixed your issue. You can retest with |
Closes #1465
As reported by @hurrba, we are dynamically adjusting the map top padding based on the visibility of the way name pill. If a developer want's to adjust the top padding themselves, or just wants to center the icon, we should make this easier and not override with unexpected behavior.
This PR also adds a more straightforward API to center the location icon, which also let's us account for centering when rotating the device: