From 530c50da2bef35f39c77da1f9eefa144108b722b Mon Sep 17 00:00:00 2001 From: Cold-Mint Date: Mon, 20 Feb 2023 10:23:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A5=94=E6=BA=83=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rust/pro/fragments/InsertCoinsFragment.kt | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/com/coldmint/rust/pro/fragments/InsertCoinsFragment.kt b/app/src/main/java/com/coldmint/rust/pro/fragments/InsertCoinsFragment.kt index 59edb50..174af52 100644 --- a/app/src/main/java/com/coldmint/rust/pro/fragments/InsertCoinsFragment.kt +++ b/app/src/main/java/com/coldmint/rust/pro/fragments/InsertCoinsFragment.kt @@ -73,30 +73,32 @@ class InsertCoinsFragment(val modId: String) : BaseFragment { override fun onResponse(t: InsertCoinHistoryData) { - val dataList = t.data - if (dataList.isNullOrEmpty()) { - viewBinding.recyclerView.isVisible = false - if (useLinearProgressIndicator) { - viewBinding.linearProgressIndicator.isVisible = false - } - viewBinding.loadLayout.isVisible = true - viewBinding.coinRecordsView.text = getString(R.string.coin_records) - } else { - val adapter = InsertCoinsAdapter(requireContext(), dataList) - adapter.setItemEvent { i, itemInsertCoinsBinding, viewHolder, data -> - itemInsertCoinsBinding.imageView.setOnClickListener { - gotoUserPage(data.account) + if (isAdded) { + val dataList = t.data + if (dataList.isNullOrEmpty()) { + viewBinding.recyclerView.isVisible = false + if (useLinearProgressIndicator) { + viewBinding.linearProgressIndicator.isVisible = false } + viewBinding.loadLayout.isVisible = true + viewBinding.coinRecordsView.text = getString(R.string.coin_records) + } else { + val adapter = InsertCoinsAdapter(requireContext(), dataList) + adapter.setItemEvent { i, itemInsertCoinsBinding, viewHolder, data -> + itemInsertCoinsBinding.imageView.setOnClickListener { + gotoUserPage(data.account) + } + } + viewBinding.recyclerView.adapter = + adapter + val data = getString(R.string.coin_records) + "(" + dataList.size + ")" + viewBinding.coinRecordsView.text = data + viewBinding.recyclerView.isVisible = true + if (useLinearProgressIndicator) { + viewBinding.linearProgressIndicator.isVisible = false + } + viewBinding.loadLayout.isVisible = false } - viewBinding.recyclerView.adapter = - adapter - val data = getString(R.string.coin_records) + "(" + dataList.size + ")" - viewBinding.coinRecordsView.text = data - viewBinding.recyclerView.isVisible = true - if (useLinearProgressIndicator) { - viewBinding.linearProgressIndicator.isVisible = false - } - viewBinding.loadLayout.isVisible = false } }