Last active
September 24, 2018 07:33
-
-
Save Lamartio/b3dc52bfaf7e7c6aab3e563c8d82895c to your computer and use it in GitHub Desktop.
Revisions
-
Lamartio revised this gist
Sep 24, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ open class BindableLayout<T, V : ViewGroup>(layout: V) : Layout<V>(layout) { private inner class Observers : ArrayList<Observer<T>>(), Consumer<T> { override fun accept(value: T) = forEach { observer -> observer(value, value) } } -
Lamartio revised this gist
Sep 24, 2018 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,10 +6,11 @@ open class BindableLayout<T, V : ViewGroup>(layout: V) : Layout<V>(layout) { observers.add(observer) } private inner class Observers : ArrayList<Observer<T>>(), Consumer<T> { override fun accept(value: T) = forEach { subscription -> subscription(value, value) } } } -
Lamartio revised this gist
Sep 24, 2018 . 1 changed file with 0 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,4 @@ open class BindableLayout<T, V : ViewGroup>(layout: V) : Layout<V>(layout) { } } -
Lamartio created this gist
Sep 24, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ open class BindableLayout<T, V : ViewGroup>(layout: V) : Layout<V>(layout) { private val observers = Observers() fun bind(observer: Observer<T>) { observers.add(observer) } private inner class Observers : MutableList<Observer<T>> by mutableListOf(), Consumer<T> { override fun accept(value: T) = forEach { subscription -> subscription(value, value) } } /* ... */ }