blob: f10c4c7ebdb138d8de2b565a0018f8560a13806d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package org.pacien.tincapp.extensions
import android.widget.ArrayAdapter
import android.widget.TextView
import org.pacien.tincapp.R
import org.pacien.tincapp.context.App
/**
* @author pacien
*/
object Android {
fun <T> ArrayAdapter<T>.setElements(elems: Collection<T>) {
setNotifyOnChange(false)
clear()
addAll(elems)
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)
}
|