|
|
|
|
@ -10,7 +10,7 @@ import kotlinx.android.synthetic.main.fragment_stats.* |
|
|
|
|
import kotlinx.coroutines.* |
|
|
|
|
import net.pokeranalytics.android.R |
|
|
|
|
import net.pokeranalytics.android.calculus.* |
|
|
|
|
import net.pokeranalytics.android.model.StatRepresentable |
|
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.StatRow |
|
|
|
|
import net.pokeranalytics.android.model.filter.QueryCondition |
|
|
|
|
import net.pokeranalytics.android.ui.activity.StatisticDetailsActivity |
|
|
|
|
import net.pokeranalytics.android.ui.adapter.DisplayDescriptor |
|
|
|
|
@ -74,7 +74,7 @@ class StatsFragment : SessionObserverFragment(), StaticRowRepresentableDataSourc |
|
|
|
|
override fun contentDescriptorForRow(row: RowRepresentable): DisplayDescriptor? { |
|
|
|
|
val dc = DisplayDescriptor() |
|
|
|
|
dc.textFormat = TextFormat(NULL_TEXT) |
|
|
|
|
if (row is StatRepresentable) { |
|
|
|
|
if (row is StatRow) { |
|
|
|
|
context?.let { context -> |
|
|
|
|
row.computedStat?.let { |
|
|
|
|
dc.textFormat = it.format(context) |
|
|
|
|
@ -85,7 +85,7 @@ class StatsFragment : SessionObserverFragment(), StaticRowRepresentableDataSourc |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun statFormatForRow(row: RowRepresentable): TextFormat { |
|
|
|
|
if (row is StatRepresentable) { |
|
|
|
|
if (row is StatRow) { |
|
|
|
|
context?.let { context -> |
|
|
|
|
row.computedStat?.let { return it.format(context) } |
|
|
|
|
} |
|
|
|
|
@ -210,7 +210,7 @@ class StatsFragment : SessionObserverFragment(), StaticRowRepresentableDataSourc |
|
|
|
|
report.results.forEach { result -> |
|
|
|
|
rows.add(CustomizableRowRepresentable(title = result.group.name)) |
|
|
|
|
result.group.stats?.forEach { stat -> |
|
|
|
|
rows.add(StatRepresentable(stat, result.computedStat(stat), result.group.name)) |
|
|
|
|
rows.add(StatRow(stat, result.computedStat(stat), result.group.name)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -221,7 +221,7 @@ class StatsFragment : SessionObserverFragment(), StaticRowRepresentableDataSourc |
|
|
|
|
|
|
|
|
|
override fun onRowSelected(position: Int, row: RowRepresentable, fromAction: Boolean) { |
|
|
|
|
|
|
|
|
|
if (row is StatRepresentable && row.stat.hasEvolutionGraph) { |
|
|
|
|
if (row is StatRow && row.stat.hasEvolutionGraph) { |
|
|
|
|
|
|
|
|
|
// filter groups |
|
|
|
|
val groupResults = this.report?.results?.filter { |
|
|
|
|
|