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 * Return the game title
* Example: NL Holdem
*/ */
fun getGameTitle(): String { fun getGameTitle(): String {
var gameTitle = "" var gameTitle = ""

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

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

Loading…
Cancel
Save