3 Commits

Author SHA1 Message Date
c636e48c7e layout: replace menu icon with utf8 character
The three dot menu icosn looks odd when stretched
due to the dynamic menu feature. Thus replace it
with the hamburger menu character that looks better
when scaled.
2026-01-12 22:46:05 +01:00
f39882edc4 MainActivity: sort events before saving
Also replace notifyItemInserted since it does not
call the adapter to redraw the row striping when
a new event is added.
2026-01-12 22:46:05 +01:00
0683f396ae StatisticsActivity: rework all statistics
Improve the overall code.
2026-01-12 22:46:02 +01:00

View File

@@ -149,10 +149,12 @@ class StatisticsActivity : AppCompatActivity() {
array[index].y += 1F
}
/*
Log.d(TAG, "values.size: ${values.size}")
for ((key, value) in values) {
Log.d(TAG, "key: $key, value.size: ${value.size} ,value: ${value.joinToString { it.y.toLong().toString() }}")
}
*/
// make sure legend names are not too long
fun shorten(notes: String): String {
@@ -794,10 +796,19 @@ class StatisticsActivity : AppCompatActivity() {
val month = dateTime.get(Calendar.MONTH) + 1 // month starts at 0
val week = dateTime.get(Calendar.WEEK_OF_YEAR)
val day = dateTime.get(Calendar.DAY_OF_MONTH)
// Dirty hack to get monotone number of weeks
// The first week if the year might start in the previous year.
val yearFixed = if (month == 12 && week == 1) {
year + 1
} else {
year
}
return when (timeRangeSelection) {
TimeRange.DAY -> "$day/$month/$year"
TimeRange.WEEK -> "$week/$year"
TimeRange.MONTH -> "$month/$year"
TimeRange.DAY -> "$day/$month/$yearFixed"
TimeRange.WEEK -> "$week/$yearFixed"
TimeRange.MONTH -> "$month/$yearFixed"
}
}
}
@@ -914,9 +925,10 @@ class StatisticsActivity : AppCompatActivity() {
dateTime.time = Date(seconds * 1000)
val years = dateTime.get(Calendar.YEAR) - 1970
val weeks = dateTime.get(Calendar.WEEK_OF_YEAR)
val month = dateTime.get(Calendar.MONTH)
// dirty hack to get monotone number of weeks
if (month == 11 && weeks == 1) {
val month = dateTime.get(Calendar.MONTH) + 1 // month starts at 0
if (month == 12 && weeks == 1) {
// The first week if the year might start in the previous year.
return 52 * (years + 1) + weeks
}