Improving game type

feature/top10
Laurent 7 years ago
parent 4010617bcb
commit 0ada714e1a
  1. 1
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt
  2. 3
      app/src/main/java/net/pokeranalytics/android/model/utils/FavoriteSessionFinder.kt
  3. 28
      app/src/main/java/net/pokeranalytics/android/ui/view/SessionRowView.kt

@ -484,6 +484,7 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat
/**
* Return the game title
* Example: NL Holdem
*/
fun getGameTitle(): String {
var gameTitle = ""

@ -40,7 +40,8 @@ private fun Session.significantFields(): List<SessionRow> {
SessionRow.GAME,
SessionRow.BLINDS,
SessionRow.BANKROLL,
SessionRow.TABLE_SIZE
SessionRow.TABLE_SIZE,
SessionRow.TOURNAMENT_TYPE
)
}
}

@ -63,31 +63,35 @@ class SessionRowView : FrameLayout {
// Title / Game type
var title = ""
var parameters = mutableListOf<String>()
if (session.isTournament()) {
if (session.tournamentEntryFee != null) {
title += session.tournamentEntryFee?.toCurrency(CurrencyUtils.getCurrency(session.bankroll))
}
session.game?.let {
title += (if (title.isNotEmpty()) " " else "") + session.getGameTitle()
session.tournamentEntryFee?.let {
parameters.add(it.toCurrency(CurrencyUtils.getCurrency(session.bankroll)))
}
if (title.isEmpty()) {
title = context.getString(R.string.tournament).capitalize()
session.tournamentName?.let {
parameters.add(it.name)
} ?: run {
parameters.add(session.getGameTitle())
}
if (parameters.size == 0) {
parameters.add(context.getString(R.string.tournament).capitalize())
}
} else {
if (session.cgSmallBlind != null && session.cgBigBlind != null) {
title += session.getBlinds()
parameters.add(session.getBlinds())
}
session.game?.let {
title += (if (title.isNotEmpty()) " " else "") + session.getGameTitle()
parameters.add(session.getGameTitle())
}
if (title.isEmpty()) {
title = context.getString(R.string.cash_game).capitalize()
if (parameters.size == 0) {
parameters.add(context.getString(R.string.cash_game).capitalize())
}
}
val title = parameters.joinToString(separator = " ")
rowHistorySession.sessionTitle.text = title

Loading…
Cancel
Save