commons-app / apps-android-commons

The Wikimedia Commons Android app allows users to upload pictures from their Android phone/tablet to Wikimedia Commons
https://commons-app.github.io/
Apache License 2.0
1.02k stars 1.23k forks source link

Add direction the user is facing to Nearby real-time position #1452

Open misaochan opened 6 years ago

misaochan commented 6 years ago

AFAIK there was a discussion about this somewhere, but I think it was buried under a more general discussion.

Currently, our users see their real-time position as a dot. Which is great! But it would be much more useful if they could see what direction they were facing, similar to popular map apps. IMO this would make it easier for users to navigate using our Nearby map, without implementing full-on routing.

A brief look at how we can do that: https://stackoverflow.com/questions/14611493/point-arrow-to-direction-the-user-is-facing

Maeglad commented 6 years ago

Hi, is anyone working on this? If not i would like to have a look at this.

nicolas-raoul commented 6 years ago

@Maeglad Feel free, it is now assigned to you! Please let us know about your progress regularly and ask questions if you need :-)

misaochan commented 6 years ago

Any updates on this @Maeglad ? :)

Maeglad commented 6 years ago

I have done logic to calculate bearing from values of magnetic and accelerometer sensor, but right now I'm struggling a bit with rotating marker on map. Marker has no methods to rotate icon. From documentation of mapbox I learned that I should use SymbolLayer and iconRotate property of layer to rotate icon. I'll try it out and keep you updated how it is going. @misaochan

misaochan commented 6 years ago

Sounds like good progress, thanks for the update @Maeglad . :)

Maeglad commented 6 years ago

I was in middle of testing when black squares started appearing on map screenshot_1529664916 im using emulator with android api 26, strange thing is i was testing same code 4 days ago on same image and there were no black squares. I tried different images but all on every it is same. This issue does not appear on mobile with same code. Anyone has some idea what it could be?

nicolas-raoul commented 6 years ago

@Maeglad Probably some network problem or problems of the server that provides the tiles.

ShashwatKedia commented 7 months ago

@nicolas-raoul I would like to work on this. I think we could reuse the code for #5433.

ShashwatKedia commented 7 months ago

@nicolas-raoul I have implemented the solution, but there seems to be one problem. Whenever I update the direction of the marker by using setRotation property of OSMDroid, the map recenters the user to the current location. So if a person is scrolling the map and simultaneously changing the direction of their phone, they are forcefully recentered in the map.

Note: I have kept a sensitivity of 5 degrees, which means the dirn of the marker will be updated only when user turns their device by 5 degrees. Increasing this value will decrease the chances of marker getting updated while user is scrolling thro the map.

Screencast: https://github.com/commons-app/apps-android-commons/assets/142137555/0b4d8527-14ad-4764-9dfa-1e8e220cf4ce

nicolas-raoul commented 7 months ago

Interesting! Feel free to send a PR. :-) It potentially might be an OsmDroid bug.

kanahia1 commented 6 months ago

@ShashwatKedia, Can I help you with it!

nicolas-raoul commented 2 months ago

@ShashwatKedia I unassign for now, but if you are you still working on this, please let us know. Also, if you have any code even broken feel free to post a patch here. Thanks a lot. :-)