Refactor default String value “—“

feature/top10
Aurelien Hubert 7 years ago
parent cdef5222d0
commit ca07176c9f
  1. 32
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt

@ -214,7 +214,7 @@ open class Session : RealmObject(), SessionInterface, Savable,
* Return the formatted blinds
*/
fun getBlinds(): String {
return if (cgSmallBlind == null) "--" else "${cgSmallBlind?.toCurrency()}/${cgBigBlind?.round()}"
return if (cgSmallBlind == null) NULL_TEXT else "${cgSmallBlind?.toCurrency()}/${cgBigBlind?.round()}"
}
/**
@ -228,7 +228,7 @@ open class Session : RealmObject(), SessionInterface, Savable,
if (game != null) {
gameTitle += game?.name
}
return if (gameTitle.isNotBlank()) gameTitle else "--"
return if (gameTitle.isNotBlank()) gameTitle else NULL_TEXT
}
@ -383,23 +383,23 @@ open class Session : RealmObject(), SessionInterface, Savable,
override fun stringForRow(row: RowRepresentable, context: Context): String {
return when (row) {
SessionRow.BANKROLL -> bankroll?.name ?: "--"
SessionRow.BANKROLL -> bankroll?.name ?: NULL_TEXT
SessionRow.BLINDS -> getBlinds()
SessionRow.BREAK_TIME -> timeFrame?.breakDuration?.toMinutes() ?: "--"
SessionRow.BREAK_TIME -> timeFrame?.breakDuration?.toMinutes() ?: NULL_TEXT
SessionRow.BUY_IN -> buyin.toCurrency()
SessionRow.CASHED_OUT, SessionRow.PRIZE, SessionRow.NET_RESULT -> result?.cashout?.toCurrency() ?: "--"
SessionRow.COMMENT -> if (comment.isNotEmpty()) comment else "--"
SessionRow.END_DATE -> if (timeFrame != null) timeFrame?.endDate?.shortDateTime() ?: "--" else "--"
SessionRow.CASHED_OUT, SessionRow.PRIZE, SessionRow.NET_RESULT -> result?.cashout?.toCurrency() ?: NULL_TEXT
SessionRow.COMMENT -> if (comment.isNotEmpty()) comment else NULL_TEXT
SessionRow.END_DATE -> if (timeFrame != null) timeFrame?.endDate?.shortDateTime() ?: NULL_TEXT else NULL_TEXT
SessionRow.GAME -> getGameTitle()
SessionRow.INITIAL_BUY_IN -> tournamentEntryFee?.toCurrency() ?: "--"
SessionRow.LOCATION -> location?.name ?: "--"
SessionRow.PLAYERS -> tournamentNumberOfPlayers?.toString() ?: "--"
SessionRow.POSITION -> result?.tournamentFinalPosition?.toString() ?: "--"
SessionRow.START_DATE -> if (timeFrame != null) timeFrame?.startDate?.shortDateTime() ?: "--" else "--"
SessionRow.TABLE_SIZE -> this.tableSize?.let { TableSize(it).localizedTitle(context) } ?: "--"
SessionRow.TIPS -> result?.tips?.toCurrency() ?: "--"
SessionRow.TOURNAMENT_TYPE -> tournamentType?.name ?: "--"
else -> "--"
SessionRow.INITIAL_BUY_IN -> tournamentEntryFee?.toCurrency() ?: NULL_TEXT
SessionRow.LOCATION -> location?.name ?: NULL_TEXT
SessionRow.PLAYERS -> tournamentNumberOfPlayers?.toString() ?: NULL_TEXT
SessionRow.POSITION -> result?.tournamentFinalPosition?.toString() ?: NULL_TEXT
SessionRow.START_DATE -> if (timeFrame != null) timeFrame?.startDate?.shortDateTime() ?: NULL_TEXT else NULL_TEXT
SessionRow.TABLE_SIZE -> this.tableSize?.let { TableSize(it).localizedTitle(context) } ?: NULL_TEXT
SessionRow.TIPS -> result?.tips?.toCurrency() ?: NULL_TEXT
SessionRow.TOURNAMENT_TYPE -> tournamentType?.name ?: NULL_TEXT
else -> NULL_TEXT
}
}

Loading…
Cancel
Save