Created
April 24, 2017 20:31
-
-
Save Atternatt/4f8ead0413a80908203a05d221298515 to your computer and use it in GitHub Desktop.
inline, reified, infix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <reified NewActivity : Activity> Activity.start(bundle: Bundle? = null) { | |
val intent: Intent = Intent(this, NewActivity::class.java) | |
bundle?.let { intent.putExtras(it) } | |
this.startActivity(intent) | |
} | |
startActivity<MainActivity>() | |
infix fun <Value>Boolean.then(block: () -> Value) { | |
if (this) { | |
block() | |
} | |
} | |
BuildConfig.DEBUG then { | |
Stetho.initializeWithDefaults(this) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment