diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/adapters/TransfersDetailsAdapter.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/adapters/TransfersDetailsAdapter.kt index 533fa84..8f5b5aa 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/adapters/TransfersDetailsAdapter.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/adapters/TransfersDetailsAdapter.kt @@ -26,7 +26,16 @@ class TransfersDetailsAdapter(private val context: Context) : RecyclerView.Adapter() { private val mComparator = - Comparator { a, b -> b.id.compareTo(a.id) } + Comparator { a, b -> + getTransferNumber(b.id).compareTo(getTransferNumber(a.id)) + } + + /** A transferId has the format 1.11.x where x is the identifier of the transfer, this identifier is converted + * to Long and returned */ + private fun getTransferNumber(transferId: String): Long { + val transferNumber = transferId.split(".").last() + return transferNumber.toLong() + } private val mSortedList = SortedList(TransferDetail::class.java, object : SortedList.Callback() {