INNER CODE UNIT · Kotlin
updateList
romanvht/ByeByeDPI · app/src/main/java/io/github/romanvht/byedpi/activities/FileActivity.kt:319
private fun updateList() {
listView.adapter = object : ArrayAdapter<Entry>(
this,
android.R.layout.simple_list_item_1,
entries
) {
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
val view = super.getView(position, convertView, parent) as TextView
val entry = entries[position]
val density = resources.displayMetrics.density
val horizontalPadding = (16 * density).toInt()
val verticalPadding = (8 * density).toInt()
view.text = entry.label
view.setCompoundDrawablesRelativeWithIntrinsicBounds(
if (entry.file.isDirectory) R.drawable.ic_folder else R.drawable.ic_description,
0,
0,
0