fix AccountsInListFragment not showing any accounts (#4851)

The problem is that the MaterialAlertDialog uses a layout with
"wrap_content" around the custom view. Even though the dialog was
stretched to the whole window size, the content was never shown.
The fix reverts to the default dialog and styles it as if it was a
MaterialAlertDialog, which works and also looks better on smaller
screens.

fixes #4850
This commit is contained in:
Konrad Pozniak 2025-01-05 11:34:06 +01:00 committed by GitHub
parent fc57d570a6
commit b52a5cdb48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,7 +16,6 @@
package com.keylesspalace.tusky package com.keylesspalace.tusky
import android.app.Dialog
import android.content.SharedPreferences import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
@ -30,7 +29,6 @@ import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.ListAdapter
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.keylesspalace.tusky.databinding.FragmentAccountsInListBinding import com.keylesspalace.tusky.databinding.FragmentAccountsInListBinding
import com.keylesspalace.tusky.databinding.ItemFollowRequestBinding import com.keylesspalace.tusky.databinding.ItemFollowRequestBinding
import com.keylesspalace.tusky.entity.TimelineAccount import com.keylesspalace.tusky.entity.TimelineAccount
@ -73,11 +71,7 @@ class AccountsInListFragment : DialogFragment() {
viewModel.load(listId) viewModel.load(listId)
} }
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun getTheme() = R.style.TuskyDialogOverlay
return MaterialAlertDialogBuilder(requireContext())
.setView(createView())
.create()
}
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
@ -90,7 +84,7 @@ class AccountsInListFragment : DialogFragment() {
} }
} }
private fun createView(): View { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = FragmentAccountsInListBinding.inflate(layoutInflater) binding = FragmentAccountsInListBinding.inflate(layoutInflater)
val adapter = Adapter() val adapter = Adapter()
val searchAdapter = SearchAdapter() val searchAdapter = SearchAdapter()