aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-08-12 23:07:10 -0700
committerAllan Wang <me@allanwang.ca>2017-08-30 12:24:19 -0400
commit5c45c832df044c400a76abad16a000a59d0bf54c (patch)
tree5cb6b67321eaecd09b8b5a36839b3bdd2f57d6a7 /core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
parent83f9324184f0cf6ccea29888f3d3e91f95e52971 (diff)
downloadkau-5c45c832df044c400a76abad16a000a59d0bf54c.tar.gz
kau-5c45c832df044c400a76abad16a000a59d0bf54c.tar.bz2
kau-5c45c832df044c400a76abad16a000a59d0bf54c.zip
Add more functions
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
index 20cec73..d561c8a 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
@@ -90,6 +90,11 @@ fun Context.startLink(vararg url: String?) {
startActivity(browserIntent)
}
+fun Context.startLink(@StringRes url: Int) {
+ val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(string(url)))
+ startActivity(browserIntent)
+}
+
//Toast helpers
inline fun View.toast(@StringRes id: Int, duration: Int = Toast.LENGTH_LONG) = context.toast(id, duration)