From 5924a8876a05b2491a4c514398a9480660beeb4c Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 4 Feb 2020 10:46:20 +0100 Subject: [PATCH] Fixes issue with SUMMARY --- .../android/ui/modules/handhistory/views/CardsRow.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/CardsRow.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/CardsRow.kt index 52cfea8e..9eef38d2 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/CardsRow.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/CardsRow.kt @@ -1,11 +1,11 @@ package net.pokeranalytics.android.ui.modules.handhistory.views import net.pokeranalytics.android.exceptions.PAIllegalStateException -import net.pokeranalytics.android.ui.modules.handhistory.HHKeyboard import net.pokeranalytics.android.model.handhistory.HandHistoryRow import net.pokeranalytics.android.model.handhistory.Position import net.pokeranalytics.android.model.handhistory.Street import net.pokeranalytics.android.model.realm.handhistory.Card +import net.pokeranalytics.android.ui.modules.handhistory.HHKeyboard import net.pokeranalytics.android.ui.modules.handhistory.HandRowType abstract class CardsRow(cards: List) : HandHistoryRow { @@ -119,11 +119,17 @@ class StreetCardsRow(var street: Street, cards: List) : CardsRow(cards) { } override fun lastCard(): Card? { - return this.cards.lastOrNull { it.street == this.street } + return when (this.street) { + Street.SUMMARY -> this.cards.lastOrNull() + else -> this.cards.lastOrNull { it.street == this.street } + } } override fun clear() { - this.cards.removeAll { it.street == this.street } + when (this.street) { + Street.SUMMARY -> this.cards.clear() + else -> this.cards.removeAll { it.street == this.street } + } } }