aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ca
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-02-23 20:53:16 -0500
committerGitHub <noreply@github.com>2018-02-23 20:53:16 -0500
commita7e24f0c6bb1c598735eb902cf8cdff8de5dd1da (patch)
tree98671b65142ea84aac26d455cae1ec1ce99a5cf8 /core/src/main/kotlin/ca
parent3d7c85bd97261116a090a7202b0e0ed2625b5d73 (diff)
downloadkau-a7e24f0c6bb1c598735eb902cf8cdff8de5dd1da.tar.gz
kau-a7e24f0c6bb1c598735eb902cf8cdff8de5dd1da.tar.bz2
kau-a7e24f0c6bb1c598735eb902cf8cdff8de5dd1da.zip
Update/fast adapter (#138)
* Update version and add debug key * Update fast adapter * Add debug separation * Inline functions and remove unused
Diffstat (limited to 'core/src/main/kotlin/ca')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt
index 833ec3a..ab0e59f 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt
@@ -1,3 +1,5 @@
+@file:Suppress("NOTHING_TO_INLINE")
+
package ca.allanwang.kau.utils
import android.annotation.SuppressLint
@@ -74,7 +76,6 @@ inline fun Activity.restart(intentBuilder: Intent.() -> Unit = {}) {
/**
* Force restart an entire application
*/
-@Suppress("NOTHING_TO_INLINE")
@RequiresApi(Build.VERSION_CODES.M)
inline fun Activity.restartApplication() {
val intent = packageManager.getLaunchIntentForPackage(packageName)
@@ -134,10 +135,10 @@ fun Context.setMenuIcons(menu: Menu, @ColorInt color: Int = Color.WHITE, vararg
}
}
-fun Activity.hideKeyboard() = currentFocus.hideKeyboard()
+inline fun Activity.hideKeyboard() = currentFocus.hideKeyboard()
-fun Activity.showKeyboard() = currentFocus.showKeyboard()
+inline fun Activity.showKeyboard() = currentFocus.showKeyboard()
-fun Activity.snackbar(text: String, duration: Int = Snackbar.LENGTH_LONG, builder: Snackbar.() -> Unit = {}) = contentView!!.snackbar(text, duration, builder)
+inline fun Activity.snackbar(text: String, duration: Int = Snackbar.LENGTH_LONG, noinline builder: Snackbar.() -> Unit = {}) = contentView!!.snackbar(text, duration, builder)
-fun Activity.snackbar(@StringRes textId: Int, duration: Int = Snackbar.LENGTH_LONG, builder: Snackbar.() -> Unit = {}) = contentView!!.snackbar(textId, duration, builder) \ No newline at end of file
+inline fun Activity.snackbar(@StringRes textId: Int, duration: Int = Snackbar.LENGTH_LONG, noinline builder: Snackbar.() -> Unit = {}) = contentView!!.snackbar(textId, duration, builder) \ No newline at end of file