-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add a dialog to prompt user if location is off in Nearby when Locate me button is pressed. #3438
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
Add a dialog to prompt user if location is off in Nearby when Locate me button is pressed. #3438
Conversation
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 add tests to make sure this change works as expected?
app/src/main/java/fr/free/nrw/commons/location/LocationServiceManager.java
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #3438 +/- ##
===========================================
- Coverage 7.19% 7.18% -0.01%
Complexity 297 297
===========================================
Files 264 264
Lines 11840 11855 +15
Branches 961 962 +1
===========================================
Hits 852 852
- Misses 10919 10934 +15
Partials 69 69
Continue to review full report at Codecov.
|
I have a few comments and noted with the current implementation which I would like to share and noted a few issues that should be fixed. I couldn't find the time to share it in detail yet. I'll try to share them by tomorrow. I apologise for the delay. |
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.
I have a few comments and noted with the current implementation which I would like to share and noted a few issues that should be fixed. I couldn't find the time to share it in detail yet. I'll try to share them by tomorrow. I apologise for the delay.
Sure. Share them whenever you are free :)
app/src/main/java/fr/free/nrw/commons/location/LocationServiceManager.java
Show resolved
Hide resolved
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.
Some general points:
- I thought we came to a consensus that when the location is
off
and the user taps on the "Locate Me" icon each time just like the way Google maps does it. But I'm seeing the dialog only the first time. After that tapping on the icon does nothing. Am I missing something? 🤔 - When I go to the Nearby screen after opening the app I'm unable to click on the "Locate me" icon for some time. This happens despite of the location mode. It's as if the icon is disabled. What could be the reason for this?
Notes for future reference (not related to this PR).
- Sometimes, even when the location is turned off the app precisely shows my current location. Need to explore why and fix this.
- If possible, it would be nice if we show a blue dot when device has been located accurately.
app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Outdated
Show resolved
Hide resolved
Sure @sivaraam. Let's go with your approach. You didn't reply to my comment on the issue, so I took it as a yes. My bad. I would remove the code that shows the dialog only once. And then maybe you can try it in the App and see if it's not annoying to show it each time to the user. |
I have also experienced it multiple times and it's not related to the dialog issue nor did it started occurring after adding the dialog box. But I will definitely look into it after this PR is done or maybe we should create a new issue for this. Let me know what do you think. |
👍
Sorry about that. I thought I responded to all your comments in the issue. Just to be sure I understand correctly, are you referring to this linked comment as the one that was not answered?
If this isn't a consequence of introducing the dialog then there's no point in fixing it in this PR. Kindly create a new issue for this. Let's fix this in a separate PR 🙂 |
No. I am referring to this #3397 (comment). |
Ok. To be very sure I understand this, do you mean the following part of that comment?
|
Yes and also the part above it 👇
You did replied to this part though but you didn't object to it #3397 (comment) so I took it for a yes. Anyways, it's not a big deal @sivaraam. Let's forget it. 😃 |
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Outdated
Show resolved
Hide resolved
Well, it seems the NULL state is messy. I think it would be better not to show the dialog box when the location is NULL as it's hard to identify it's source and we already have a toast for notifying the user about it and in case internet is off, the nearby map has an Internet Unavailable banner at the bottom that stays there till internet is on. |
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.
Thanks @glitch101 for your response. See my review comments.
Also, just an FYI. The Wikipedia app used to have a Nearby feature which is not so similar to the Commons app, but it did have a "Locate me" button too. In case you need to look at another implementation to get an idea, you can see the source code for an older version of the app to how they've handled the "Locate me" button. You can't find the Nearby feature in the latest release as they've removed it. You would've to build the older version of the app yourself to see how it works. Some related links to get you started, if you're interested:
https://github.com/wikimedia/apps-android-wikipedia/tree/c5ccbe9d8ed035f3f4d5264d6f8d4fd023e86349
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Show resolved
Hide resolved
Hey @sivaraam! I was thinking about how we are approaching this problem(prompting user to enable GPS in case it's off) and I noticed that the Nearby map of Commons works quite fine without GPS. It is able to get an approximate location of the user and then show them nearby places that need photos. My point is, for Nearby to work the internet is much more important than GPS and so when we decided to show the dialog box each time instead of only once(on the press of Locate Me button), it will block the user from using the Nearby map after the local area has been loaded and displayed. So, I think we should discuss more on that decision since Commons is not a navigation app and having GPS on is not the most important requirement(unlike in navigation apps where GPS is critical) In a nutshell: Regarding your concern that it could be confusing: |
@glitch101 Just so I understand correctly, you're suggesting that:
Is that right? Correct me if I'm wrong somewhere. A few other comments:
If that's the case, why should we even showing a dialog to turn on location? I was thinking that showing the dialog would be fine as I thought Neaby wouldn't work fine without GPS. I wasn't aware about this. Also, regarding the following:
Just for the sake of discussion, I don't understand how we would be blocking users from using the map if we show the dialog each time they tap on "Locate me" and GPS is not available. They can dismiss the dialog and use the map just fine. What am I missing? |
The App should represent the most accurate location if it can which means it should use both Mobile Towers and GPS if both are available. But, we should not force them to use GPS if they can do fine without it. Also, GPS is important in areas where there is no mobile coverage like deserts, rural areas, etc.
I didn't mean it in the sense that they cannot access the map anymore. |
Also, you can try and see that getting the location is faster with both GPS and cell towers(High Accuracy) as compared to cell towers only. |
I have run into a roadblock. I have added a method in the interface |
@glitch101 you would need to add the Presenter as a Listener in LocationServiceManager. Implementing an interface doesn't do anything but force you to have methods in a class, when you add presenter it gets added to a list of Listeners, when specific events happen the Manager forwards these events to all its listeners |
Thanks for the help! |
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Outdated
Show resolved
Hide resolved
@glitch101 Sorry but I think that still doesn't answer my question. Let me rephrase it. Can't we just show the dialog only when the location off?
Yeah but locating the device is not our job, is it? Why do we even have to worry about that if all that we need for Nearby to work is that the device's location is turned on? To clarify, I'm thinking about whether we can go with the following behaviour:
In essence, we only show the dialog when the location is turned off. Is this fine? If not, what do we lose with this behaviour? |
I apologize. You are right. We should only worry if the location is on or not. I thought that you were recommending to also show the dialog each time even when the device was on Battery Saver or GPS only. Sorry about that. Now, to make sure that both of us are on the same page, this is what we are doing right?
|
It's fine. These things happen :)
Not quite.
This sounds fine.
If you mean that we should show the dialog whenever I suppose there are better ways to find that the device location is off. I think you could use LocationManager to identify if location is turned on or not. Here's a related reference which might help. It does have a That said, I am by no means an expert in these things. So, if anyone knows better ways to do this enlighten us please. 🙂 |
Yes, I agree. I clearly remember our discussion regarding the consequences of
Let me research and find a better way to detect this case that also supports old API's and does not use Play Services so that we don't need to depend on If I can't find a better way, then I will start asking around and see if someone knows a better way. |
Hey @sivaraam. I wanted to ask that when you created this issue(#3397) and when you wrote |
I suppose you mean the Location permission for the app here. If that's the case, it actually doesn't apply for my device as it just runs Android 5.1.1 and thus has no concept of App permissions 🙂 If you mean something else, please clarify.
Yeah, I meant this. Turning off the location service itself. |
Just for making sure that there is no confusion, are you referring to the toast text that I recently pushed and contains the following text:
Yes, I rebased it. I haven't contributed to open source projects before, so I am not yet familiar with the Git and Github workflow but I am learning rapidly. Thanks! 😄 |
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/location/LocationServiceManager.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Outdated
Show resolved
Hide resolved
I was referring to your screenshot https://user-images.githubusercontent.com/46349662/76640247-972b5580-6575-11ea-9f4f-b981840fcc0b.jpg . Although I would probably replace the final "the" with "your". |
Will this be better?: |
That is fine too. :) |
I have also updated the opening comment of the issue of this PR since it contained outdated information. |
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.
LGTM
I'll test this and share my comments soon. Before that I just had one quick question regarding the following statement (emphasis mine):
@glitch101 Are you really sure about the emphasized part of the statement? I just checked and Nearby seems to work fine in "GPS only" mode. Note that the network provider being enabled is not related to the mobile data of the device being turned on. |
Please note that when I said that Nearby needs
Yes, I am aware of that :) I have also updated the opening comment on the issue. |
I am awaiting @sivaraam 's review to merge as he had a lot of input on this PR |
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.
I just have a couple of comments. Other than those, this looks good to me. 🙂
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/res/values/strings.xml
Outdated
<string name="cannot_open_location_settings">Failed to open location settings. Please turn on location and set it to High Accuracy</string> | ||
<string name="set_location_mode_high_accuracy">Please make sure that location is set to both GPS and mobile networks</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.
Just a few points about the strings:
- It would be great if we could make both consistent. We use "High Accuracy" in the failed message but explicitly mention the location providers in the other one.
- Are we not asking for more than what's required here? We just need the location turned on, right? So can't we just get away with showing the toast corresponding to 'set_location_mode_high_accuracy'? Or if we really need to show the toast it would be nice we re-phrase the string as: "Please turn on location. For best results, choose the High Accuracy 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.
- Are we not asking for more than what's required here? We just need the location turned on, right? So can't we just get away with showing the toast corresponding to 'set_location_mode_high_accuracy'?
If we show the toast corresponding to set_location_mode_high_accuracy
and let's say that somehow the app failed to open the location settings then I am sure that it will definitely confuse the user if we just say to them Please make sure that location is set to both GPS and mobile networks
because they just clicked on a button on a dialog that was gonna open the settings for them. But, that's just my view and I am open to ideas :)
Or if we really need to show the toast it would be nice we re-phrase the string as: "Please turn on location. For best results, choose the High Accuracy mode."
This looks good and shouldn't we also add Failed to open location settings
in its beginning?
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 we show the toast corresponding to
set_location_mode_high_accuracy
and let's say that somehow the app failed to open the location settings then I am sure that it will definitely confuse the user if we just say to them Please make sure that location is set to both GPS and mobile networks because they just clicked on a button on a dialog that was gonna open the settings for them. But
Wait. That shouldn't happen, right? You show the set_location_mode_high_accuracy
toast only when you are able to open the location settings and the cannot_open_location_settings
toast when you aren't able to open the location settings. What am I missing? 🤔
Or if we really need to show the toast it would be nice we re-phrase the string as: "Please turn on location. For best results, choose the High Accuracy mode."
This looks good and shouldn't we also add Failed to open location settings in its beginning?
Oh! Apologies for the confusion. That was an alternative suggestion for the set_location_mode_high_accuracy
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.
Since we now know that Nearby works with any location mode(my bad), we could just say For best results, choose the High Accuracy mode
.
…arentFragment.java Co-Authored-By: Kaartic Sivaraam <kaartic.sivaraam+github@gmail.com>
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.
Perfect! There's just one minor but necessary thing that needs to be fixed. Then we can merge this PR. Thanks a lot for patiently listening to feedback and fixing this PR @glitch101! It's very much appreciated. 🙂
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Outdated
Show resolved
Hide resolved
…arentFragment.java Co-Authored-By: Kaartic Sivaraam <kaartic.sivaraam+github@gmail.com>
Thanks for being patient with me @sivaraam. I learned a lot from this single PR and I look forward to more collaboration in the future :) |
It's my pleasure. 🙂
I would be looking forward too! Thanks again. Ok. Enough talking. Let's get this merged. 😎 |
* Versioning * Update changelog.md * Optimize imports (commons-app#3272) * Convert few model classes to kotlin (commons-app#3270) * Localisation updates from https://translatewiki.net. * Fixes commons-app#3231 "Nearby" always first puts me in Punta Arenas (commons-app#3271) * Update tables from 10 to 11 * Remove unneeded changes * Update strings.xml (commons-app#3285) Improve share_text string for commons-app#3192. * Localisation updates from https://translatewiki.net. * color accent changed tto blue in dark theme (commons-app#3234) * Localisation updates from https://translatewiki.net. * Fix UI tests (commons-app#3297) * Localisation updates from https://translatewiki.net. * Localisation updates from https://translatewiki.net. * Bugfix/null revision in review (commons-app#3309) * Fixes commons-app#3305 * Handle null firstRevision * initialise explanation * Fixes commons-app#3307 (commons-app#3308) * Fixed positional argument format for string in "image_uploaded_by" * Localisation updates from https://translatewiki.net. * Localisation updates from https://translatewiki.net. * Localisation updates from https://translatewiki.net. * Localisation updates from https://translatewiki.net. * Localisation updates from https://translatewiki.net. * More natural language instead of a slash (commons-app#3318) * Remove unnecessary space before colon (commons-app#3317) * Localisation updates from https://translatewiki.net. * Localisation updates from https://translatewiki.net. * Versioning for v2.12.1 * Update changelog.md * Localisation updates from https://translatewiki.net. * CategoryItem: add javadocs to the file (commons-app#3332) * Change tempalte character case from EXIF to Exif (commons-app#3330) * Fixes commons-app#3335 (commons-app#3337) Handled sqlitexception for adding existig column in app versions which already have COLUMN location_pic * Issue 3236: Change nearby search text to white (commons-app#3331) * Clear parent from customView if parent is not null * Apply white search bar theme to nearby search * Undo changes from bad merge * Fix up tag formatting * Versioning for v2.12.2 * Update changelog.md * Localisation updates from https://translatewiki.net. * Fixes commons-app#3320 (commons-app#3349) * Fixes commons-app#3320 * Added SSL certificate for commons beta * Asked OKHTTP client to use SSLContext from beta certificate * Probable Fix of commons-app#3345 * Use ConfigUtils to verify flavor * Fixes commons-app#3345 (commons-app#3350) * Fixes commons-app#3345 * Trust all hosts for beta * Added a custom NetworkFetcger for Fresco when on beta * removed unused assets * make TestCommonsApplication extend Application instead of Commons Application * Fixes commons-app#3336 Hotfix: Coordinates of picture are not uploaded (commons-app#3339) * Fixes commons-app#3336 * Donot redact locatio by default * Correction inn default tag save * Use same key across application for managedExifTags * Updated key name to avoid class cast in existing build * Localisation updates from https://translatewiki.net. * Fixes commons-app#3327: Trim whitespaces from title on upload (commons-app#3348) Trim WhiteSpaces from Image-Title while upload * Fixes: commons-app#3343 TextUtils.isEmpty creates problems when unit testing with Mockito (commons-app#3344) * TextUtils: add mock textUtils for tests * TextUtils: add more methods to mock for testing * UploadControllerTest: fix the test resulting travis ci to fail * Fixes: commons-app#3278: Add java docs to methods which have it missing (commons-app#3351) * achievements/: add Javadocs * actions/: add Javadocs * WikiAccountAuthenticator: add Javadocs * ReasonBuilder: add Javadocs * di: Add javadocs to DI files * bookmarks: add Javadocs to bookmarks files * di: Added more Javadocs * file: add Javadocs for file picker * actions: add proper decription to the classes * Fixes: commons-app#3179 Make category search non case-sensitive (commons-app#3326) * CategoryClient: fix category search case-sensitivity by converting to lower case as MW api is inherently case-sensitive, the results obtained will be same * CategoryItem: reverting javadoc changes * CategoriesModel: make category search case-insensitive * CategoryItem: fix whitespaces * Add tests for case-insensitivity * CategoryClientTest: add more test cases * CategoryClientTest: fix travis ci test * CategoriesModelTest: changes mage to CategoriesModel and tested * Suggest and auto fill title and description based on image location (commons-app#3323) * Suggest and auto fill title and description based on image location * with java docs * Versioning for v2.12.3 * Update changelog.md * Localisation updates from https://translatewiki.net. * Fix: Issue commons-app#3367 Bug: SoftKeyboard showing even after switching from nearby tab to contribution tab (commons-app#3368) Hide keyboard when switched back from NearbyFragment to ContributionsListFragment * Localisation updates from https://translatewiki.net. * Adds a Test for Method A categories search (commons-app#3366) * CategoriesModelTest: add methodA test for categories search * CategoriesModelTest: use lateinit wherever possible * CategoriesModelTest: make method name meaningful * Fixes commons-app#3303 (commons-app#3322) * Fixes commons-app#3303 * Refactor Nearby to alig lifecycle methods * Pass updated place list to listfragment * Added default zoom rate to mapbox * Removed NearbyListFragmet and added the ui login to handle the same in NearbyParentFragment * More code refactor * Make BottomSheetList hideable * onFragmentHide, hide the bottom sheets * BigFix, Fragmet visibility, register/un-register camera move based on fragments lifecycke * More code refactor * Let the ExecutorUtil have non-ui thread * Add Location Marker on non-ui thread (the non-ui stuffs) * BugFixes * Removed configchanges "orientation" from MainActivity in Manifest (That was messing with the fragment lifecycle) * Some null checks * Initialise lastknown location in onMapReady * UI Fixes * Adjusted UI to support dark and no-dark themes both (in nearby) * Do not update map on Location Slightly changed * Fix failing test case, let TestCommonsApplication extend Application instead of CommonsApplication * start map view when nearby is visible * start the map when NearbyFragmet is visible * More bugfixes * Added DUMMY view for NearbyPresenter's onDetach State * Added a wrapper frame layout parent for MapView to preven it from drawing above other views * More bugfixes (Fixes commons-app#3287) * Gray out the un-selected markers from the nearby filter list * BugFix, search this area should search the nearby places for the current camera position * More BugFixes * Handle null primitives with proxy * Current location marker flow via permission flow * onCameraMove should have null-check on NearbyController.latestSearchLocation instead of currentLocation * Search for places around last focus location * Handle location updates * If the user is browsing the map, donot update the map with current location * Fixes commons-app#3371 (commons-app#3372) * Is UserBrowsing should first check if last known location is non-null before checkig if last location and current locations are close * Localisation updates from https://translatewiki.net. * Fixes commons-app#3382 Fixed Notification Message Icon Background (commons-app#3383) * changing background color of conditions in nearby as uniform (according to chip state) (commons-app#3365) Signed-off-by: Mudit Jain <ciphereck@gmail.com> * Fixes commons-app#3392 Fixed Nearby List Item Icon's Background (commons-app#3393) * Hide Review for logged out users (commons-app#3390) It makes sense to not show the review activity for logged out users for the same reasons that we don't allow users to upload images. We're even considering to limit the review activity to users with a particular level of achievement[1]. So, it's valid to not show review activity for logged out users who don't have achievements levels at all. [1]: commons-app#2852 * Localisation updates from https://translatewiki.net. * Fix commons-app#3191 Make the username along with the rewards icon clickable in the Navigation Drawer (commons-app#3401) * Don't show the quiz pop-up twice (commons-app#3398) * Avoid showing the quiz pop-up twice to the user Due to the current flow of code it's possible that in some cases the quiz pop-up is shown to the user twice. This is unnecessary and unintentional. So, change the logic in such a way that the quiz pop-up would be never be shown twice to the user. Fixes: commons-app#3281 * Quiz: remove unused parameters from methods Some methods don't seem to be using the parameters that they receive. So, just remove the unused parameters. * Fixed minor Login Bug (commons-app#3373) * Fixes commons-app#3197 Replace hardcoded dimensions with dimen resource values (commons-app#3402) * Localisation updates from https://translatewiki.net. * Fixes commons-app#3403 Add padding between privacy policy button and bottom of the screen (commons-app#3404) Fixes commons-app#3403 Add padding between privacy policy button and bottom of the screen * code-quality: remove CDATA and <u> tags from string.xml (commons-app#3310) Remove CDATA and <u> tags from string resources. Instead use setUnderlinedText() method added in Utils to create underlined string resources. * fix typo commons-app#3417 (commons-app#3418) * Localisation updates from https://translatewiki.net. * Fixes commons-app#3355 : Do not display pins at all when "Needs Photo" is selected (commons-app#3407) * ic_custom_greyed_out_marker: removing grey marker * NearbyParentFragment: changing function name and description * change method name to hideAllMarkers * Localisation updates from https://translatewiki.net. * Fix commons-app#3416 Add snackbar on clicking add/remove from bookmarks (commons-app#3419) * Added progress dialog for setting wallpaper (commons-app#3427) * Added progress dialog for setting wallpaper * Updated dialog strings * Localisation updates from https://translatewiki.net. * Fixed a type in NearbyParentFragment.java where significantly was written instead of slightly while adding a log using Timber (commons-app#3432) * Fixes commons-app#814 Added App Shortcuts (commons-app#3381) * Fixes commons-app#814 Added App Shortcuts * removed Review app shortcut * Added Adaptive icons * Localisation updates from https://translatewiki.net. * Replace functions in FileUtilsTest with ones from kotlin-stdlib (commons-app#2943) * Fix commons-app#3091: Remove odd code in CategoryImagesListFragment (commons-app#3133) * Moved some Java files to kotlin (commons-app#3439) * Converted NetworkConnectionType.java to Kotlin * Converted Urls.java to Kotlin and Updated AboutActivity * Improved code quality * Open external links in same activity (commons-app#3395) It's common for users to expect that re-opening the app would allow them to "continue where they left off". This also applies for the case where they leave the app after opening an external link. It's natural for them to expect that they would see the webpage they left open when they re-open the app. This doesn't happen for our app as we open custom tabs in a separate activity. As a consequence, this makes the experience un-intuitive. Fix this by opening custom tabs in the same activity. Fixes: commons-app#2944 Co-authored-by: Adam Jones <jones_adam@rocketmail.com> * Update mapbox, gradle and android plugin versions (commons-app#3443) * Localisation updates from https://translatewiki.net. * Fix existing Espresso tests (commons-app#3450) * Fix existing Espresso tests * Convert class to kotlin * Added Support for System Wide Dark Theme (commons-app#3460) * Added Support for System Wide Dark Theme * changed methods to private * Moved Strings to strings.xml * Used Dagger to reduce code repetition * Changes made as per review suggestions * Minor Changes * Fixes as per suggestions * Minor Fixes as per suggestion * made the variables static * removed irrelevant code * Localisation updates from https://translatewiki.net. * commons-app#3469 Update Gradle Play Publisher to resolve issues with travis build (commons-app#3470) * commons-app#3469 Update Gradle Play Publisher to resolve issues with travis build - update GPP/Gradle and use jacoco-android fork with gradle 6.0 support * commons-app#3469 Update Gradle Play Publisher to resolve issues with travis build - remove extraneous space * Comment out application id from default config * About page: Update logos (commons-app#3472) * Fixes commons-app#3295: Ultimate achievement: Too many contributions (commons-app#3378) * commons-app#3476 Use individual test commands on CI instead of check (commons-app#3477) * commons-app#3476 Use individual test commands on CI instead of check - use individual commands and narrow scope * commons-app#3476 Use individual test commands on CI instead of check - fix indentation * Localisation updates from https://translatewiki.net. * Fixes commons-app#3414: For v2.13, Handle zoom in media details view (commons-app#3422) * MediaDetailFragment: add zoom feature * fragment_media_detail: add SimpleDrawee for Scroll picture * ZoomableActivity: activity which facilitates zoom in * activity_zoomable: xml for zoom activity * zoomControllers: controllers for handling gesture and zooming * MediaDetailFragment: fixing name of image variable * MediaDetailFragment: display as per the aspect ratio of image * add zoom activity to AndroidManifest * fix travis ci faliure * fix resizing of image * Shift contributions to use Room DB (commons-app#3324) * Part of commons-app#3127 * Added Room Dependency * Shifted ContributionsDao to use RoomDB * Save and Fetch contributions via RoomDAO * Bugfixes, fixed test cases, injected schedulers for ContributionsPresenter * removed stetho * Fixed ReviewHelperTest cases * Fixed test cases in DeleteHelperTest * Fetch all contributions [TODO add pagination to use this, maybe later in a seperate PR] * Update Schema false in AppDatabase * removed parameter from fetchControbutions * Added logs for fetch contributions * Fixed test case ContributionsPresenter * Added an autogenerate primary key, submit save contributions on executor * fixed getItemAtPosition * MainActivity Config changes +=orientation * BugFixes * Make AppDataBase Singleton * Set _id as autogenerate primary key [replacing the previously used filename, seems like they are not unique] * Replace Execxutor Utils with Subscribers on Singles in UploadService * BugFix, Upload Progress * Remove un-nescessary null check on contributions in ContributionsListAdapter * removed ContributionsListFragment [not-implemeted] * Review suggested changes * removed un-nescessary null checks * provide ContributionsDao * Minor bug fixes * wip * delete existing contributions table (from the existing db) on upgrade * remove un-nescessary null checks in test classes * shifted media to be a local variable in ReviewHelperTest * removed captured folder * Dispose composite disposables in UploadService * replaced size check with isEmpty ContributionsPresenter * transform saveContributions to a Completable * Addressed comments in review * Typo in Contributions * ReasonBuilderTest (create media object instead of mocking) * Use global Gson object instead of creating a new one in Converters * Provide Gson to Converters from the CommonsApplicationComponent * use static method instead of field instead of static field to provide GSON in Converters * Modified gitignore to exclude captures/* * [WIP] Implemented Espresso tests for upload with multilingual descriptions (commons-app#2830) * With more upload tests * Fix tests * Fix tests * openStreetMap attribution enabled (commons-app#3485) * commons-app#3445 Add codestyle to git - import google java code style, use predefined styles for kotlin/xml (commons-app#3486) * commons-app#3488 Delete app/prod folder - deleted (commons-app#3489) * Added AboutActivityTest (commons-app#3475) * Added AboutActivityTest * Changes made as per suggestions * Removed File to resolve conflict * Removed hardcoded packagename * Changes as per suggestion * Removed Unrelated changes * Fixed Build Issues * Localisation updates from https://translatewiki.net. * commons-app#3493 App freezes for 15 seconds when you press Next in UploadMediaDetailsFragment (commons-app#3499) * commons-app#3493 App freezes for 15 seconds when you press Next in UploadMediaDetailsFragment - add apropriate schedulers and convert justs to fromCallable * commons-app#3493 App freezes for 15 seconds when you press Next in UploadMediaDetailsFragment - remove test for removed functionality * commons-app#3493 App freezes for 15 seconds when you press Next in UploadMediaDetailsFragment - replace kotlin with java * Revert stopgaps related to beta server cert issue (commons-app#3396) * Revert stopgaps related to beta server cert issue The upstream issue with Commons beta server has been fixed now[1]. So, there's no point in stopgapping the issue anymore. So, revert the related changes. This reverts fa87eb5 and df426f7 which correspond to PRs commons-app#3350 and commons-app#3349 respectively. [1]: https://phabricator.wikimedia.org/T243881#5861983 * Test-fix: fix the failing CI test * Chek if getContext() is instanceOf CategoryImagesCallback and only then request more images * commons-app#3471 Remove android.enableUnitTestBinaryResources - remove line (commons-app#3478) * Change item background according to the theme (commons-app#3480) * Change item background according to the theme * Change background colour of item on being selected * Change background colors using XML selectors * solved crashing problem in nomination button (commons-app#3522) solved crashing problem in nomination button solved crashing problem in nomination button * author not shown bug (commons-app#3525) * Localisation updates from https://translatewiki.net. * Fixes commons-app#2238 scalebar added in map (commons-app#3511) * scalebar added in map * changes reverted in .idea/Project.xml * magic numbers replaced with constants for scalebar * Default setting for scaling unit * Default setting for scalebar refresh interval * Reformatted code for adding scalebar * dimen values for scalebar params * Fix p18 issue For an item with P18 item, do not add another one (commons-app#3527) * Add p18value variable to contrib * set place.pic to candidate contribution * Add p18 value to contrib * Passes p18 value to wikidata upload service * Checks if pic parameter of the wikidata item is empty or not. If not, it does not overrides the existing image, it is just a regular commons upload. * Make public var private * Make current tests pass * Add test case for p18 value is not empty * Fix wrong log message * Add nonnul annotation and fix method javadoc * commons-app#3524 Convert SpinnerLanguagesAdapter to kotlin - converted to kotlin (commons-app#3528) * commons-app#3524 Convert SpinnerLanguagesAdapter to kotlin - converted to kotlin * commons-app#3524 Convert SpinnerLanguagesAdapter to kotlin - add KDoc - rework logic - format * Fixes commons-app#3464, App posts deletion request notifications ({{subst:idw}}) on the wrong user's talk page (commons-app#3495) * Fixed commons-app#3464: App posts deletion request notifications ({{subst:idw}}) on the wrong user's talk page * Fixed DeleteHelperTest.kt * Fixed DeleteHelper tests and null-pointer exception * Modified DeleteHelper makeDeletion() test * Reverted unintentionally modified Project.xml * Raising exception when nominating for deletion with empty creator name * Fixed code style * Fixed code style * Fixes commons-app#3465 Use AndroidX Pref (commons-app#3521) * [WIP] Fixes commons-app#3465 Use AndroidX Pref * Deleted Unused Files * Added singleLineTitle * Updated Gradle Properties * Migrated to Androidx * Inline Variable change * optimise imports * Fixed Crash on empty input * Add a dialog to prompt user if location is off in Nearby when L… (commons-app#3438) * Fixes commons-app#3359 Duplicate Photos in Contributions Page (commons-app#3515) * Fixes commons-app#3359 * Cache thumb url & imageUrl in local db * Use Fresco's ImageRequest to show images in ContributionViewHolder[this was the issue, we should have always used this to show the image] * Deleted DisplayableContribution (not needed anymore) * Exposed abstract function in ContributionDao to updateContribution * * Make position private in ContributionViewHolder * Remove MediaDataExtractor from ContributionsFragment * * Show placeholder image for Contributions while the image loads * setHasStableId's ContributionsAdapter * make Random variable private in ContributionViewHolder * replace local variable-if-with ternary operator in ContributionViewHolder * Fix indentation/formatting of ternary operator in ContributionViewHolder * I might revert this commit[I have reasons] * Create in-memory drawables in CVH's onBind, caches are bad, add mental overhead * Revert "I might revert this commit[I have reasons]" This reverts commit 627ac91. * minor formatting changes, reverted 627ac91 * uh-oh missed semicolon, java * minor formatting changes * Fixes 3536 (commons-app#3537) * Removed the focus change listener of the username edittext (commons-app#3538) * Modify PR template (commons-app#3548) * Localisation updates from https://translatewiki.net. * Issue commons-app#3428: Swapped text in dialog buttons (commons-app#3496) * Issue commons-app#3428: Swapped text in dialog buttons because, according to Android Convention, they were opposite each other * Fixed Issue commons-app#3428 so it actually works correctly now: Swapped text in dialog buttons because, according to Android Convention, they were opposite each other * Made sure that all of the places where the two types of showAlertDialog accurately match up with the new position of positive and negative text on the dialog box Also removed occurences of empty lambda expressions and used null instead * modified deletThisPicture to be accurate lambda call * reverted mistake where ellipses replaced the three dots * commons-app#3532 Issue with gitignore - synchronise section with default plugin state (commons-app#3535) * Fixes commons-app#3473 Changed Names and Order or Theme Options (commons-app#3556) * commons-app#3408 Refactoring the FileProcessor and GPSExtractor classes (commons-app#3543) * commons-app#3408 Refactoring the FileProcessor and GPSExtractor classes - refactor FileProcessor * commons-app#3408 Refactoring the FileProcessor and GPSExtractor classes - refactor and rename GpsExtractor * commons-app#3408 Refactoring the FileProcessor and GPSExtractor classes - convert ImageCoordinates to kotlin * commons-app#3408 Refactoring the FileProcessor and GPSExtractor classes - convert FileProcessor to kotlin * commons-app#3408 Refactoring the FileProcessor and GPSExtractor classes - minor reformatting * commons-app#3408 Refactoring the FileProcessor and GPSExtractor classes - fix compilation and naming issues * commons-app#3408 Refactoring the FileProcessor and GPSExtractor classes - remove empty test * commons-app#3408 Refactoring the FileProcessor and GPSExtractor classes - set coordinates for upload item if user chooses it * Change "Archived" notifications to "Read" notifications (commons-app#3554) * Change archived to read * Change string names * Fix hardcoded string in similar image dialog (commons-app#3563) Fixes commons-app#3557 * Change BiMap to HashMap (commons-app#3572) * Change BiMap to HashMap * Change containsKey to containsValue and delete BiMap.java * Localisation updates from https://translatewiki.net. * PULL_REQUEST_TEMPLATE: request only issue number (commons-app#3545) For some time now, GitHub is showing cards when we hover over an issue number which gives us a quick summary of the issue. The issue title is shown in the card among other things. Given that and the fact that we already require the issue number to be specified in the pull request description, it's now moot to ask the contributors to include the issue title in the pull request description. So, let's remove this unnecessary burden from them. * Fix title/desc not getting filled for nearby picture (commons-app#3577) * Wiki itemname displaying in toast (commons-app#3569) * Wiki itemname displaying in toast * Wikidata label displaying in toast * Wikidata label displaying in toast * wikiItemName added to parcelable methods * Wikidata label displayed in toast * Wikidata label displayed in toast * commons-app#3579 p18Value causes NPE in WikidataEditService createClaimWithLogging - add null check (commons-app#3580) * Fixes commons-app#3494 (commons-app#3519) * better names for the upload warning dialog buttons commons-app#3494 * Dialog button pt2 * dialog buttons pt3 * round 4.. Co-authored-by: Hdot <a.hudaa@hotmail.com> * Fix auto zoom issue commons-app#3391 Zoom level gets reset at every second. (commons-app#3564) * Add method to check if curr location marker is vsible or not * Recenter map if users see their current location marker * Add new methods to Contract * Localisation updates from https://translatewiki.net. * PULL_REQUEST_TEMPLATE: clarify that issue number needs to be replaced (commons-app#3599) Some contributors seem to be missing the fact that they have to mention the issue number right after `Fixes ` to ensure the corresponding issue gets closed[1] when the PR gets merged. Clarify this by using a better phrase that clearly states that they have to replace the placeholder text with the issue number. [1]: https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword * swipe away failed notification (commons-app#3598) * issue-commons-app#3567: logos in about activity visible (commons-app#3592) * Fixes commons-app#3479: Implement Progress Bar for Zoom Activity (commons-app#3481) * ZoomableActivity: add hierarchy to view for displaying progress bar * CircularProgressBar: circular progress bar for ZoomableDraweeView * ZoomableActivity: add indeterministic loading spinner * activity_zoomable: add inderterministic Progressbar * remove circular progressbar and make changes to controller listener * Fixes commons-app#3575 (commons-app#3602) * Donot show random colors as placeholders for contributions items * Theme contributionsItem background as mainBackground from attributes * Fixes commons-app#3611 (commons-app#3613) * Properly generate Parcealables for Media & Contribution * issue-commons-app#3606: cancel in translate goes back to about screen (commons-app#3610) * Localisation updates from https://translatewiki.net. * Fixed issue commons-app#3195 ordering contribution list (commons-app#3589) * issue-commons-app#3195: order contribution list refactored * issue-commons-app#3195: ordered contribution list * exit app on back pressed in tutorial (commons-app#3597) * exit app on back pressed in tutorial * exit app from ongoing tutorial * exit app on back press in tutorial * Fixes commons-app#3466 No crash information in crash email (Gmail) (commons-app#3605) * Send ACRA logs as file instead * no need to set it true, default is true * Fixed issue commons-app#3195 ordering contribution list (commons-app#3589) * issue-commons-app#3195: order contribution list refactored * issue-commons-app#3195: ordered contribution list * Update wiki page links (commons-app#3608) We've moved the documentation to a separate repo. So, change the old links to point to the corresponding places in the documentation repo. * Fixes commons-app#3506: Image height remains zero for some time on bad network (commons-app#3513) * optimise width loading * amending as per the reviews * aspect ratio updates after layout completion * MediaDetailFragment: update aspect ratio using onGlobalLayoutListener * remove unnecessary imports * commons-app#3492 Add inspections to git - add inspection profile (commons-app#3631) * commons-app#3628 Update Gradle Plugin - bump version (commons-app#3629) * commons-app#3624 DateTimeFormat wrong - match pattern returned from servers (commons-app#3625) * Localisation updates from https://translatewiki.net. * Localisation updates from https://translatewiki.net. * Copy place name on long click (commons-app#3609) * Copy place name on long click * Remove hard coded string * Fixed logout problem commons-app#3547 (commons-app#3649) * fixed logout problem fixed logout problem fixed logout problem fixed logout problem fixed logout problem * added error handling on logout * Fast scroll issue fixed (commons-app#3593) * fast scroll fixed in explore activity * fast scroll fixed in explore activity * fast scroll issue in explore * fastscroll removed from explore * Converted DialogUtil to Kotlin (commons-app#3621) * Converted DialogUtil to Kotlin * Kotlin syntax and standard changes * Removed ; * Added missing null * Added missing null * Removed unnecessary code * Reduced functions * added let to customView * reverted "let" changes * reverted "let" changes * removed if-statements * replaced with "it" * fixed overflow error * Function rename * Used named arguments * Fix Typo * single lined * Update DialogUtil.kt * changed default value * ReviewController: remove call to review category notif builder while sending thanks (commons-app#3655) * With data-client added as library module (commons-app#3656) * With data-client added as library module * Fix build * Fixed username visible after logout bug (commons-app#3648) * Localisation updates from https://translatewiki.net. * commons-app#3630 [Library Discussion] Core-ktx (commons-app#3660) * Convert download code to kotlin (commons-app#3665) * Remove unused constructor (commons-app#3668) * commons-app#3658 Throw exception instead of allowing nullable network models onError - peek response body and throw error (commons-app#3659) * commons-app#3658 Throw exception instead of allowing nullable network models onError - peek response body and throw error * commons-app#3658 Throw exception instead of allowing nullable network models onError - allow for more general error response catching * Address code review comments (commons-app#3669) * Fixes commons-app#3436 and commons-app#2881: Media Detail design Overhaul (commons-app#3505) * ic_map_dark_24dp: map icon for white background * ic_info_outline_dark_24dp: info icon for dark background * MediaDetailFragment: update the spacer as per image aspect ratio * fragment_media_detail: design overhaul * fragment_media_detail: remove redundant background color statements * make requested changes * add dark mode support * minor ui tweak * white map icon in dark mode * make rquested changes * make requested changes to layout * fix misalignment of category list * subtle amendments * convert comments to javadocs * minor amendments * minor changes * add styles for media detail * Media detail fragment refactored * make suggested changes * minor name fix * fix the delete button border Co-authored-by: Josephine Lim <josephinelim86@gmail.com> Co-authored-by: Manuel Alcaraz <47950933+m-alzam@users.noreply.github.com> Co-authored-by: translatewiki.net <l10n-bot@translatewiki.net> Co-authored-by: neslihanturan <tur.neslihan@gmail.com> Co-authored-by: Zoran Dori <zorandori4444@gmail.com> Co-authored-by: ANKIT <bhardwajankit1414@gmail.com> Co-authored-by: Ashish Kumar <ashishkumar468@gmail.com> Co-authored-by: Amir E. Aharoni <amir.aharoni@mail.huji.ac.il> Co-authored-by: Kshitij Bhardwaj <44129798+kbhardwaj123@users.noreply.github.com> Co-authored-by: Malcolm Smith <malcolmsmith18@gmail.com> Co-authored-by: Alicia <12453997+albendz@users.noreply.github.com> Co-authored-by: Somanshu <somanshS14@gmail.com> Co-authored-by: animeshk08 <32506591+animeshk08@users.noreply.github.com> Co-authored-by: Madhur Gupta <30932899+madhurgupta10@users.noreply.github.com> Co-authored-by: Mudit Jain <ciphereck@gmail.com> Co-authored-by: Kaartic Sivaraam <kaartic.sn@zohocorp.com> Co-authored-by: Yash Khare <yashsja@gmail.com> Co-authored-by: Aastha Bist <abist119@gmail.com> Co-authored-by: gouri-panda <gouripanda4@gmail.com> Co-authored-by: Aryan Tyagi <aryantyagiofficial@gmail.com> Co-authored-by: Veyndan Stuart <veyndan@gmail.com> Co-authored-by: Aristos Pasalidis <33037826+rtsketo@users.noreply.github.com> Co-authored-by: Adam Jones <jones_adam@rocketmail.com> Co-authored-by: Seán Mac Gillicuddy <seantheappdev@gmail.com> Co-authored-by: Anmol Gupta <44764339+6point022@users.noreply.github.com> Co-authored-by: taakanksha <37452934+aakankshaa23@users.noreply.github.com> Co-authored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com> Co-authored-by: 318anushka <45694892+318anushka@users.noreply.github.com> Co-authored-by: Vitaly V. Pinchuk <vetal.978@gmail.com> Co-authored-by: Fawziyah Alebiosu <fawziyah.alebiosu@gmail.com> Co-authored-by: hudlerr <ha241@student.le.ac.uk> Co-authored-by: Hdot <a.hudaa@hotmail.com> Co-authored-by: Prince Amankwah <iprins88@yahoo.com> Co-authored-by: Prince Amankwah <pramankwah@gmail.com>
Description (required)
This PR adds a dialog box that will prompt the user if the location is off while using the Nearby map. The location state is checked each time the user clicks on the Locate me button.
Fixes #3397: "Locate me" icon in Nearby doesn't prompt user to enable GPS
Why do this?
Previously, when the user pressed the Locate me button, they were not prompted to turn on location in case it was off. This can confuse the user while using Nearby.
What changed did you make?
Please refer to the opening comment of issue #3397 for a complete description of how it has been implemented along with some code to help explain it's working.
You can also refer to this #3397 (comment) to see a working demonstration of the change.
Tests performed
Tested prodDebug on Redmi Note 5 Pro with API level 28.
Screenshots showing what changed