From 405ac674d40bcc74ceb683dae7f307f7fe01e4a8 Mon Sep 17 00:00:00 2001 From: Aurelien Hubert Date: Tue, 16 Apr 2019 11:28:21 +0200 Subject: [PATCH] Add selectable --- .../android/ui/fragment/CalendarFragment.kt | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/net/pokeranalytics/android/ui/fragment/CalendarFragment.kt b/app/src/main/java/net/pokeranalytics/android/ui/fragment/CalendarFragment.kt index c1356ac8..40056063 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/fragment/CalendarFragment.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/fragment/CalendarFragment.kt @@ -91,6 +91,10 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep return rows } + override fun onRowSelected(position: Int, row: RowRepresentable, fromAction: Boolean) { + //toast("Open $row") + } + // Business @@ -268,10 +272,10 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep sortedMonthlyReports = monthlyReports.toSortedMap(compareByDescending { it }) sortedYearlyReports = yearlyReports.toSortedMap(compareByDescending { it }) - // Logs - /* Timber.d("Computation: ${System.currentTimeMillis() - startDate.time}ms") + // Logs + /* Timber.d("========== YEAR x MONTH") sortedMonthlyReports.keys.forEach { Timber.d("$it => ${sortedMonthlyReports[it]?.computedStat(Stat.NETRESULT)?.value}") @@ -286,9 +290,7 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep GlobalScope.launch(Dispatchers.Main) { displayData() } - } - } /** @@ -304,9 +306,7 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep // Create monthly reports TimeFilter.MONTH -> { - val years: ArrayList = ArrayList() - sortedMonthlyReports.keys.forEach { date -> if (!years.contains(date.getDateYear())) { years.add(date.getDateYear()) @@ -323,7 +323,8 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep CustomizableRowRepresentable( customViewType = RowViewType.TITLE_VALUE_ARROW, title = date.getDateMonth(), - computedStat = computedStat + computedStat = computedStat, + isSelectable = true ) ) } @@ -332,21 +333,19 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep // Create yearly reports TimeFilter.YEAR -> { - sortedYearlyReports.keys.forEach { date -> - Timber.d("$date => ${sortedYearlyReports[date]?.computedStat(Stat.NETRESULT)?.value}") sortedYearlyReports[date]?.computedStat(currentStat)?.let { computedStat -> rows.add( CustomizableRowRepresentable( customViewType = RowViewType.TITLE_VALUE_ARROW, title = date.getDateYear(), - computedStat = computedStat + computedStat = computedStat, + isSelectable = true ) ) } } } - } Timber.d("Display data: ${System.currentTimeMillis() - startDate.time}ms")