Created
October 26, 2017 06:03
-
-
Save Wavesonics/76c7bd278969a8f9980d4a66aa81e5a6 to your computer and use it in GitHub Desktop.
My extra injector (just for String type so far)
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
class IntentExtraString | |
{ | |
operator fun getValue(activity: Activity, property: KProperty<*>): String = | |
activity.intent.getStringExtra(property.name) | |
operator fun setValue(activity: Activity, property: KProperty<*>, value: String) | |
{ | |
activity.intent.putExtra(property.name, value) | |
} | |
} |
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
class ClientOrHostActivity : BaseGameActivity(), GameInterface | |
{ | |
private val m_userName: String by IntentExtraString() | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment