From 0bfa505bb1e7fdd514592dbd79a4ccd244d13cad Mon Sep 17 00:00:00 2001 From: euxane Date: Wed, 18 Sep 2024 23:41:13 +0200 Subject: activities/listviews: workaround list view adapter bug on old android Setting up the list adapter after adding the headers suddenly started crashing on Android API 25 together with the more recent libraries. --- .../java/org/pacien/tincapp/activities/start/NetworkListFragment.kt | 2 +- .../java/org/pacien/tincapp/activities/status/nodes/NodeListFragment.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/org/pacien/tincapp/activities/start/NetworkListFragment.kt b/app/src/main/java/org/pacien/tincapp/activities/start/NetworkListFragment.kt index 7b5006a..fc5b6ff 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/start/NetworkListFragment.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/start/NetworkListFragment.kt @@ -54,10 +54,10 @@ class NetworkListFragment : BaseFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { val listHeaderView = layoutInflater.inflate(R.layout.start_network_list_header, startNetworkListBinding.root, false) + startNetworkListBinding.startNetworkList.adapter = networkListAdapter startNetworkListBinding.startNetworkList.addHeaderView(listHeaderView, null, false) startNetworkListBinding.startNetworkList.hideBottomSeparator() startNetworkListBinding.startNetworkList.onItemClickListener = AdapterView.OnItemClickListener(this::onItemClick) - startNetworkListBinding.startNetworkList.adapter = networkListAdapter } @Suppress("UNUSED_PARAMETER") diff --git a/app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListFragment.kt b/app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListFragment.kt index 474ab6e..8c0ef88 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListFragment.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListFragment.kt @@ -57,9 +57,9 @@ class NodeListFragment : BaseFragment() { } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + statusNodeListFragmentBinding.statusNodeList.adapter = nodeListAdapter statusNodeListFragmentBinding.statusNodeList.hideTopSeparator() statusNodeListFragmentBinding.statusNodeList.hideBottomSeparator() - statusNodeListFragmentBinding.statusNodeList.adapter = nodeListAdapter } private fun updateNodeList(nodes: List) { -- cgit v1.2.3