-
Notifications
You must be signed in to change notification settings - Fork 1
MapsFragment
The MapsFragment
class manages the Google Maps API. All the features that need to be added to the map go in this class. Whenever MainActivity executes, it automatically calls getSupportFragmentManager()
which loads the code in this class. When this class is instantiated, onCreateView()
is called. Once the view has been created, the OnMapReadyCallback
callback is performed. The callback handles most of the logic for the map and is where implementations for new features should be written.
Updates the fields currentLat
and currentLong
whenever the user's location is changed.
-
Location location
- User's current location
- none
Calculates the nearest parking lot to the user's current location.
This is done by updating the user's current location, checking that the location is valid, calling calculateNearestLot()
with the user's location, moving the map camera to the marker's location, and then displaying the marker's information window.
- none
-
true
if the user has a valid location -
false
if the user has an invalid location (or if location permissions are denied)
Changes the theme of the map.
-
GoogleMap googleMap
- The current map object
- none
Sets the map bounds.
-
GoogleMap googleMap
- The current map object
- none
Moves the map camera to a specified location.
-
GoogleMap googleMap
- The current map object
-
LatLng coords
- The specified coordinates to move the camera to
- none
Parses the file locations.json
and creates Marker
and MapLocation
objects to be used in the map.
-
GoogleMap googleMap
- The current map object
- none
Calculates the nearest parking lot to the user's marker.
The current implementation of this method still requires a marker object as a parameter, rather than the user's current location.
-
Marker newUserMarker
- The
Marker
object that represents the user's current location.
- The
-
Pair<Integer, Double>
- The integer represents the index of the nearest lot to the user (index ranges from 0-17, representing Lot A1 to Lot F2).
- The double represents the lot with the least distance to the user.
Used to create a new popup within the MapsFragment
. (Deprecated)
-
View popupView
- The
View
object of the popup
- The
-
View view
- The current
View
- The current
- none
Converts a vector xml
or svg
file into a BitmapDescriptor
. This is used to create and use custom markers in the map.
-
Context context
- The current application
Context
- The current application
-
int vectorResId
- The ID number of the vector
BitmapDescriptor