|
|
|
@ -588,136 +588,56 @@ open class Session : RealmObject(), SessionInterface, Manageable, StaticRowRepre |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun editDescriptors(row: RowRepresentable): ArrayList<RowRepresentableEditDescriptor>? { |
|
|
|
override fun editDescriptors(row: RowRepresentable): ArrayList<RowRepresentableEditDescriptor>? { |
|
|
|
|
|
|
|
return when (row) { |
|
|
|
val data = ArrayList<RowRepresentableEditDescriptor>() |
|
|
|
SessionRow.BANKROLL -> row.editingDescriptors(mapOf( |
|
|
|
|
|
|
|
"defaultValue" to this.bankroll, |
|
|
|
when (row) { |
|
|
|
"data" to LiveData.BANKROLL.items(realm))) |
|
|
|
SessionRow.BANKROLL -> { |
|
|
|
SessionRow.GAME -> row.editingDescriptors(mapOf( |
|
|
|
// Add current bankroll and bankrolls list |
|
|
|
"limit" to this.limit, |
|
|
|
data.add(RowRepresentableEditDescriptor(bankroll, data = LiveData.BANKROLL.items(realm))) |
|
|
|
"defaultValue" to this.game, |
|
|
|
} |
|
|
|
"data" to LiveData.GAME.items(realm))) |
|
|
|
SessionRow.BLINDS -> { |
|
|
|
SessionRow.LOCATION -> row.editingDescriptors(mapOf( |
|
|
|
data.add( |
|
|
|
"defaultValue" to this.location, |
|
|
|
RowRepresentableEditDescriptor( |
|
|
|
"data" to LiveData.LOCATION.items(realm))) |
|
|
|
cgSmallBlind?.round(), |
|
|
|
SessionRow.TOURNAMENT_FEATURE -> row.editingDescriptors(mapOf( |
|
|
|
R.string.smallblind, |
|
|
|
"defaultValue" to this.tournamentFeatures, |
|
|
|
InputType.TYPE_CLASS_NUMBER |
|
|
|
"data" to LiveData.TOURNAMENT_FEATURE.items(realm))) |
|
|
|
or InputType.TYPE_NUMBER_FLAG_DECIMAL |
|
|
|
SessionRow.TOURNAMENT_NAME -> row.editingDescriptors(mapOf( |
|
|
|
) |
|
|
|
"defaultValue" to this.tournamentName, |
|
|
|
) |
|
|
|
"data" to LiveData.TOURNAMENT_NAME.items(realm))) |
|
|
|
data.add( |
|
|
|
SessionRow.TOURNAMENT_TYPE -> row.editingDescriptors(mapOf( |
|
|
|
RowRepresentableEditDescriptor( |
|
|
|
"defaultValue" to this.tournamentType)) |
|
|
|
cgBigBlind?.round(), R.string.bigblind, InputType.TYPE_CLASS_NUMBER |
|
|
|
SessionRow.TABLE_SIZE -> row.editingDescriptors(mapOf( |
|
|
|
or InputType.TYPE_NUMBER_FLAG_DECIMAL |
|
|
|
"defaultValue" to this.tableSize)) |
|
|
|
) |
|
|
|
SessionRow.BLINDS -> row.editingDescriptors(mapOf( |
|
|
|
) |
|
|
|
"SB" to cgSmallBlind?.round(), |
|
|
|
} |
|
|
|
"BB" to cgBigBlind?.round() |
|
|
|
SessionRow.BREAK_TIME -> { |
|
|
|
)) |
|
|
|
data.add( |
|
|
|
SessionRow.BUY_IN -> row.editingDescriptors(mapOf( |
|
|
|
RowRepresentableEditDescriptor( |
|
|
|
"BB" to cgBigBlind, |
|
|
|
"", |
|
|
|
"fee" to this.tournamentEntryFee, |
|
|
|
hint = R.string.in_minutes, inputType = InputType.TYPE_CLASS_NUMBER |
|
|
|
"buying" to buyin |
|
|
|
) |
|
|
|
)) |
|
|
|
) |
|
|
|
SessionRow.BREAK_TIME -> row.editingDescriptors(mapOf()) |
|
|
|
} |
|
|
|
SessionRow.CASHED_OUT, SessionRow.PRIZE, SessionRow.NET_RESULT -> row.editingDescriptors(mapOf( |
|
|
|
SessionRow.BUY_IN -> { |
|
|
|
"result" to result?.cashout?.round() |
|
|
|
// Add first & second buttons values, current value & set the 2 edit texts |
|
|
|
)) |
|
|
|
if (this.cgBigBlind != null) { |
|
|
|
SessionRow.COMMENT -> row.editingDescriptors(mapOf( |
|
|
|
data.add(RowRepresentableEditDescriptor(100.0 * (this.cgBigBlind ?: 0.0))) |
|
|
|
"defaultValue" to this.comment)) |
|
|
|
data.add(RowRepresentableEditDescriptor(200.0 * (this.cgBigBlind ?: 0.0))) |
|
|
|
SessionRow.INITIAL_BUY_IN -> row.editingDescriptors(mapOf( |
|
|
|
} else if (this.tournamentEntryFee != null) { |
|
|
|
"fee" to this.tournamentEntryFee |
|
|
|
data.add(RowRepresentableEditDescriptor((this.tournamentEntryFee ?: 0.0) * 1.0)) |
|
|
|
)) |
|
|
|
data.add(RowRepresentableEditDescriptor((this.tournamentEntryFee ?: 0.0) * 2.0)) |
|
|
|
SessionRow.PLAYERS -> row.editingDescriptors(mapOf( |
|
|
|
} else { |
|
|
|
"defaultValue" to this.tournamentNumberOfPlayers)) |
|
|
|
data.add(RowRepresentableEditDescriptor(0)) |
|
|
|
SessionRow.POSITION -> row.editingDescriptors(mapOf( |
|
|
|
data.add(RowRepresentableEditDescriptor(0)) |
|
|
|
"defaultValue" to this.result?.tournamentFinalPosition)) |
|
|
|
} |
|
|
|
SessionRow.TIPS -> row.editingDescriptors(mapOf( |
|
|
|
|
|
|
|
"SB" to cgSmallBlind?.round(), |
|
|
|
data.add(RowRepresentableEditDescriptor(buyin)) |
|
|
|
"BB" to cgBigBlind?.round(), |
|
|
|
data.add( |
|
|
|
"tips" to result?.tips |
|
|
|
RowRepresentableEditDescriptor( |
|
|
|
)) |
|
|
|
"", |
|
|
|
else -> null |
|
|
|
inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
data.add( |
|
|
|
|
|
|
|
RowRepresentableEditDescriptor( |
|
|
|
|
|
|
|
"", |
|
|
|
|
|
|
|
inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.CASHED_OUT, SessionRow.PRIZE, SessionRow.NET_RESULT -> { |
|
|
|
|
|
|
|
data.add( |
|
|
|
|
|
|
|
RowRepresentableEditDescriptor( |
|
|
|
|
|
|
|
result?.cashout?.round(), |
|
|
|
|
|
|
|
inputType = InputType.TYPE_CLASS_NUMBER |
|
|
|
|
|
|
|
or InputType.TYPE_NUMBER_FLAG_DECIMAL |
|
|
|
|
|
|
|
or InputType.TYPE_NUMBER_FLAG_SIGNED |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.COMMENT -> { |
|
|
|
|
|
|
|
data.add(RowRepresentableEditDescriptor(comment, R.string.comment)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.GAME -> { |
|
|
|
|
|
|
|
// Add current game & games list |
|
|
|
|
|
|
|
data.add(RowRepresentableEditDescriptor(limit)) |
|
|
|
|
|
|
|
data.add(RowRepresentableEditDescriptor(game, data = LiveData.GAME.items(realm))) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.INITIAL_BUY_IN -> { |
|
|
|
|
|
|
|
data.add( |
|
|
|
|
|
|
|
RowRepresentableEditDescriptor(tournamentEntryFee?.round(), inputType = InputType.TYPE_CLASS_NUMBER) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.LOCATION -> { |
|
|
|
|
|
|
|
// Add current location and locations list |
|
|
|
|
|
|
|
data.add(RowRepresentableEditDescriptor(location, data = LiveData.LOCATION.items(realm))) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.PLAYERS -> { |
|
|
|
|
|
|
|
data.add( |
|
|
|
|
|
|
|
RowRepresentableEditDescriptor( |
|
|
|
|
|
|
|
tournamentNumberOfPlayers?.toString(), |
|
|
|
|
|
|
|
inputType = InputType.TYPE_CLASS_NUMBER |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.POSITION -> { |
|
|
|
|
|
|
|
data.add( |
|
|
|
|
|
|
|
RowRepresentableEditDescriptor( |
|
|
|
|
|
|
|
result?.tournamentFinalPosition, |
|
|
|
|
|
|
|
inputType = InputType.TYPE_CLASS_NUMBER |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.TABLE_SIZE -> { |
|
|
|
|
|
|
|
data.add(RowRepresentableEditDescriptor(tableSize)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.TIPS -> { |
|
|
|
|
|
|
|
// Disable the buttons with value = 0, add current value & set the 2 edit texts |
|
|
|
|
|
|
|
data.add(RowRepresentableEditDescriptor(cgSmallBlind ?: 0.0)) |
|
|
|
|
|
|
|
data.add(RowRepresentableEditDescriptor(cgBigBlind ?: 0.0)) |
|
|
|
|
|
|
|
data.add(RowRepresentableEditDescriptor(result?.tips ?: 0.0)) |
|
|
|
|
|
|
|
data.add(RowRepresentableEditDescriptor("", inputType = InputType.TYPE_CLASS_NUMBER)) |
|
|
|
|
|
|
|
data.add(RowRepresentableEditDescriptor("", inputType = InputType.TYPE_CLASS_NUMBER)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.TOURNAMENT_NAME -> { |
|
|
|
|
|
|
|
// Add current tournament name and tournament names list |
|
|
|
|
|
|
|
data.add(RowRepresentableEditDescriptor(tournamentName, data = LiveData.TOURNAMENT_NAME.items(realm))) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.TOURNAMENT_TYPE -> { |
|
|
|
|
|
|
|
// Add current tournament kind and tournament kind list |
|
|
|
|
|
|
|
data.add(RowRepresentableEditDescriptor(tournamentType, staticData = TournamentType.values().map { |
|
|
|
|
|
|
|
it |
|
|
|
|
|
|
|
})) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.TOURNAMENT_FEATURE -> { |
|
|
|
|
|
|
|
// Add current tournament feature and tournament features list |
|
|
|
|
|
|
|
data.add(RowRepresentableEditDescriptor(tournamentFeatures, data = LiveData.TOURNAMENT_FEATURE.items(realm))) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return data |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun updateValue(value: Any?, row: RowRepresentable) { |
|
|
|
override fun updateValue(value: Any?, row: RowRepresentable) { |
|
|
|
|