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-03 15:18:20 -0700
committerGitHub <noreply@github.com>2017-08-03 15:18:20 -0700
commitbafc1996d803862d30a2c7d0c402d30c79c4f647 (patch)
tree5456960a330d7890ac43e1193a80f1db670a8b06 /core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
parent84b9d3b40e342dc7715c5af13d102bb98529b0fb (diff)
downloadkau-bafc1996d803862d30a2c7d0c402d30c79c4f647.tar.gz
kau-bafc1996d803862d30a2c7d0c402d30c79c4f647.tar.bz2
kau-bafc1996d803862d30a2c7d0c402d30c79c4f647.zip
3.2.2 - Create faq parser and update sample (#19)3.2.3
* Test emulator * Update readme * Update fastadapter and about listing * Make faq parser asynchronous * Modularize about panels * Add basis for faq * Test and finalize the faq panel * Update readme * Update changelog * Remove emulator for now * Update sample
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.kt9
1 files changed, 7 insertions, 2 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 2219b5d..20cec73 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
@@ -1,3 +1,5 @@
+@file:Suppress("NOTHING_TO_INLINE")
+
package ca.allanwang.kau.utils
import android.annotation.SuppressLint
@@ -89,9 +91,12 @@ fun Context.startLink(vararg url: String?) {
}
//Toast helpers
-fun Context.toast(@StringRes id: Int, duration: Int = Toast.LENGTH_LONG) = toast(this.string(id), duration)
+inline fun View.toast(@StringRes id: Int, duration: Int = Toast.LENGTH_LONG) = context.toast(id, duration)
+
+inline fun Context.toast(@StringRes id: Int, duration: Int = Toast.LENGTH_LONG) = toast(this.string(id), duration)
-fun Context.toast(text: String, duration: Int = Toast.LENGTH_LONG) {
+inline fun View.toast(text: String, duration: Int = Toast.LENGTH_LONG) = context.toast(text, duration)
+inline fun Context.toast(text: String, duration: Int = Toast.LENGTH_LONG) {
Toast.makeText(this, text, duration).show()
}