-
-
Save albodelu/efb96622b335ead2ed887c1125d502ca to your computer and use it in GitHub Desktop.
inline, reified, infix
This file contains hidden or 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