File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -110,12 +110,13 @@ class EnterSmsCodeFragment : ReactiveFragment() {
110110``` kotlin
111111val isProgress = state<Boolean >(false )
112112```
113- Изменение значения
113+ Из ViewModel
114114``` kotlin
115115isProgress.consumer.accept(true )
116116isProgress.setValue(true ) // расширение для isProgress.consumer.accept(true)
117117isProgress.setValueIfChanged(true ) // расширение для isProgress.consumer.accept(true) но с проверкой if (lastValue != newValue)
118118```
119+ В View
119120``` kotlin
120121isProgress.observe { value -> }
121122```
@@ -127,11 +128,12 @@ isProgress.observe { value -> }
127128``` kotlin
128129val actionSendSmsCodeAgain = action<Unit >() // or emptyAction() если тип Unit
129130```
130- Использование
131+ Из ViewModel
131132``` kotlin
132133actionSendSmsCodeAgain.consumer.accept(Unit )
133134actionSendSmsCodeAgain.call() // расширение для actionSendSmsCodeAgain.consumer.accept(Unit)
134135```
136+ В View
135137``` kotlin
136138actionSendSmsCodeAgain.bindOnClick(btnSendSmsCode)
137139btnSendSmsCode.setOnClickListener { actionSendSmsCodeAgain.call() }
@@ -144,11 +146,16 @@ btnSendSmsCode.setOnClickListener { actionSendSmsCodeAgain.call() }
144146``` kotlin
145147val eventDone = event<Unit >() // or emptyEvent() если тип Unit
146148```
147- Использование
149+ Из ViewModel
148150``` kotlin
149151eventDone.consumer.accept(Unit )
150152eventDone.call() // расширение для eventDone.consumer.accept(Unit)
151153```
154+ В View
152155``` kotlin
153156eventDone.observe { value -> }
154157```
158+
159+
160+ ## Инфо
161+ Вся либа, надстройка над LiveData. Cвойства(state, event) имею поле ** liveData** для возможности совместного использования с ** DataBinding**
You can’t perform that action at this time.
0 commit comments