-
Notifications
You must be signed in to change notification settings - Fork 303
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
Fix #630 - Add map zoom control with checkbox preference in settings #867
Conversation
|
Getting a 503 error code during the CI build. Since I didn't change the gradle files, the error is probably external. Since I'm new to this development environment, how important is it for the CI build to succeed for each commit? |
@matty-23 Looks like there was an error on the CI build downloading an artifact from Google's server, so definitely something outside of our control. I just restarted the build so hopefully that fixes it. It's not critical that the CI build succeeds on each commit, but if it doesn't build I'd definitely take a look and see what the error is, and if it seems to be related to your changes (e.g., you forgot to commit a new file) then fix it. |
Made a pair of zoom in/out buttons to replace the default Google Maps buttons. Top image shows the unpressed state and the bottom image shows the pressed state. Next steps are to setup the actual zoom functionality and make it responsive to the left handed mode. Please let me know of any feedback before I move on. Thanks! |
@matty-23 Thanks for your work on this, it's looking good! A few comments - here is the default zoom control on left and the custom one in this PR for reference (unpressed state):
Here's the default zoom control on left and custom on right in the pressed state: Comments:
These are nitty-gritty details - you've mostly nailed the overall look. |
Thanks for the feedback! As of now,
Just wanted to mention a couple points about what I've worked on.
Let me know what you think of the changes! 😃 |
layoutParams.setMarginStart(marginDp); | ||
layoutParams.setMargins(marginDp, 0, 0, 0); | ||
|
||
} else /*not left hand mode*/ { |
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.
You can eliminate the comment here, I think it's clear enough given the boolean name
|
||
int marginDp = (int) getResources().getDimension(R.dimen.zoom_btn_layout_margin); | ||
|
||
if(leftHandMode) { |
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.
If there a reason we shouldn't move this IF statement to the checkLeftHandMode()
method so it's consistent with the FABs?
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.
Also, here and elsewhere please use a space between the if
and (
- should be if (
mMapFragment.displayZoomControl(displayZoom); | ||
LinearLayout zoomButtonsLayout = (LinearLayout) findViewById(R.id.zoom_buttons_layout); | ||
|
||
if(displayZoom) { |
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 be if (
@matty-23 Looks very nice! You're drop shadow is close enough, I wouldn't worry about any further changes for that. A few comments inline specific to the code. One last design comment - the placement of the zoom control looks odd to me up against the side of the My Location (and Layers in the Tampa region) FAB(s). I understand that for usability you've grouped it next to the FAB (and it can't be above the FAB due to the Layers FAB expanding upward), but I'm leaning towards putting it on the side of the screen opposite of the My Location FAB. So, for right-hand mode it would be on the left side, and for left hand mode it would be on the right side. This would be closer to the default controls that appear on their own in a corner of the screen. Any thoughts on this? |
@barbeau I went ahead and reformatted the code with the AndroidStyle template and factored code for placing the the location FAB and zoom controls in the
To make sure I'm understanding this correctly, the zoom controls would be on the opposite corner of the My Location FAB? I do agree that with the zoom controls next to the Location and Layers FAB, the UI does seem cluttered. However, depending on the size of the device's screen, it may be difficult to physically reach zoom controls if they were on opposite corners. In my opinion, the zoom controls and FAB should be grouped together so they can be easily reached. |
That's what I was proposing, but I agree on some wide devices that could cause usability issues for some users. What if we rotate the control 90 degrees clockwise and center it horizontally at the bottom of the screen? This is actually where the Maps API v1 default zoom controls were - plus sign on right and minus on left. This way we wouldn't need to shift control for lefthand mode either. |
Zoom buttons moved to the bottom of the screen. I think this layout looks better than previous layout and is more functional since there less chance of accidentally pressing the FAB when zooming, or vice versa. What are your thoughts? On a side note: I recently changed my github username and there's some issues with the CLA since the previous commits were tied to my old username. How can I address this? |
@m-yang I like it! I would swap the dimensions of the sides and top/bottom of the buttons, though. So instead of this: ...dimensions would look like: In other words, the height of each button should be less than the width. Right now it looks like two vertical buttons stacked side-by-side, instead of two horizontal buttons side-by-side. So, with the changes it would be a true 90 degree clockwise turn of the original vertical control. Don't worry about the CLA, I'm not sure if there is a way to resolve it with your old name. As long as the change of names is documented in this PR you should be fine. |
|
||
setFABLocation(leftHandMode); | ||
|
||
//setZoomControlLocation(leftHandMode); |
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.
This can be removed now.
@@ -1605,6 +1663,45 @@ private void checkLeftHandMode() { | |||
} | |||
} | |||
|
|||
private void setZoomControlLocation(boolean leftHandMode) { |
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.
This method can be removed now
|
||
|
||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
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.
Could you please remove one of the new lines here (and elsewhere) so there is only one line in between elements?
android:layout_alignBottom="@+id/btnMyLocation"> | ||
|
||
<ImageButton | ||
|
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.
Could you please remove the new line here for consistency?
android:src="@drawable/zoom_out_button"/> | ||
|
||
<ImageButton | ||
|
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.
Could you please remove the new line here for consistency?
<dimen name="zoom_out_btn_right_offset">@dimen/zoom_out_btn_left_offset</dimen> | ||
<dimen name="zoom_in_btn_left_offset">4.5dp</dimen> | ||
<dimen name="zoom_in_btn_right_offset">@dimen/zoom_in_btn_left_offset</dimen> | ||
|
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.
Could you please remove the extra new line here for consistency?
<string name="preferences_show_zoom_controls_title">Show zoom controls</string> | ||
<string name="preferences_show_zoom_controls_summary">Display zoom controls on map | ||
</string> | ||
|
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.
Could you please remove the extra new lines here for consistency (just one line break)?
@m-yang This looks good to me! Thanks for all your work on this. There is just some cleanup remaining that I commented on inline (remove unused left-hand mode for zoom buttons, remove extra newlines), and then we can get this merged. |
Thanks for the feedback! I want to point out an issue. With left hand mode enabled, the My Location FAB partly covers the Google logo in the bottom corner of the screen. We would want to move the logo so that it's entirely visible to comply with the API's terms of service. One option is to move the logo to the bottom right corner of the screen in left hand mode and have it remain in its bottom left corner in right hand mode. Another option we have is to move the FAB up a bit. What are your thoughts? |
That's a good point - I didn't catch that in the original implementation.
Yes, I think this is the best solution. Could you please open a new issue for this? We can get this PR merged and tackle that in a separate workstream. |
Styled the code! Let me know your feedback. |
Looks great! Thanks for your work on this @m-yang! It will go out in the next release (not v2.3.5, which is already rolling out now). |
* Based on commit 7aa3783 - Fix OneBusAway#630 - Add map zoom control with checkbox preference in settings (OneBusAway#867)
Work in progress PR for zoom control (#630).