Skip to content

Commit f56ba1e

Browse files
committed
WIPWIPWIP
1 parent 8412a85 commit f56ba1e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

exampleAppJapan/src/main/kotlin/it/trade/android/japanapp/ui/orderinput/OrderInputFragment.kt

+15
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ import android.arch.lifecycle.ViewModelProviders
55
import android.opengl.Visibility
66
import android.os.Bundle
77
import android.support.v4.app.Fragment
8+
import android.text.Editable
9+
import android.text.TextWatcher
810
import android.view.LayoutInflater
911
import android.view.View
1012
import android.view.ViewGroup
13+
import android.widget.EditText
1114
import it.trade.android.japanapp.R
1215
import kotlinx.android.synthetic.main.order_input_fragment.*
1316
import kotlinx.android.synthetic.main.order_input_fragment.view.*
@@ -99,4 +102,16 @@ class OrderInputFragment : Fragment() {
99102
}
100103
}
101104

105+
fun EditText.onChange(cb: (String) -> Unit) {
106+
this.addTextChangedListener(object : TextWatcher {
107+
override fun afterTextChanged(s: Editable?) {
108+
cb(s.toString())
109+
}
110+
111+
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
112+
113+
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
114+
})
115+
}
116+
102117
}

0 commit comments

Comments
 (0)