Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.56 KB | None | 0 0
  1. inline fun View.extractAttributes(@StyleableRes res: IntArray,
  2.                                   attributeSet: AttributeSet,
  3.                                   block: TypedArray.() -> Unit) {
  4.     context?.extractAttributes(res, attributeSet, block)
  5. }
  6.  
  7.  
  8. inline fun Context.extractAttributes(@StyleableRes res: IntArray,
  9.                                      attributeSet: AttributeSet,
  10.                                      block: TypedArray.() -> Unit) {
  11.     obtainStyledAttributes(attributeSet, res).useAndClose {
  12.         block()
  13.     }                        
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement