Fixes issue with SUMMARY

hh
Laurent 6 years ago
parent b522dc80ff
commit 5924a8876a
  1. 12
      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 package net.pokeranalytics.android.ui.modules.handhistory.views
import net.pokeranalytics.android.exceptions.PAIllegalStateException 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.HandHistoryRow
import net.pokeranalytics.android.model.handhistory.Position import net.pokeranalytics.android.model.handhistory.Position
import net.pokeranalytics.android.model.handhistory.Street import net.pokeranalytics.android.model.handhistory.Street
import net.pokeranalytics.android.model.realm.handhistory.Card import net.pokeranalytics.android.model.realm.handhistory.Card
import net.pokeranalytics.android.ui.modules.handhistory.HHKeyboard
import net.pokeranalytics.android.ui.modules.handhistory.HandRowType import net.pokeranalytics.android.ui.modules.handhistory.HandRowType
abstract class CardsRow(cards: List<Card>) : HandHistoryRow { abstract class CardsRow(cards: List<Card>) : HandHistoryRow {
@ -119,11 +119,17 @@ class StreetCardsRow(var street: Street, cards: List<Card>) : CardsRow(cards) {
} }
override fun lastCard(): Card? { 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() { 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 }
}
} }
} }

Loading…
Cancel
Save