Skip to content

Instantly share code, notes, and snippets.

@hluhovskyi
Created September 11, 2017 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hluhovskyi/d8d0bf20d4837806413b1008ebd6b5d5 to your computer and use it in GitHub Desktop.
Save hluhovskyi/d8d0bf20d4837806413b1008ebd6b5d5 to your computer and use it in GitHub Desktop.
fun View.string(@StringRes id: Int): ReadOnlyProperty<View, String>
= StringDelegate(contextProvider, id)
fun Activity.string(@StringRes id: Int): ReadOnlyProperty<Activity, String>
= StringDelegate(contextProvider, id)
fun Fragment.string(@StringRes id: Int): ReadOnlyProperty<Fragment, String>
= StringDelegate(contextProvider, id)
private class StringDelegate : ReadOnlyProperty<Any, Stirng>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment