diff --git a/features/feature_statistics_detail/src/main/java/com/example/util/simpletimetracker/feature_statistics_detail/adapter/StatisticsDetailBlock.kt b/features/feature_statistics_detail/src/main/java/com/example/util/simpletimetracker/feature_statistics_detail/adapter/StatisticsDetailBlock.kt index 831fd00b1..426872ec6 100644 --- a/features/feature_statistics_detail/src/main/java/com/example/util/simpletimetracker/feature_statistics_detail/adapter/StatisticsDetailBlock.kt +++ b/features/feature_statistics_detail/src/main/java/com/example/util/simpletimetracker/feature_statistics_detail/adapter/StatisticsDetailBlock.kt @@ -34,6 +34,7 @@ enum class StatisticsDetailBlock { GoalChartGrouping, GoalChartLength, GoalRangeAverages, + GoalTotals, DataDistributionHint, DataDistributionPieChart, DataDistributionBarChart, diff --git a/features/feature_statistics_detail/src/main/java/com/example/util/simpletimetracker/feature_statistics_detail/customView/BarChartView.kt b/features/feature_statistics_detail/src/main/java/com/example/util/simpletimetracker/feature_statistics_detail/customView/BarChartView.kt index bb9343a07..e12a1475b 100644 --- a/features/feature_statistics_detail/src/main/java/com/example/util/simpletimetracker/feature_statistics_detail/customView/BarChartView.kt +++ b/features/feature_statistics_detail/src/main/java/com/example/util/simpletimetracker/feature_statistics_detail/customView/BarChartView.kt @@ -541,7 +541,7 @@ class BarChartView @JvmOverloads constructor( } private fun drawLines(canvas: Canvas) { - val points = (0..valueUpperBound step nearestValueStep).toList() + val points = (valueDownerBound..valueUpperBound step nearestValueStep).toList() points.forEachIndexed { index, _ -> canvas.drawLine( 0f, diff --git a/features/feature_statistics_detail/src/main/java/com/example/util/simpletimetracker/feature_statistics_detail/mapper/StatisticsDetailViewDataMapper.kt b/features/feature_statistics_detail/src/main/java/com/example/util/simpletimetracker/feature_statistics_detail/mapper/StatisticsDetailViewDataMapper.kt index 29e87e9ea..46d5e0a4a 100644 --- a/features/feature_statistics_detail/src/main/java/com/example/util/simpletimetracker/feature_statistics_detail/mapper/StatisticsDetailViewDataMapper.kt +++ b/features/feature_statistics_detail/src/main/java/com/example/util/simpletimetracker/feature_statistics_detail/mapper/StatisticsDetailViewDataMapper.kt @@ -730,12 +730,19 @@ class StatisticsDetailViewDataMapper @Inject constructor( availableChartLengths = availableChartLengths, appliedChartLength = appliedChartLength, ) - - items += StatisticsDetailHintViewData( - block = StatisticsDetailBlock.GoalExcessDeficitHint, - text = resourceRepo.getString(R.string.statistics_detail_goals_hint), + val goalTotals = mapGoalExcessDeficitTotals( + goalData = goalData, + useProportionalMinutes = useProportionalMinutes, + showSeconds = showSeconds, ) + if (chartData.visible) { + items += StatisticsDetailHintViewData( + block = StatisticsDetailBlock.GoalExcessDeficitHint, + text = resourceRepo.getString(R.string.statistics_detail_goals_hint), + ) + } + if (chartData.visible) { items += StatisticsDetailBarChartViewData( block = StatisticsDetailBlock.GoalChartData, @@ -770,6 +777,15 @@ class StatisticsDetailViewDataMapper @Inject constructor( ) } + if (chartData.visible) { + items += StatisticsDetailCardViewData( + block = StatisticsDetailBlock.GoalTotals, + title = "", + marginTopDp = 0, + data = goalTotals, + ) + } + return items } @@ -841,8 +857,53 @@ class StatisticsDetailViewDataMapper @Inject constructor( ).let(::listOf) } - // TODO GOAL mark zero line on bar chart, to be more visible. - // TODO GOAL add total excess and total deficit for selected range. + private fun mapGoalExcessDeficitTotals( + goalData: List, + useProportionalMinutes: Boolean, + showSeconds: Boolean, + ): List { + val barValues = goalData.map { bar -> bar.durations.sumOf { it.first } } + val negativeValue = barValues.filter { it < 0L }.sum() + val positiveValue = barValues.filter { it > 0L }.sum() + val total = negativeValue + positiveValue + + fun formatInterval( + interval: Long, + ): String { + return timeMapper.formatInterval( + interval = interval, + forceSeconds = showSeconds, + useProportionalMinutes = useProportionalMinutes, + ) + } + + return listOf( + StatisticsDetailCardInternalViewData( + value = formatInterval(negativeValue), + valueChange = StatisticsDetailCardInternalViewData.ValueChange.None, + secondValue = "", + description = resourceRepo.getString(R.string.statistics_detail_goals_deficit), + titleTextSizeSp = 14, + subtitleTextSizeSp = 12, + ), + StatisticsDetailCardInternalViewData( + value = formatInterval(total), + valueChange = StatisticsDetailCardInternalViewData.ValueChange.None, + secondValue = "", + description = resourceRepo.getString(R.string.statistics_detail_total_duration), + titleTextSizeSp = 14, + subtitleTextSizeSp = 12, + ), + StatisticsDetailCardInternalViewData( + value = formatInterval(positiveValue), + valueChange = StatisticsDetailCardInternalViewData.ValueChange.None, + secondValue = "", + description = resourceRepo.getString(R.string.statistics_detail_goals_excess), + titleTextSizeSp = 14, + subtitleTextSizeSp = 12, + ), + ) + } private fun mapToChartGroupingViewData( availableChartGroupings: List, diff --git a/resources/src/main/res/values-ar/strings.xml b/resources/src/main/res/values-ar/strings.xml index fa20bfd51..4f2d77fcf 100644 --- a/resources/src/main/res/values-ar/strings.xml +++ b/resources/src/main/res/values-ar/strings.xml @@ -474,6 +474,8 @@ أهم الأنشطة القادمة أعلى المهام المتعددة هدف فائض أو عجز + إفراط + العجز تتبع diff --git a/resources/src/main/res/values-ca/strings.xml b/resources/src/main/res/values-ca/strings.xml index de6ac8d7b..6a2bd7674 100644 --- a/resources/src/main/res/values-ca/strings.xml +++ b/resources/src/main/res/values-ca/strings.xml @@ -474,6 +474,8 @@ Exemple:
Les properes activitats principals Top multitasca Excés o dèficit d\'objectius + Excés + Dèficit diff --git a/resources/src/main/res/values-de/strings.xml b/resources/src/main/res/values-de/strings.xml index 68b695d73..fd1e85464 100644 --- a/resources/src/main/res/values-de/strings.xml +++ b/resources/src/main/res/values-de/strings.xml @@ -474,6 +474,8 @@ Beispiel:
Top nächste Aktivitäten Top Multitasking Zielüberschreitung oder -defizit + Überschuss + Defizit diff --git a/resources/src/main/res/values-es/strings.xml b/resources/src/main/res/values-es/strings.xml index c52f845cf..78546ec84 100644 --- a/resources/src/main/res/values-es/strings.xml +++ b/resources/src/main/res/values-es/strings.xml @@ -474,6 +474,8 @@ Ejemplo:
Principales próximas actividades Principal multitarea Exceso o déficit de goles + Exceso + Déficit diff --git a/resources/src/main/res/values-fa/strings.xml b/resources/src/main/res/values-fa/strings.xml index a46fd07ae..2296aac7e 100644 --- a/resources/src/main/res/values-fa/strings.xml +++ b/resources/src/main/res/values-fa/strings.xml @@ -474,6 +474,8 @@ برترین فعالیت های بعدی چند کاره برتر بیش از حد یا کسری هدف + مازاد + کسری diff --git a/resources/src/main/res/values-fr/strings.xml b/resources/src/main/res/values-fr/strings.xml index 712fbce34..824653ad7 100644 --- a/resources/src/main/res/values-fr/strings.xml +++ b/resources/src/main/res/values-fr/strings.xml @@ -474,6 +474,8 @@ Exemple:
Top des prochaines activités Top multitâche Excès ou déficit d\'objectif + Excès + Déficit diff --git a/resources/src/main/res/values-hi/strings.xml b/resources/src/main/res/values-hi/strings.xml index 6b3a7043c..9ae296db0 100644 --- a/resources/src/main/res/values-hi/strings.xml +++ b/resources/src/main/res/values-hi/strings.xml @@ -474,6 +474,8 @@ csv फ़ाइल में कॉमा से अलग किए गए य शीर्ष अगली गतिविधियाँ शीर्ष मल्टीटास्कड लक्ष्य की अधिकता या कमी + अधिकता + घाटा diff --git a/resources/src/main/res/values-in/strings.xml b/resources/src/main/res/values-in/strings.xml index 0ff35a3e8..4ed6a6383 100644 --- a/resources/src/main/res/values-in/strings.xml +++ b/resources/src/main/res/values-in/strings.xml @@ -474,6 +474,8 @@ Contoh:
Aktivitas teratas selanjutnya Multitugas teratas Kelebihan atau kekurangan gol + Kelebihan + Defisit diff --git a/resources/src/main/res/values-it/strings.xml b/resources/src/main/res/values-it/strings.xml index a96ae98b9..66c89522a 100644 --- a/resources/src/main/res/values-it/strings.xml +++ b/resources/src/main/res/values-it/strings.xml @@ -474,6 +474,8 @@ Esempio:
Le migliori attività successive Il massimo del multitasking Eccesso o deficit di obiettivo + Eccesso + Deficit diff --git a/resources/src/main/res/values-iw/strings.xml b/resources/src/main/res/values-iw/strings.xml index 99ca87ee8..cb4802e46 100644 --- a/resources/src/main/res/values-iw/strings.xml +++ b/resources/src/main/res/values-iw/strings.xml @@ -474,6 +474,8 @@ פעילויות באות מובילות ריבוי משימות מוביל עודף או גירעון יעד + עוֹדֶף + גֵרָעוֹן diff --git a/resources/src/main/res/values-ja/strings.xml b/resources/src/main/res/values-ja/strings.xml index e19541615..cc891e188 100644 --- a/resources/src/main/res/values-ja/strings.xml +++ b/resources/src/main/res/values-ja/strings.xml @@ -474,6 +474,8 @@ CSV ファイルには、カンマで区切られた次の列が含まれてい 次に注目のアクティビティ トップのマルチタスク 目標超過または不足 + 過剰 + 赤字 diff --git a/resources/src/main/res/values-ko/strings.xml b/resources/src/main/res/values-ko/strings.xml index e171498f8..adac05877 100644 --- a/resources/src/main/res/values-ko/strings.xml +++ b/resources/src/main/res/values-ko/strings.xml @@ -474,6 +474,8 @@ csv 파일은 다음과 같은 열(column)들을 가져야합니다:
다음 주요 활동 최고의 멀티태스킹 목표 초과 또는 적자 + 과잉 + 부족 diff --git a/resources/src/main/res/values-nl/strings.xml b/resources/src/main/res/values-nl/strings.xml index d6194b9b4..b9144483e 100644 --- a/resources/src/main/res/values-nl/strings.xml +++ b/resources/src/main/res/values-nl/strings.xml @@ -474,6 +474,8 @@ Voorbeeld:
Top volgende activiteiten Top multitasken Doeloverschot of -tekort + Overmaat + Tekort diff --git a/resources/src/main/res/values-pl/strings.xml b/resources/src/main/res/values-pl/strings.xml index 06fc7a09a..247114385 100644 --- a/resources/src/main/res/values-pl/strings.xml +++ b/resources/src/main/res/values-pl/strings.xml @@ -474,6 +474,8 @@ Przykład:
Bezpośrednio przed Najczęściej razem z Nadmiar lub niedobór celu + Nadmiar + Deficyt diff --git a/resources/src/main/res/values-pt-rPT/strings.xml b/resources/src/main/res/values-pt-rPT/strings.xml index cc194840f..7c356cc72 100644 --- a/resources/src/main/res/values-pt-rPT/strings.xml +++ b/resources/src/main/res/values-pt-rPT/strings.xml @@ -474,6 +474,8 @@ Exemplo:
Principais próximas atividades Principais multitarefas Excesso ou défice de meta + Excesso + Déficit diff --git a/resources/src/main/res/values-pt/strings.xml b/resources/src/main/res/values-pt/strings.xml index 64fed6a88..2fc8397c0 100644 --- a/resources/src/main/res/values-pt/strings.xml +++ b/resources/src/main/res/values-pt/strings.xml @@ -474,6 +474,8 @@ Exemplo:
Principais próximas atividades Principais multitarefas Excesso ou déficit de meta + Excesso + Déficit diff --git a/resources/src/main/res/values-ro/strings.xml b/resources/src/main/res/values-ro/strings.xml index 57613e4cc..256018e61 100644 --- a/resources/src/main/res/values-ro/strings.xml +++ b/resources/src/main/res/values-ro/strings.xml @@ -474,6 +474,8 @@ Examplu:
Top următoare activități Top multitasked Exces sau deficit de obiectiv + Exces + Deficit diff --git a/resources/src/main/res/values-ru/strings.xml b/resources/src/main/res/values-ru/strings.xml index 8ea6ff8c9..ce3cf5247 100644 --- a/resources/src/main/res/values-ru/strings.xml +++ b/resources/src/main/res/values-ru/strings.xml @@ -474,6 +474,8 @@ CSV-файл должен содержать следующие столбцы, Топ следующих активностей Топ многозадачности Превышение или дефицит цели + Превышение + Дефицит diff --git a/resources/src/main/res/values-sv/strings.xml b/resources/src/main/res/values-sv/strings.xml index b35dc1e5d..1c8dd628e 100644 --- a/resources/src/main/res/values-sv/strings.xml +++ b/resources/src/main/res/values-sv/strings.xml @@ -474,6 +474,8 @@ Exempel:
Topp nästa aktiviteter Top multitasked Målöverskott eller underskott + Överskott + Underskott diff --git a/resources/src/main/res/values-tr/strings.xml b/resources/src/main/res/values-tr/strings.xml index 175c5ebef..5c8caa059 100644 --- a/resources/src/main/res/values-tr/strings.xml +++ b/resources/src/main/res/values-tr/strings.xml @@ -474,6 +474,8 @@ CSV dosyası virgülle ayrılmış şu sütunları içermelidir:
Sonraki en iyi aktiviteler En iyi çoklu görev Hedef fazlası veya açığı + Aşırı + Açık diff --git a/resources/src/main/res/values-uk/strings.xml b/resources/src/main/res/values-uk/strings.xml index 17189a412..3e000dd50 100644 --- a/resources/src/main/res/values-uk/strings.xml +++ b/resources/src/main/res/values-uk/strings.xml @@ -474,6 +474,8 @@ Найчастіші наступні активності Топ багатозадачності Перевищення або дефіцит цілі + Перевищення + Дефіцит diff --git a/resources/src/main/res/values-vi/strings.xml b/resources/src/main/res/values-vi/strings.xml index d01445ccd..01b55e8cd 100644 --- a/resources/src/main/res/values-vi/strings.xml +++ b/resources/src/main/res/values-vi/strings.xml @@ -474,6 +474,8 @@ Ví dụ:
Hoạt động tiếp theo hàng đầu Đa nhiệm hàng đầu Mục tiêu vượt quá hoặc thâm hụt + Thặng dư + Thâm hụt diff --git a/resources/src/main/res/values-zh-rTW/strings.xml b/resources/src/main/res/values-zh-rTW/strings.xml index 62e6830a6..d8b74ea53 100644 --- a/resources/src/main/res/values-zh-rTW/strings.xml +++ b/resources/src/main/res/values-zh-rTW/strings.xml @@ -474,6 +474,8 @@ csv 文件必須包含以逗號分隔的這些列:
下一個熱門活動 頂級多工處理 目標超額或不足 + 過量的 + 赤字 diff --git a/resources/src/main/res/values-zh/strings.xml b/resources/src/main/res/values-zh/strings.xml index 93a11fdfe..7e61b114c 100644 --- a/resources/src/main/res/values-zh/strings.xml +++ b/resources/src/main/res/values-zh/strings.xml @@ -474,6 +474,8 @@ csv 文件必须包含以逗号分隔的这些列:
下一个热门活动 顶级多任务处理 目标超出或不足 + 过量的 + 赤字 diff --git a/resources/src/main/res/values/strings.xml b/resources/src/main/res/values/strings.xml index 195244879..0d62f7484 100644 --- a/resources/src/main/res/values/strings.xml +++ b/resources/src/main/res/values/strings.xml @@ -474,6 +474,8 @@ Example:
Top next activities Top multitasked Goal excess or deficit + Excess + Deficit Records