Skip to content

Instantly share code, notes, and snippets.

@Atternatt
Created April 24, 2017 20:31
Show Gist options
  • Save Atternatt/4f8ead0413a80908203a05d221298515 to your computer and use it in GitHub Desktop.
Save Atternatt/4f8ead0413a80908203a05d221298515 to your computer and use it in GitHub Desktop.
inline, reified, infix
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