From ca07176c9f08c1de8e586b0059b95d11738be99c Mon Sep 17 00:00:00 2001 From: Aurelien Hubert Date: Wed, 6 Mar 2019 10:06:52 +0100 Subject: [PATCH] =?UTF-8?q?Refactor=20default=20String=20value=20=E2=80=9C?= =?UTF-8?q?=E2=80=94=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/model/realm/Session.kt | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt b/app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt index a93e0cc1..eaea5c5e 100644 --- a/app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt +++ b/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 } }