blob: 732b5b2b8e9f00f52a47087a47450a2667037a64 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package org.pacien.tincapp.utils
import android.widget.ArrayAdapter
import android.widget.TextView
import org.pacien.tincapp.R
import org.pacien.tincapp.context.App
/**
* @author pacien
*/
fun <T> ArrayAdapter<T>.setElements(list: Collection<T>) {
setNotifyOnChange(false)
clear()
addAll(list)
notifyDataSetChanged()
setNotifyOnChange(true)
}
fun TextView.setText(list: List<String>) {
if (list.isNotEmpty()) text = list.joinToString("\n")
else text = App.getContext().getString(R.string.value_none)
}
|