Merge branch 'master' of gitlab.com:stax-river/poker-analytics

feature/top10
Aurelien Hubert 7 years ago
commit 9dd3d477b3
  1. 18
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt
  2. 32
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/SessionRow.kt

@ -415,7 +415,7 @@ open class Session : RealmObject(), Manageable, StaticRowRepresentableDataSource
fun getBlinds(): String {
val currencyCode = bankroll?.currency?.code ?: Currency.getInstance(Locale.getDefault()).currencyCode
val currencySymbol = Currency.getInstance(currencyCode).symbol
return if (cgSmallBlind == null) NULL_TEXT else "$currencySymbol ${cgSmallBlind?.formatted()}/${cgBigBlind?.round()}"
return if (cgSmallBlind == null) NULL_TEXT else "$currencySymbol ${cgSmallBlind?.formatted()}/${cgBigBlind?.formatted()}"
}
/**
@ -618,30 +618,30 @@ open class Session : RealmObject(), Manageable, StaticRowRepresentableDataSource
SessionRow.TABLE_SIZE -> row.editingDescriptors(mapOf(
"defaultValue" to this.tableSize))
SessionRow.BLINDS -> row.editingDescriptors(mapOf(
"SB" to cgSmallBlind?.round(),
"BB" to cgBigBlind?.round()
"sb" to cgSmallBlind?.round(),
"bb" to cgBigBlind?.round()
))
SessionRow.BUY_IN -> row.editingDescriptors(mapOf(
"BB" to cgBigBlind,
"bb" to cgBigBlind,
"fee" to this.tournamentEntryFee,
"buying" to buyin
"buyin" to buyin
))
SessionRow.BREAK_TIME -> row.editingDescriptors(mapOf())
SessionRow.CASHED_OUT, SessionRow.PRIZE, SessionRow.NET_RESULT -> row.editingDescriptors(mapOf(
"result" to result?.cashout?.round()
"defaultValue" to result?.cashout?.round()
))
SessionRow.COMMENT -> row.editingDescriptors(mapOf(
"defaultValue" to this.comment))
SessionRow.INITIAL_BUY_IN -> row.editingDescriptors(mapOf(
"fee" to this.tournamentEntryFee
"defaultValue" to this.tournamentEntryFee
))
SessionRow.PLAYERS -> row.editingDescriptors(mapOf(
"defaultValue" to this.tournamentNumberOfPlayers))
SessionRow.POSITION -> row.editingDescriptors(mapOf(
"defaultValue" to this.result?.tournamentFinalPosition))
SessionRow.TIPS -> row.editingDescriptors(mapOf(
"SB" to cgSmallBlind?.round(),
"BB" to cgBigBlind?.round(),
"sb" to cgSmallBlind?.round(),
"bb" to cgBigBlind?.round(),
"tips" to result?.tips
))
else -> null

@ -150,8 +150,8 @@ enum class SessionRow : RowRepresentable {
override fun editingDescriptors(map: Map<String, Any?>): ArrayList<RowRepresentableEditDescriptor>? {
return when (this) {
BLINDS -> {
val sb: Double? by map
val bb: Double? by map
val sb: String? by map
val bb: String? by map
arrayListOf(
RowRepresentableEditDescriptor(sb, R.string.smallblind, InputType.TYPE_CLASS_NUMBER
or InputType.TYPE_NUMBER_FLAG_DECIMAL),
@ -190,18 +190,18 @@ enum class SessionRow : RowRepresentable {
data
}
CASHED_OUT, PRIZE, NET_RESULT -> {
val cashout: Double? by map
val defaultValue: String? by map
arrayListOf(
RowRepresentableEditDescriptor(
cashout?.round(),
defaultValue,
inputType = InputType.TYPE_CLASS_NUMBER
or InputType.TYPE_NUMBER_FLAG_DECIMAL
or InputType.TYPE_NUMBER_FLAG_SIGNED
))
}
COMMENT -> {
val comment : String? by map
arrayListOf(RowRepresentableEditDescriptor(comment, R.string.comment))
val defaultValue : String? by map
arrayListOf(RowRepresentableEditDescriptor(defaultValue, R.string.comment))
}
BREAK_TIME -> {
arrayListOf(
@ -220,9 +220,9 @@ enum class SessionRow : RowRepresentable {
RowRepresentableEditDescriptor(defaultValue, data = data))
}
INITIAL_BUY_IN -> {
val fee : Double? by map
val defaultValue : Double? by map
arrayListOf(
RowRepresentableEditDescriptor(fee?.round(), inputType = InputType.TYPE_CLASS_NUMBER)
RowRepresentableEditDescriptor(defaultValue?.round(), inputType = InputType.TYPE_CLASS_NUMBER)
)
}
BANKROLL, LOCATION, TOURNAMENT_FEATURE, TOURNAMENT_NAME -> {
@ -233,30 +233,30 @@ enum class SessionRow : RowRepresentable {
)
}
PLAYERS -> {
val tournamentNumberOfPlayers: Int? by map
val defaultValue: Int? by map
arrayListOf(
RowRepresentableEditDescriptor(
tournamentNumberOfPlayers?.toString(),
defaultValue?.toString(),
inputType = InputType.TYPE_CLASS_NUMBER
)
)
}
POSITION -> {
val tournamentFinalPosition : Int? by map
val defaultValue : Int? by map
arrayListOf(
RowRepresentableEditDescriptor(
tournamentFinalPosition,
defaultValue,
inputType = InputType.TYPE_CLASS_NUMBER
)
)
}
TABLE_SIZE -> {
val tableSize : Int? by map
arrayListOf(RowRepresentableEditDescriptor(tableSize))
val defaultValue : Int? by map
arrayListOf(RowRepresentableEditDescriptor(defaultValue))
}
TIPS -> {
val sb: Double? by map
val bb: Double? by map
val sb: String? by map
val bb: String? by map
val tips: Double? by map
// Disable the buttons with value = 0, add current value & set the 2 edit texts

Loading…
Cancel
Save