|
|
|
@ -28,6 +28,7 @@ import net.pokeranalytics.android.ui.view.RowViewType |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.SeparatorRowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.SeparatorRowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.SessionRow |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.SessionRow |
|
|
|
|
|
|
|
import net.pokeranalytics.android.util.CurrencyUtils |
|
|
|
import net.pokeranalytics.android.util.NULL_TEXT |
|
|
|
import net.pokeranalytics.android.util.NULL_TEXT |
|
|
|
import net.pokeranalytics.android.util.extensions.* |
|
|
|
import net.pokeranalytics.android.util.extensions.* |
|
|
|
import java.util.* |
|
|
|
import java.util.* |
|
|
|
@ -484,7 +485,7 @@ open class Session : RealmObject(), Manageable, StaticRowRepresentableDataSource |
|
|
|
CustomizableRowRepresentable( |
|
|
|
CustomizableRowRepresentable( |
|
|
|
RowViewType.HEADER_TITLE_AMOUNT_BIG, |
|
|
|
RowViewType.HEADER_TITLE_AMOUNT_BIG, |
|
|
|
title = getFormattedDuration(), |
|
|
|
title = getFormattedDuration(), |
|
|
|
computedStat = ComputedStat(Stat.NETRESULT, result?.net ?: 0.0) |
|
|
|
computedStat = ComputedStat(Stat.NETRESULT, result?.net ?: 0.0, CurrencyUtils.getCurrency(bankroll)) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
rows.add(SeparatorRowRepresentable()) |
|
|
|
rows.add(SeparatorRowRepresentable()) |
|
|
|
@ -494,7 +495,7 @@ open class Session : RealmObject(), Manageable, StaticRowRepresentableDataSource |
|
|
|
CustomizableRowRepresentable( |
|
|
|
CustomizableRowRepresentable( |
|
|
|
RowViewType.HEADER_TITLE_AMOUNT_BIG, |
|
|
|
RowViewType.HEADER_TITLE_AMOUNT_BIG, |
|
|
|
resId = R.string.pause, |
|
|
|
resId = R.string.pause, |
|
|
|
computedStat = ComputedStat(Stat.NETRESULT, result?.net ?: 0.0) |
|
|
|
computedStat = ComputedStat(Stat.NETRESULT, result?.net ?: 0.0, CurrencyUtils.getCurrency(bankroll)) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
rows.add(SeparatorRowRepresentable()) |
|
|
|
rows.add(SeparatorRowRepresentable()) |
|
|
|
@ -504,14 +505,14 @@ open class Session : RealmObject(), Manageable, StaticRowRepresentableDataSource |
|
|
|
CustomizableRowRepresentable( |
|
|
|
CustomizableRowRepresentable( |
|
|
|
RowViewType.HEADER_TITLE_AMOUNT_BIG, |
|
|
|
RowViewType.HEADER_TITLE_AMOUNT_BIG, |
|
|
|
title = getFormattedDuration(), |
|
|
|
title = getFormattedDuration(), |
|
|
|
computedStat = ComputedStat(Stat.NETRESULT, result?.net ?: 0.0) |
|
|
|
computedStat = ComputedStat(Stat.NETRESULT, result?.net ?: 0.0, CurrencyUtils.getCurrency(bankroll)) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
rows.add( |
|
|
|
rows.add( |
|
|
|
CustomizableRowRepresentable( |
|
|
|
CustomizableRowRepresentable( |
|
|
|
RowViewType.HEADER_TITLE_AMOUNT, |
|
|
|
RowViewType.HEADER_TITLE_AMOUNT, |
|
|
|
resId = R.string.hour_rate_without_pauses, |
|
|
|
resId = R.string.hour_rate_without_pauses, |
|
|
|
computedStat = ComputedStat(Stat.HOURLY_RATE, this.hourlyRate) |
|
|
|
computedStat = ComputedStat(Stat.HOURLY_RATE, this.hourlyRate, CurrencyUtils.getCurrency(bankroll)) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
@ -520,7 +521,7 @@ open class Session : RealmObject(), Manageable, StaticRowRepresentableDataSource |
|
|
|
CustomizableRowRepresentable( |
|
|
|
CustomizableRowRepresentable( |
|
|
|
RowViewType.HEADER_TITLE_VALUE, |
|
|
|
RowViewType.HEADER_TITLE_VALUE, |
|
|
|
resId = R.string.bankroll_variation, |
|
|
|
resId = R.string.bankroll_variation, |
|
|
|
computedStat = ComputedStat(Stat.HOURLY_RATE, 0.0) |
|
|
|
computedStat = ComputedStat(Stat.HOURLY_RATE, 0.0, CurrencyUtils.getCurrency(bankroll)) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -553,18 +554,18 @@ open class Session : RealmObject(), Manageable, StaticRowRepresentableDataSource |
|
|
|
SessionRow.BANKROLL -> bankroll?.name ?: NULL_TEXT |
|
|
|
SessionRow.BANKROLL -> bankroll?.name ?: NULL_TEXT |
|
|
|
SessionRow.BLINDS -> getBlinds() |
|
|
|
SessionRow.BLINDS -> getBlinds() |
|
|
|
SessionRow.BREAK_TIME -> if (this.breakDuration > 0.0) this.breakDuration.toMinutes() else NULL_TEXT |
|
|
|
SessionRow.BREAK_TIME -> if (this.breakDuration > 0.0) this.breakDuration.toMinutes() else NULL_TEXT |
|
|
|
SessionRow.BUY_IN -> this.result?.buyin?.toCurrency() ?: NULL_TEXT |
|
|
|
SessionRow.BUY_IN -> this.result?.buyin?.toCurrency(CurrencyUtils.getCurrency(bankroll)) ?: NULL_TEXT |
|
|
|
SessionRow.CASHED_OUT, SessionRow.PRIZE, SessionRow.NET_RESULT -> this.result?.cashout?.toCurrency() ?: NULL_TEXT |
|
|
|
SessionRow.CASHED_OUT, SessionRow.PRIZE, SessionRow.NET_RESULT -> this.result?.cashout?.toCurrency(CurrencyUtils.getCurrency(bankroll)) ?: NULL_TEXT |
|
|
|
SessionRow.COMMENT -> if (this.comment.isNotEmpty()) this.comment else NULL_TEXT |
|
|
|
SessionRow.COMMENT -> if (this.comment.isNotEmpty()) this.comment else NULL_TEXT |
|
|
|
SessionRow.END_DATE -> this.endDate?.shortDateTime() ?: NULL_TEXT |
|
|
|
SessionRow.END_DATE -> this.endDate?.shortDateTime() ?: NULL_TEXT |
|
|
|
SessionRow.GAME -> getGameTitle() |
|
|
|
SessionRow.GAME -> getGameTitle() |
|
|
|
SessionRow.INITIAL_BUY_IN -> tournamentEntryFee?.toCurrency() ?: NULL_TEXT |
|
|
|
SessionRow.INITIAL_BUY_IN -> tournamentEntryFee?.toCurrency(CurrencyUtils.getCurrency(bankroll)) ?: NULL_TEXT |
|
|
|
SessionRow.LOCATION -> location?.name ?: NULL_TEXT |
|
|
|
SessionRow.LOCATION -> location?.name ?: NULL_TEXT |
|
|
|
SessionRow.PLAYERS -> tournamentNumberOfPlayers?.toString() ?: NULL_TEXT |
|
|
|
SessionRow.PLAYERS -> tournamentNumberOfPlayers?.toString() ?: NULL_TEXT |
|
|
|
SessionRow.POSITION -> result?.tournamentFinalPosition?.toString() ?: NULL_TEXT |
|
|
|
SessionRow.POSITION -> result?.tournamentFinalPosition?.toString() ?: NULL_TEXT |
|
|
|
SessionRow.START_DATE -> this.startDate?.shortDateTime() ?: NULL_TEXT |
|
|
|
SessionRow.START_DATE -> this.startDate?.shortDateTime() ?: NULL_TEXT |
|
|
|
SessionRow.TABLE_SIZE -> this.tableSize?.let { TableSize(it).localizedTitle(context) } ?: NULL_TEXT |
|
|
|
SessionRow.TABLE_SIZE -> this.tableSize?.let { TableSize(it).localizedTitle(context) } ?: NULL_TEXT |
|
|
|
SessionRow.TIPS -> result?.tips?.toCurrency() ?: NULL_TEXT |
|
|
|
SessionRow.TIPS -> result?.tips?.toCurrency(CurrencyUtils.getCurrency(bankroll)) ?: NULL_TEXT |
|
|
|
SessionRow.TOURNAMENT_TYPE -> this.tournamentType?.let { |
|
|
|
SessionRow.TOURNAMENT_TYPE -> this.tournamentType?.let { |
|
|
|
TournamentType.values()[it].localizedTitle(context) |
|
|
|
TournamentType.values()[it].localizedTitle(context) |
|
|
|
} ?: run { |
|
|
|
} ?: run { |
|
|
|
@ -575,10 +576,12 @@ open class Session : RealmObject(), Manageable, StaticRowRepresentableDataSource |
|
|
|
"${tournamentFeatures.subList(0,2).joinToString { |
|
|
|
"${tournamentFeatures.subList(0,2).joinToString { |
|
|
|
it.name |
|
|
|
it.name |
|
|
|
}}, ..." |
|
|
|
}}, ..." |
|
|
|
} else { |
|
|
|
} else if (tournamentFeatures.size > 0) { |
|
|
|
tournamentFeatures.joinToString { |
|
|
|
tournamentFeatures.joinToString { |
|
|
|
it.name |
|
|
|
it.name |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
NULL_TEXT |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
SessionRow.TOURNAMENT_NAME -> tournamentName?.name ?: NULL_TEXT |
|
|
|
SessionRow.TOURNAMENT_NAME -> tournamentName?.name ?: NULL_TEXT |
|
|
|
@ -681,6 +684,7 @@ open class Session : RealmObject(), Manageable, StaticRowRepresentableDataSource |
|
|
|
val localResult = if (result != null) result as Result else realm.createObject(Result::class.java) |
|
|
|
val localResult = if (result != null) result as Result else realm.createObject(Result::class.java) |
|
|
|
localResult.buyin = value as Double? |
|
|
|
localResult.buyin = value as Double? |
|
|
|
result = localResult |
|
|
|
result = localResult |
|
|
|
|
|
|
|
this.updateRowRepresentation() |
|
|
|
} |
|
|
|
} |
|
|
|
SessionRow.CASHED_OUT, SessionRow.PRIZE, SessionRow.NET_RESULT -> { |
|
|
|
SessionRow.CASHED_OUT, SessionRow.PRIZE, SessionRow.NET_RESULT -> { |
|
|
|
val localResult = if (result != null) result as Result else realm.createObject(Result::class.java) |
|
|
|
val localResult = if (result != null) result as Result else realm.createObject(Result::class.java) |
|
|
|
|