Skip to content

Commit

Permalink
Update map location icon logic
Browse files Browse the repository at this point in the history
- API 31: Adds ability to change to precise location after approximate location has been enabled.
- API 23-30: Displays location alert dialog if location permission has not been selected.

Issue #127
  • Loading branch information
englehorn committed Jan 21, 2022
1 parent 05dee02 commit 87ef251
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ class TrafficMapFragment : DaggerFragment(), Injectable, OnMapReadyCallback,
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.action_my_location -> {
myLocationFineWithPermissionCheck()
if (activity?.let {
ContextCompat.checkSelfPermission(
it,
Expand All @@ -291,7 +292,14 @@ class TrafficMapFragment : DaggerFragment(), Injectable, OnMapReadyCallback,
myLocationCoarseWithPermissionCheck()
}
}
else -> {}
else -> {
locationPermissionRequest.launch(
arrayOf(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
)
)
}
}
return false
}
Expand Down

0 comments on commit 87ef251

Please sign in to comment.