Avoid crash in TransferDetailsAdapter.
- This is the adapter that populates the list of transactions in the TransactionsFragment, the crash was happening when the user tapped two or more items in the list at the same time. When that happens only the first item tapped opens its corresponding eReceipt correctly but the remaining ones throw an excpeption which was not being handled correctly and causing a crash.
This commit is contained in:
parent
39a3e6b7d4
commit
6482b31971
1 changed files with 9 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
package cy.agorise.bitsybitshareswallet.adapters
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -158,7 +159,14 @@ class TransfersDetailsAdapter(private val context: Context) :
|
|||
// Open the eReceipt when a transaction is tapped
|
||||
viewHolder.rootView.setOnClickListener { v ->
|
||||
val action = TransactionsFragmentDirections.eReceiptAction(transferDetail.id)
|
||||
v.findNavController().navigate(action)
|
||||
try {
|
||||
v.findNavController().navigate(action)
|
||||
} catch (ignored: IllegalArgumentException) {
|
||||
// This exception is being ignored because it happens when a user taps two or
|
||||
// more items on the list at the same time, only the first navigates correctly and
|
||||
// the remaining produce an exception.
|
||||
Log.d("TransfersDetailsAdapter", "Ignoring IllegalArgumentException")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue