Rewrite Map fragment location code to follow user and enable tracking
Summary:
- Add GPL notice to files
- Fix map location enabled
- Show alert when no location is granted
- Receive first location correctly
- Enable the position initally in the MapFragment only when the distance from the center of Turin is < 90 km
- Enable the position initially in the LineDetailsFragment only when the distance from the center of the view is < 20 km
- Create new FusedLocationProvider so that it works in Xiaomi phones, too
- Create permission singleton to cache the number of times we've asked for the location
Fix T1378
Test Plan:
- Open the map screen, check that the position is visible and it is updated
- Open the line screen:
- Check that disabling and enabling the position works
- Check that when the map screens are closed, the app stops using the location
- Check that from far away the position is queried once (or no times) and immediately disabled
- Check that when setting the location permission on "Ask every time" the app actually asks for the location
Reviewers: Libre BusTO hackers, valerio.bozzolan
Reviewed By: Libre BusTO hackers, valerio.bozzolan
Subscribers: valerio.bozzolan
Project Tags: Libre BusTO
Maniphest Tasks: T1378
Differential Revision: https://gitpull.it/D237