Skip to content

Bugfix/nearbby zoomin #2018

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

Merged

Conversation

ashishkumar468
Copy link
Collaborator

@ashishkumar468 ashishkumar468 commented Nov 20, 2018

Description (required)
Nearby is currently zoomed out to a level where the user has to zoom in every time he uses nearby. Whenever the user starts Nearby, the map should be zoomed in to a reasonable distance(which is mapped to zoom level)
Fixes #1987 { Start Nearby map zoomed in }
What changes did you make and why?
Increased the zoom level to 12 which was 11 before
Tests performed (required)
Tested {build variant, ProdDebug} on {One Plus 1} with API level {26}.

  • Nearby zoom was appropriate (the markers were being shown properly[not too dense])
  • Opening/Closing the bottom sheet no more hinders the zoom level of the map
    **Screenshots showing what changed (optional - for UI change
    device-2018-11-21-215112

device-2018-11-21-102721

device-2018-11-21-102721

* Increased the default zoom level in nearby to 12 so that user doesnot have to zoom in to see nearby places
@codecov-io
Copy link

codecov-io commented Nov 20, 2018

Codecov Report

Merging #2018 into 2.9-release will increase coverage by 0.02%.
The diff coverage is 0%.

Impacted file tree graph

@@              Coverage Diff               @@
##           2.9-release   #2018      +/-   ##
==============================================
+ Coverage         4.13%   4.15%   +0.02%     
==============================================
  Files              223     223              
  Lines            11227   11169      -58     
  Branches          1032    1017      -15     
==============================================
  Hits               464     464              
+ Misses           10728   10670      -58     
  Partials            35      35
Impacted Files Coverage Δ
.../fr/free/nrw/commons/nearby/NearbyMapFragment.java 0% <0%> (ø) ⬆️
...fr/free/nrw/commons/media/MediaDetailFragment.java 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea37245...32851c9. Read the comment docs.

@misaochan
Copy link
Member

@ashishkumar468 I tested this on an API 26 Samsung Galaxy s7 device. The zoom level looks appropriate when loading Nearby, well done! :)

As mentioned at #1987 though, we need to handle cases where the List button is tapped as well. In your PR currently, when you tap the List button, it centers the map on an entirely wrong location (with no pins), AND at the wrong zoom level. When you go back to map, the zoom level is wrong (too zoomed out) again.

So:

  • When List is tapped, please ensure that the visible area of the map remains close to the user
  • Please ensure that the user is not zoomed out when they tap List (or when they close the list)

@ashishkumar468
Copy link
Collaborator Author

ashishkumar468 commented Nov 21, 2018

@misaochan Just to make sure I am headed in the right direction, the zoom level of the map should not be affected by the opening/closing of the bottom sheet (and remain at its default zoom level, which is currently 14), right ?

@neslihanturan
Copy link
Collaborator

I couldn't follow this issue very close but according to my tests

-When List is tapped, please ensure that the visible area of the map remains close to the user

Yes,current location marker is always visible

-Please ensure that the user is not zoomed out when they tap List (or when they close the list)

When list is extended, zoom level changes. But I think there is no way to calculate it, at least I couldn't find. When list is expanded, it covers 3/4 of whole page. So we simply calculate window rates and focus camera accordingly (we shift target parameter by two constants one for portrait one for landscape ).

new CameraPosition.Builder() .target(isBottomListSheetExpanded ? new LatLng(curMapBoxLatLng.getLatitude()- CAMERA_TARGET_SHIFT_FACTOR_PORTRAIT, curMapBoxLatLng.getLongitude()) : curMapBoxLatLng ) // Sets the new camera position .zoom(isBottomListSheetExpanded ? ZOOM_LEVEL // zoom level is fixed when bottom sheet is expanded :mapboxMap.getCameraPosition().zoom) // Same zoom level .build();

When zoom changes according to users preferences, I don't know a way to calculate these target shifting constants by considering screen size too.

So I think this PR does its best.

@ashishkumar468
Copy link
Collaborator Author

Thanks @neslihanturan . What I have tried to achieve is that, irrespective of the list, the zoom level should not change. It is set to default to 14 and it is supposed to remain the same, or to that which user has explicitly set it to be, irrespective of the bottom sheet expand/collapse state.

Copy link
Member

@maskaravivek maskaravivek left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@misaochan
Copy link
Member

Works well for me. There is indeed the disadvantage of the user not being able to see their position with the list maximized, but I think that is the lesser evil by far, since it's unlikely that anyone will try to navigate with list maximized.

Thanks @ashishkumar468 . :)

@misaochan misaochan merged commit 1b683de into commons-app:2.9-release Nov 24, 2018
@ashishkumar468 ashishkumar468 deleted the bugfix/nearbbyZoomin branch November 27, 2018 06:45
@ashishkumar468 ashishkumar468 mentioned this pull request Dec 3, 2018
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.

5 participants