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 { fun getBlinds(): String {
val currencyCode = bankroll?.currency?.code ?: Currency.getInstance(Locale.getDefault()).currencyCode val currencyCode = bankroll?.currency?.code ?: Currency.getInstance(Locale.getDefault()).currencyCode
val currencySymbol = Currency.getInstance(currencyCode).symbol 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( SessionRow.TABLE_SIZE -> row.editingDescriptors(mapOf(
"defaultValue" to this.tableSize)) "defaultValue" to this.tableSize))
SessionRow.BLINDS -> row.editingDescriptors(mapOf( SessionRow.BLINDS -> row.editingDescriptors(mapOf(
"SB" to cgSmallBlind?.round(), "sb" to cgSmallBlind?.round(),
"BB" to cgBigBlind?.round() "bb" to cgBigBlind?.round()
)) ))
SessionRow.BUY_IN -> row.editingDescriptors(mapOf( SessionRow.BUY_IN -> row.editingDescriptors(mapOf(
"BB" to cgBigBlind, "bb" to cgBigBlind,
"fee" to this.tournamentEntryFee, "fee" to this.tournamentEntryFee,
"buying" to buyin "buyin" to buyin
)) ))
SessionRow.BREAK_TIME -> row.editingDescriptors(mapOf()) SessionRow.BREAK_TIME -> row.editingDescriptors(mapOf())
SessionRow.CASHED_OUT, SessionRow.PRIZE, SessionRow.NET_RESULT -> 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( SessionRow.COMMENT -> row.editingDescriptors(mapOf(
"defaultValue" to this.comment)) "defaultValue" to this.comment))
SessionRow.INITIAL_BUY_IN -> row.editingDescriptors(mapOf( SessionRow.INITIAL_BUY_IN -> row.editingDescriptors(mapOf(
"fee" to this.tournamentEntryFee "defaultValue" to this.tournamentEntryFee
)) ))
SessionRow.PLAYERS -> row.editingDescriptors(mapOf( SessionRow.PLAYERS -> row.editingDescriptors(mapOf(
"defaultValue" to this.tournamentNumberOfPlayers)) "defaultValue" to this.tournamentNumberOfPlayers))
SessionRow.POSITION -> row.editingDescriptors(mapOf( SessionRow.POSITION -> row.editingDescriptors(mapOf(
"defaultValue" to this.result?.tournamentFinalPosition)) "defaultValue" to this.result?.tournamentFinalPosition))
SessionRow.TIPS -> row.editingDescriptors(mapOf( SessionRow.TIPS -> row.editingDescriptors(mapOf(
"SB" to cgSmallBlind?.round(), "sb" to cgSmallBlind?.round(),
"BB" to cgBigBlind?.round(), "bb" to cgBigBlind?.round(),
"tips" to result?.tips "tips" to result?.tips
)) ))
else -> null else -> null

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

Loading…
Cancel
Save