-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBindingAdapter.kt
More file actions
49 lines (44 loc) · 1.46 KB
/
BindingAdapter.kt
File metadata and controls
49 lines (44 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package place.pic.android.plus
import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide
object BindingAdapter {
@BindingAdapter("setImageUrl")
@JvmStatic
fun loadImage(imageView: ImageView, url: String) {
Glide.with(imageView.context)
.load(url)
.circleCrop()
.into(imageView)
}
@BindingAdapter("setButtonChange")
@JvmStatic
fun setButtonChange(button: ImageView, compass: Boolean) {
when (compass) {
true -> button.setBackgroundResource(R.drawable.ic_baseline_clear_24)
else -> button.setBackgroundResource(R.drawable.ic_baseline_search_24)
}
}
/*
@BindingAdapter("TextChangeWatcher")
@JvmStatic
fun onEditTextWatcher(): TextWatcher {
return object : TextWatcher {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
override fun afterTextChanged(s: Editable) {
}
}
}
@BindingAdapter("bindRecyclerView")
@JvmStatic
fun bindRecyclerView(recyclerView: RecyclerView, searchUserData: MutableList<SearchUserData>?)
{
if (recyclerView.adapter != null) {
with(recyclerView.adapter as SearchUserAdapter) {
submitList(searchUserData)
}
}
}
*/
}