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

Resolves #2239 by adding a compass arrow for direction of nearest item #5433

Merged
merged 4 commits into from
Jan 15, 2024

Conversation

ShashwatKedia
Copy link
Contributor

Description (required)
The CTA for the nearest item was missing the direction the user needed to head in. This PR aims to add a compass arrow to aid the user in moving in the direction of the nearest item without knowing where North is.

Fixes #2239

What changes did you make and why?
Computed bearing between the current location and the location of the nearest item and set the initial rotation of the compass arrow to the calculated bearing. Using the onSensorChanged, calculated the degree of rotation of the device and rotated the arrow accordingly, so that if the device is rotated by 30 degrees, the arrow does the same in the opposite direction.

Tests performed (required)

Tested prodDebug on OnePlus Nord CE 2 Lite with API level 31.

Screenshots (for UI changes only)

Example showing the accuracy of compass arrow:

Example 1

Proof1

Videos showing the rotation of the compass arrow with the device's rotation.

Dark Mode:
https://github.com/commons-app/apps-android-commons/assets/142137555/db6d20e2-3901-49c9-a661-5c6b58216248

Light Mode:
https://github.com/commons-app/apps-android-commons/assets/142137555/897868f0-3789-4262-916c-75aa1a0eabbd

@nicolas-raoul
Copy link
Member

In order to fix the unit tests, would you mind rebasing (or pulling) from main? Thanks :-)

Copy link
Member

@nicolas-raoul nicolas-raoul left a comment

Choose a reason for hiding this comment

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

I love it!
It even works when holding the phone vertically, thanks for going the extra kilometer!
Code looks good too.

@nicolas-raoul nicolas-raoul merged commit e5c789e into commons-app:main Jan 15, 2024
1 check passed
ShashwatKedia added a commit to ShashwatKedia/apps-android-commons that referenced this pull request Jan 15, 2024
…nearest item (commons-app#5433)

* Resolves issue commons-app#2239 by adding an arrow for direction

* Removed unnecessary change in styles.xml

* spacing

* javadoc

---------

Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
nicolas-raoul added a commit that referenced this pull request Jan 15, 2024
* Resolved issue #4513

* Localisation updates from https://translatewiki.net.

* NearbyParentFragment : added referer (#5417)

* NearbyParentFragment : added referer

In file NearbyParentFragment.java, I added header property, i.e., the referer - http://maps.wikimedia.org/
and set tile source to wikimedia.

* Reworded comments

---------

Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Removed butterknife from the quiz result activity (#5425)

* ConnectRefuseError: removed the proxy from properties.gradle file to allow downloading of build tools during CI. (#5434)

* NearbyParentFragment : added referer

In file NearbyParentFragment.java, I added header property, i.e., the referer - http://maps.wikimedia.org/
and set tile source to wikimedia.

* Reworded comments

* sdkmanager: added installation command for build-tools-30.0.3

* Revert "sdkmanager: added installation command for build-tools-30.0.3"

This reverts commit b3e5019.

* Update android.yml

* Update gradle.properties

* android.yml: removed extra debug commands

Removed some debug commands because they are no longer needed.

---------

Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>

* Removed butterknife and inlined a couple of tiny methods (#5426)

* Resolves #2239 by adding a compass arrow for direction of nearest item (#5433)

* Resolves issue #2239 by adding an arrow for direction

* Removed unnecessary change in styles.xml

* spacing

* javadoc

---------

Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>

* Added voice input for caption and description (#5415)

* Fixed Grey empty screen at Upload wizard caption step after denying files permission

* Empty commit

* Fixed loop issue

* Created docs for earlier commits

* Fixed javadoc

* Fixed spaces

* Added added basic features to OSM Maps

* Added search location feature

* Added filter to Open Street Maps

* Fixed chipGroup in Open Street Maps

* Removed mapBox code

* Removed mapBox's code

* Reformat code

* Reformatted code

* Removed rotation feature to map

* Removed rotation files and Fixed Marker click problem

* Ignored failing tests

* Added voice input feature

* Fixed test cases

* Changed caption and description text

---------

Co-authored-by: translatewiki.net <l10n-bot@translatewiki.net>
Co-authored-by: Rohit Verma <101377978+rohit9625@users.noreply.github.com>
Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
Co-authored-by: Paul Hawke <paul.hawke@gmail.com>
Co-authored-by: Kanahia <114223204+kanahia1@users.noreply.github.com>
@ShashwatKedia
Copy link
Contributor Author

Thank you so much Nicolas!! It's my pleasure to be of some use in this project ;)

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.

Show compass in home nearby banner
2 participants