|
@@ -319,7 +319,11 @@ class LocationPickerActivity :
|
|
|
|
|
|
binding.centerMapButton.setOnClickListener {
|
|
binding.centerMapButton.setOnClickListener {
|
|
if (myLocation.latitude == COORDINATE_ZERO && myLocation.longitude == COORDINATE_ZERO) {
|
|
if (myLocation.latitude == COORDINATE_ZERO && myLocation.longitude == COORDINATE_ZERO) {
|
|
- Snackbar.make(binding.root, context.getString(R.string.nc_location_unknown), Snackbar.LENGTH_LONG).show()
|
|
|
|
|
|
+ Snackbar.make(
|
|
|
|
+ binding.root,
|
|
|
|
+ context.getString(R.string.nc_location_unknown),
|
|
|
|
+ Snackbar.LENGTH_LONG
|
|
|
|
+ ).show()
|
|
} else {
|
|
} else {
|
|
mapController.animateTo(myLocation)
|
|
mapController.animateTo(myLocation)
|
|
moveToCurrentLocation = true
|
|
moveToCurrentLocation = true
|
|
@@ -341,11 +345,13 @@ class LocationPickerActivity :
|
|
setLocationDescription(isGpsLocation = true, isGeocodedResult = false)
|
|
setLocationDescription(isGpsLocation = true, isGeocodedResult = false)
|
|
moveToCurrentLocation = false
|
|
moveToCurrentLocation = false
|
|
}
|
|
}
|
|
|
|
+
|
|
geocodingResult != null -> {
|
|
geocodingResult != null -> {
|
|
binding.shareLocation.isClickable = true
|
|
binding.shareLocation.isClickable = true
|
|
setLocationDescription(isGpsLocation = false, isGeocodedResult = true)
|
|
setLocationDescription(isGpsLocation = false, isGeocodedResult = true)
|
|
geocodingResult = null
|
|
geocodingResult = null
|
|
}
|
|
}
|
|
|
|
+
|
|
else -> {
|
|
else -> {
|
|
binding.shareLocation.isClickable = true
|
|
binding.shareLocation.isClickable = true
|
|
setLocationDescription(isGpsLocation = false, isGeocodedResult = false)
|
|
setLocationDescription(isGpsLocation = false, isGeocodedResult = false)
|
|
@@ -377,6 +383,7 @@ class LocationPickerActivity :
|
|
this
|
|
this
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
+
|
|
locationManager!!.isProviderEnabled(LocationManager.GPS_PROVIDER) -> {
|
|
locationManager!!.isProviderEnabled(LocationManager.GPS_PROVIDER) -> {
|
|
locationManager!!.requestLocationUpdates(
|
|
locationManager!!.requestLocationUpdates(
|
|
LocationManager.GPS_PROVIDER,
|
|
LocationManager.GPS_PROVIDER,
|
|
@@ -386,6 +393,7 @@ class LocationPickerActivity :
|
|
)
|
|
)
|
|
Log.d(TAG, "LocationManager.NETWORK_PROVIDER falling back to LocationManager.GPS_PROVIDER")
|
|
Log.d(TAG, "LocationManager.NETWORK_PROVIDER falling back to LocationManager.GPS_PROVIDER")
|
|
}
|
|
}
|
|
|
|
+
|
|
else -> {
|
|
else -> {
|
|
Log.e(
|
|
Log.e(
|
|
TAG,
|
|
TAG,
|
|
@@ -413,11 +421,13 @@ class LocationPickerActivity :
|
|
binding.placeName.visibility = View.GONE
|
|
binding.placeName.visibility = View.GONE
|
|
binding.placeName.text = ""
|
|
binding.placeName.text = ""
|
|
}
|
|
}
|
|
|
|
+
|
|
isGeocodedResult -> {
|
|
isGeocodedResult -> {
|
|
binding.shareLocationDescription.text = context!!.getText(R.string.nc_share_this_location)
|
|
binding.shareLocationDescription.text = context!!.getText(R.string.nc_share_this_location)
|
|
binding.placeName.visibility = View.VISIBLE
|
|
binding.placeName.visibility = View.VISIBLE
|
|
binding.placeName.text = geocodingResult?.displayName
|
|
binding.placeName.text = geocodingResult?.displayName
|
|
}
|
|
}
|
|
|
|
+
|
|
else -> {
|
|
else -> {
|
|
binding.shareLocationDescription.text = context!!.getText(R.string.nc_share_this_location)
|
|
binding.shareLocationDescription.text = context!!.getText(R.string.nc_share_this_location)
|
|
binding.placeName.visibility = View.GONE
|
|
binding.placeName.visibility = View.GONE
|
|
@@ -531,8 +541,11 @@ class LocationPickerActivity :
|
|
if (requestCode == REQUEST_PERMISSIONS_REQUEST_CODE && areAllGranted(grantResults)) {
|
|
if (requestCode == REQUEST_PERMISSIONS_REQUEST_CODE && areAllGranted(grantResults)) {
|
|
initMap()
|
|
initMap()
|
|
} else {
|
|
} else {
|
|
- Snackbar.make(binding.root, context!!.getString(R.string.nc_location_permission_required), Snackbar.LENGTH_LONG)
|
|
|
|
- .show()
|
|
|
|
|
|
+ Snackbar.make(
|
|
|
|
+ binding.root,
|
|
|
|
+ context!!.getString(R.string.nc_location_permission_required),
|
|
|
|
+ Snackbar.LENGTH_LONG
|
|
|
|
+ ).show()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|