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

Enhancement - Nearby banner shows Item without image #5468

Merged

Conversation

shashankiitbhu
Copy link
Contributor

Description (required)

Fixes #5448

What changes did you make and why?
Changed the logic to show Nearby Banner on Contributions Page to show nearest Item without an Image

Tests performed (required)

Tested {build variant, e.g. ProdDebug} on Xaomi 11 Lite NE with API level 33.

Screenshots (for UI changes only)

Need help? See https://support.google.com/android/answer/9075928


Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request.

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.

Strangely I am getting the error below and the nearby banner never appears:

01-27 21:46:47.715  6819  7848 V OkHttp  :       }
01-27 21:46:47.715  6819  7848 V OkHttp  :     } ]
01-27 21:46:47.715  6819  7848 V OkHttp  :   }
01-27 21:46:47.715  6819  7848 V OkHttp  : }
01-27 21:46:47.716  6819  7848 V OkHttp  : <-- END HTTP (5810-byte body)
01-27 21:46:47.727  6819  7848 D NearbyPlaces: 5 results at radius: 0,300000
01-27 21:46:47.729  6819  7848 D NearbyController: Sorting places by distance...
01-27 21:46:47.736  6819  6819 D ContributionsFragment: java.lang.NullPointerException: Attempt to read from field 'fr.free.nrw.commons.location.LatLng fr.free.nrw.commons.nearby.Place.location' on a null object reference in method 'void fr.free.nrw.commons.contributions.ContributionsFragment.updateNearbyNotification(fr.free.nrw.commons.MapController$NearbyPlacesInfo)'
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at fr.free.nrw.commons.contributions.ContributionsFragment.updateNearbyNotification(ContributionsFragment.java:549)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at fr.free.nrw.commons.contributions.ContributionsFragment.$r8$lambda$zEG6wE9BQmmzsblEEtr8iaGRb5k(Unknown Source:0)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at fr.free.nrw.commons.contributions.ContributionsFragment$$ExternalSyntheticLambda2.accept(Unknown Source:4)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:63)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:201)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:255)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:124)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at android.os.Handler.handleCallback(Handler.java:958)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at android.os.Handler.dispatchMessage(Handler.java:99)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at android.os.Looper.loopOnce(Looper.java:205)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at android.os.Looper.loop(Looper.java:294)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at android.app.ActivityThread.main(ActivityThread.java:8248)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at java.lang.reflect.Method.invoke(Native Method)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
01-27 21:46:47.736  6819  6819 D ContributionsFragment: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

In the main branch the nearby banner loads fine.
This may be due to very recent mapbox/osmdroid changes.
Would you mind rebasing (or pulling from main)?
Thanks! :-)

@shashankiitbhu
Copy link
Contributor Author

Sure, I will look into it

@shashankiitbhu shashankiitbhu changed the base branch from main to leaderboard January 27, 2024 20:19
@shashankiitbhu shashankiitbhu changed the base branch from leaderboard to main January 27, 2024 20:19
@shashankiitbhu
Copy link
Contributor Author

Please Review it @nicolas-raoul , I think this solves the issue

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 tested this branch now.
Despite many items without image around me (shown in the Nearby activity), thee banner shows the closest item (which already has an image).

@shashankiitbhu
Copy link
Contributor Author

It may be because of how nearby locations are added to the list of the places (first only the first 5 are added ), I have made the necessary changes and tested it using fakeGPS too. @nicolas-raoul Please review it and let me know the location you are testing it from and screenshots if the issue persists (I believe it will not this time )

@nicolas-raoul
Copy link
Member

Would you mind pulling from the main branch and fixing the conflict? Thanks! :-)

…_Image

# Conflicts:
#	app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java
@shashankiitbhu
Copy link
Contributor Author

Sure, Done!

@shashankiitbhu
Copy link
Contributor Author

Done, Please Review it @nicolas-raoul

@nicolas-raoul
Copy link
Member

nicolas-raoul commented Jan 31, 2024

Strangely, sometimes I do not see thee banner appear, despite many nearby existing items with no picture. Nearby banner is enabled in the app's settings.

Did you test in many locations (using FakeGPS or similar) to check?

Thanks! :-)

@shashankiitbhu
Copy link
Contributor Author

Can you give me the location from where you are testing it? Does it not appear immediately or have you tried waiting on the screen for a few seconds?

@nicolas-raoul
Copy link
Member

@shashankiitbhu Sure, can you send me an email at my address found at https://nicolasraoul.github.io? Thanks!

@nicolas-raoul
Copy link
Member

Sent! :-)
Please let me know if you are able to see the banner appear or not (I waited 30 seconds).

@shashankiitbhu
Copy link
Contributor Author

Screenshot_2024-01-31-16-00-38-674_fr.free.nrw.commons.beta.jpg

I tested it on your location using FakeGPS but only found Pins that already have pictures

Screenshot_2024-01-31-16-01-30-540_fr.free.nrw.commons.beta.jpg

It is working well on my location (below)
Screenshot_2024-01-31-16-08-50-649_fr.free.nrw.commons.beta.jpg

Screenshot_2024-01-31-16-08-54-188_fr.free.nrw.commons.beta.jpg

@nicolas-raoul
Copy link
Member

Oh you're right! Until recently Nearby was showing several pins with no picture, but I guess something changed.

@nicolas-raoul nicolas-raoul merged commit 72a6fd2 into commons-app:main Feb 1, 2024
1 check passed
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.

Nearby banner: Show item with no image
3 participants