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 } }