add website to the View screen

This commit is contained in:
tibbi
2018-04-13 12:14:26 +02:00
parent 5b55467691
commit 54df14442d
5 changed files with 78 additions and 6 deletions

View File

@ -68,11 +68,23 @@ fun Context.sendAddressIntent(address: String) {
val location = Uri.encode(address)
val uri = Uri.parse("geo:0,0?q=$location")
val intent = Intent(Intent.ACTION_VIEW, uri)
if (intent.resolveActivity(packageManager) != null) {
startActivity(intent)
} else {
toast(R.string.no_app_found)
Intent(Intent.ACTION_VIEW, uri).apply {
if (resolveActivity(packageManager) != null) {
startActivity(this)
} else {
toast(R.string.no_app_found)
}
}
}
fun Context.openWebsiteIntent(url: String) {
Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse(url)
if (resolveActivity(packageManager) != null) {
startActivity(this)
} else {
toast(R.string.no_app_found)
}
}
}