From 0d88f26bb3e8c4a1c614902ee218cc670c7ca6ef Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Sat, 8 Jul 2023 21:08:37 +0200 Subject: [PATCH] Display the list's title in the array adapter (#3823) Fixes #3819 --- .../com/keylesspalace/tusky/TabPreferenceActivity.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt b/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt index b4719411..096fe336 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt @@ -21,6 +21,7 @@ import android.os.Bundle import android.util.Log import android.view.Gravity import android.view.View +import android.view.ViewGroup import android.widget.ArrayAdapter import android.widget.FrameLayout import android.widget.LinearLayout @@ -273,7 +274,13 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene } private fun showSelectListDialog() { - val adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1) + val adapter = object : ArrayAdapter(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) statusLayout.gravity = Gravity.CENTER