|
|
|
@ -88,31 +88,39 @@ class SessionRowView : FrameLayout { |
|
|
|
rowSession.sessionInfoDurationValue.isVisible = state.hasStarted |
|
|
|
rowSession.sessionInfoDurationValue.isVisible = state.hasStarted |
|
|
|
|
|
|
|
|
|
|
|
// State |
|
|
|
// State |
|
|
|
if (state == SessionState.STARTED) { |
|
|
|
when (state) { |
|
|
|
rowSession.gameResult.isVisible = false |
|
|
|
SessionState.STARTED -> { |
|
|
|
rowSession.infoIcon.isVisible = true |
|
|
|
rowSession.gameResult.isVisible = false |
|
|
|
rowSession.infoIcon.setImageResource(R.drawable.chip) |
|
|
|
rowSession.infoIcon.isVisible = true |
|
|
|
rowSession.infoTitle.isVisible = true |
|
|
|
rowSession.infoIcon.setImageResource(R.drawable.chip) |
|
|
|
rowSession.infoTitle.text = context.getString(R.string.running_session_state) |
|
|
|
rowSession.infoTitle.isVisible = true |
|
|
|
} else if (state == SessionState.PLANNED) { |
|
|
|
rowSession.infoTitle.text = context.getString(R.string.running_session_state) |
|
|
|
rowSession.gameResult.isVisible = false |
|
|
|
} |
|
|
|
rowSession.infoIcon.isVisible = true |
|
|
|
SessionState.PLANNED -> { |
|
|
|
rowSession.infoIcon.setImageResource(R.drawable.ic_planned) |
|
|
|
rowSession.gameResult.isVisible = false |
|
|
|
rowSession.infoTitle.isVisible = true |
|
|
|
rowSession.infoIcon.isVisible = true |
|
|
|
rowSession.infoTitle.text = session.startDate!!.shortTime() |
|
|
|
rowSession.infoIcon.setImageResource(R.drawable.ic_planned) |
|
|
|
} else if (state == SessionState.PENDING) { |
|
|
|
rowSession.infoTitle.isVisible = true |
|
|
|
rowSession.gameResult.isVisible = false |
|
|
|
rowSession.infoTitle.text = session.startDate!!.shortTime() |
|
|
|
rowSession.infoIcon.isVisible = false |
|
|
|
} |
|
|
|
rowSession.infoTitle.isVisible = false |
|
|
|
SessionState.PENDING -> { |
|
|
|
|
|
|
|
rowSession.gameResult.isVisible = false |
|
|
|
} else { |
|
|
|
rowSession.infoIcon.isVisible = false |
|
|
|
rowSession.gameResult.isVisible = true |
|
|
|
rowSession.infoTitle.isVisible = false |
|
|
|
rowSession.infoIcon.isVisible = false |
|
|
|
|
|
|
|
rowSession.infoTitle.isVisible = false |
|
|
|
} |
|
|
|
|
|
|
|
else -> { |
|
|
|
val result = session.result?.net ?: 0.0 |
|
|
|
rowSession.gameResult.isVisible = true |
|
|
|
val formattedStat = ComputedStat(Stat.NET_RESULT, result, currency = session.currency).format() |
|
|
|
rowSession.infoIcon.isVisible = false |
|
|
|
rowSession.gameResult.setTextFormat(formattedStat, context) |
|
|
|
rowSession.infoTitle.isVisible = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
session.result?.net?.let { netResult -> |
|
|
|
|
|
|
|
val stat = ComputedStat(Stat.NET_RESULT, netResult, currency = session.currency) |
|
|
|
|
|
|
|
rowSession.gameResult.setTextFormat(stat.format(), context) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// val formattedStat = ComputedStat(Stat.NET_RESULT, result, currency = session.currency).format() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|