Display the list's title in the array adapter (#3823)

Fixes #3819
This commit is contained in:
Nik Clayton 2023-07-08 21:08:37 +02:00 committed by GitHub
parent 201f2c757e
commit 0d88f26bb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import android.os.Bundle
import android.util.Log import android.util.Log
import android.view.Gravity import android.view.Gravity
import android.view.View import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter import android.widget.ArrayAdapter
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.LinearLayout import android.widget.LinearLayout
@ -273,7 +274,13 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene
} }
private fun showSelectListDialog() { private fun showSelectListDialog() {
val adapter = ArrayAdapter<MastoList>(this, android.R.layout.simple_list_item_1) val adapter = object : ArrayAdapter<MastoList>(this, android.R.layout.simple_list_item_1) {
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
val view = super.getView(position, convertView, parent)
getItem(position)?.let { item -> (view as TextView).text = item.title }
return view
}
}
val statusLayout = LinearLayout(this) val statusLayout = LinearLayout(this)
statusLayout.gravity = Gravity.CENTER statusLayout.gravity = Gravity.CENTER