Skip to content

Instantly share code, notes, and snippets.

@Wavesonics
Created October 26, 2017 06:03
Show Gist options
  • Save Wavesonics/76c7bd278969a8f9980d4a66aa81e5a6 to your computer and use it in GitHub Desktop.
Save Wavesonics/76c7bd278969a8f9980d4a66aa81e5a6 to your computer and use it in GitHub Desktop.
My extra injector (just for String type so far)
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)
}
}
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