|
|
|
|
@ -27,18 +27,12 @@ import kotlin.collections.ArrayList |
|
|
|
|
open class Session : RealmObject(), SessionInterface, Savable, |
|
|
|
|
RowRepresentableDataSource, RowRepresentable { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum class Type { |
|
|
|
|
CASH_GAME, |
|
|
|
|
TOURNAMENT |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
companion object { |
|
|
|
|
|
|
|
|
|
// Type: cash game = 0, tournament = 1 |
|
|
|
|
const val TYPE_GAME = 0 |
|
|
|
|
const val TYPE_TOURNAMENT = 1 |
|
|
|
|
|
|
|
|
|
fun newInstance(): Session { |
|
|
|
|
val session = Session() |
|
|
|
|
session.result = Result() |
|
|
|
|
@ -53,7 +47,7 @@ open class Session : RealmObject(), SessionInterface, Savable, |
|
|
|
|
/** |
|
|
|
|
* Indicates the type of session, cash game or tournament |
|
|
|
|
*/ |
|
|
|
|
var type: Int = TYPE_GAME |
|
|
|
|
var type: Int = Type.CASH_GAME.ordinal |
|
|
|
|
|
|
|
|
|
// The result of the main user |
|
|
|
|
var result: Result? = null |
|
|
|
|
@ -123,6 +117,20 @@ open class Session : RealmObject(), SessionInterface, Savable, |
|
|
|
|
// The features of the tournament, like Knockout, Shootout, Turbo... |
|
|
|
|
var tournamentFeatures: RealmList<TournamentFeature> = RealmList() |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Return if this session is a tournament |
|
|
|
|
*/ |
|
|
|
|
fun isTournament(): Boolean { |
|
|
|
|
return type == Type.TOURNAMENT.ordinal |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Return if this session is a cash game |
|
|
|
|
*/ |
|
|
|
|
fun isCashGame(): Boolean { |
|
|
|
|
return type == Type.CASH_GAME.ordinal |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Start a session |
|
|
|
|
*/ |
|
|
|
|
@ -336,7 +344,7 @@ open class Session : RealmObject(), SessionInterface, Savable, |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
if (type == TYPE_GAME) { |
|
|
|
|
if (!isTournament()) { |
|
|
|
|
rows.add( |
|
|
|
|
HeaderRowRepresentable( |
|
|
|
|
RowViewType.HEADER_TITLE_VALUE, |
|
|
|
|
|