diff options
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt')
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt | 17 |
1 files changed, 8 insertions, 9 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 3484353..f8643db 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt @@ -31,23 +31,22 @@ annotation class KauActivity inline fun <reified T : Activity> Activity.startActivityForResult( requestCode: Int, bundleBuilder: Bundle.() -> Unit = {}, - intentBuilder: Intent.() -> Unit = {}) { - val intent = Intent(this, T::class.java) - intent.intentBuilder() - val bundle = Bundle() - bundle.bundleBuilder() - startActivityForResult(intent, requestCode, bundle) -} + intentBuilder: Intent.() -> Unit = {} +) = startActivityForResult(T::class.java, requestCode, bundleBuilder, intentBuilder) @Deprecated("Use reified generic instead of passing class", ReplaceWith("startActivityForResult<T>(requestCode, bundleBuilder, intentBuilder)"), DeprecationLevel.WARNING) -inline fun <reified T : Activity> Activity.startActivityForResult( +inline fun <T : Activity> Activity.startActivityForResult( clazz: Class<T>, requestCode: Int, bundleBuilder: Bundle.() -> Unit = {}, intentBuilder: Intent.() -> Unit = {}) { - startActivityForResult<T>(requestCode, bundleBuilder, intentBuilder) + val intent = Intent(this, clazz) + intent.intentBuilder() + val bundle = Bundle() + bundle.bundleBuilder() + startActivityForResult(intent, requestCode, bundle) } /** |