open coordinates on a map at clicking on Properties dialog
This commit is contained in:
parent
e9757a2ea9
commit
3a5f48cb94
3 changed files with 21 additions and 2 deletions
|
@ -7,7 +7,7 @@ buildscript {
|
|||
propMinSdkVersion = 21
|
||||
propTargetSdkVersion = propCompileSdkVersion
|
||||
propVersionCode = 1
|
||||
propVersionName = '5.25.24'
|
||||
propVersionName = '5.25.25'
|
||||
kotlin_version = '1.3.72'
|
||||
}
|
||||
|
||||
|
|
|
@ -237,11 +237,17 @@ class PropertiesDialog() {
|
|||
property_value.text = value
|
||||
mPropertyView.properties_holder.addView(this)
|
||||
|
||||
property_value.setOnLongClickListener {
|
||||
setOnLongClickListener {
|
||||
mActivity.copyToClipboard(property_value.value)
|
||||
true
|
||||
}
|
||||
|
||||
if (labelId == R.string.gps_coordinates) {
|
||||
setOnClickListener {
|
||||
mActivity.showLocationOnMap(value)
|
||||
}
|
||||
}
|
||||
|
||||
if (viewId != 0) {
|
||||
id = viewId
|
||||
}
|
||||
|
|
|
@ -362,6 +362,19 @@ fun Activity.openPathIntent(path: String, forceChooser: Boolean, applicationId:
|
|||
}
|
||||
}
|
||||
|
||||
fun Activity.showLocationOnMap(coordinates: String) {
|
||||
val uriBegin = "geo:$coordinates"
|
||||
val encodedQuery = Uri.encode(coordinates)
|
||||
val uriString = "$uriBegin?q=$encodedQuery&z=16"
|
||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(uriString))
|
||||
val packageManager = packageManager
|
||||
if (intent.resolveActivity(packageManager) != null) {
|
||||
startActivity(intent)
|
||||
} else {
|
||||
toast(R.string.no_app_found)
|
||||
}
|
||||
}
|
||||
|
||||
fun Activity.getFinalUriFromPath(path: String, applicationId: String): Uri? {
|
||||
val uri = try {
|
||||
ensurePublicUri(path, applicationId)
|
||||
|
|
Loading…
Reference in a new issue