|
|
|
@ -17,6 +17,7 @@ import net.pokeranalytics.android.model.handhistory.Street |
|
|
|
import net.pokeranalytics.android.model.interfaces.Identifiable |
|
|
|
import net.pokeranalytics.android.model.interfaces.Identifiable |
|
|
|
import net.pokeranalytics.android.model.interfaces.TimeFilterable |
|
|
|
import net.pokeranalytics.android.model.interfaces.TimeFilterable |
|
|
|
import net.pokeranalytics.android.model.realm.Session |
|
|
|
import net.pokeranalytics.android.model.realm.Session |
|
|
|
|
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.model.ActionReadRow |
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.model.CardHolder |
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.model.CardHolder |
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
import net.pokeranalytics.android.util.extensions.addLineReturn |
|
|
|
import net.pokeranalytics.android.util.extensions.addLineReturn |
|
|
|
@ -207,7 +208,13 @@ open class HandHistory : RealmObject(), RowRepresentable, Identifiable, Filterab |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun createPlayerSetup(positionIndex: Int): PlayerSetup { |
|
|
|
fun createPlayerSetup(positionIndex: Int): PlayerSetup { |
|
|
|
val playerSetup = this.realm.createObject(PlayerSetup::class.java) |
|
|
|
|
|
|
|
|
|
|
|
val playerSetup = if (this.realm != null) { |
|
|
|
|
|
|
|
this.realm.createObject(PlayerSetup::class.java) } |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
PlayerSetup() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
playerSetup.position = positionIndex |
|
|
|
playerSetup.position = positionIndex |
|
|
|
this.playerSetups.add(playerSetup) |
|
|
|
this.playerSetups.add(playerSetup) |
|
|
|
return playerSetup |
|
|
|
return playerSetup |
|
|
|
@ -262,7 +269,7 @@ open class HandHistory : RealmObject(), RowRepresentable, Identifiable, Filterab |
|
|
|
|
|
|
|
|
|
|
|
string = string.addLineReturn(2) |
|
|
|
string = string.addLineReturn(2) |
|
|
|
|
|
|
|
|
|
|
|
val streetActions = sortedActions.filter { it.street == street } |
|
|
|
val streetActions = sortedActions.filter { it.street == street }.compact(positions) |
|
|
|
if (streetActions.isNotEmpty()) { |
|
|
|
if (streetActions.isNotEmpty()) { |
|
|
|
|
|
|
|
|
|
|
|
val streetItems = mutableListOf<CharSequence>(context.getString(street.resId)) |
|
|
|
val streetItems = mutableListOf<CharSequence>(context.getString(street.resId)) |
|
|
|
@ -280,7 +287,7 @@ open class HandHistory : RealmObject(), RowRepresentable, Identifiable, Filterab |
|
|
|
string = string.addLineReturn() |
|
|
|
string = string.addLineReturn() |
|
|
|
|
|
|
|
|
|
|
|
streetActions.forEach { action -> |
|
|
|
streetActions.forEach { action -> |
|
|
|
string = string.plus(localizedAction(action, positions, context)) |
|
|
|
string = string.plus(localizedAction(action, context)) |
|
|
|
string = string.addLineReturn() |
|
|
|
string = string.addLineReturn() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -299,12 +306,13 @@ open class HandHistory : RealmObject(), RowRepresentable, Identifiable, Filterab |
|
|
|
return playerItems.joinToString(" ") |
|
|
|
return playerItems.joinToString(" ") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun localizedAction(action: Action, positions: LinkedHashSet<Position>, context: Context): String { |
|
|
|
private fun localizedAction(actionReadRow: ActionReadRow, context: Context): String { |
|
|
|
val actionItems = mutableListOf(positions.elementAt(action.position).value) |
|
|
|
val formattedPositions = actionReadRow.positions.map { it.value }.joinToString(", ") |
|
|
|
action.type?.let { type -> |
|
|
|
val actionItems = mutableListOf(formattedPositions) |
|
|
|
|
|
|
|
actionReadRow.action?.let { type -> |
|
|
|
actionItems.add(context.getString(type.resId)) |
|
|
|
actionItems.add(context.getString(type.resId)) |
|
|
|
} |
|
|
|
} |
|
|
|
action.amount?.let { amount -> |
|
|
|
actionReadRow.amount?.let { amount -> |
|
|
|
actionItems.add(amount.formatted()) |
|
|
|
actionItems.add(amount.formatted()) |
|
|
|
} |
|
|
|
} |
|
|
|
return actionItems.joinToString(" ") |
|
|
|
return actionItems.joinToString(" ") |
|
|
|
|