forked from penguin86/luna-tracker
Compare commits
3 Commits
c636e48c7e
...
0cc9dc53fe
| Author | SHA1 | Date | |
|---|---|---|---|
| 0cc9dc53fe | |||
| 77f5ef28b7 | |||
| 9c8bf7c761 |
@@ -31,7 +31,7 @@ import kotlin.math.abs
|
|||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
class StatisticsActivity : AppCompatActivity() {
|
class StatisticsActivity : AppCompatActivity() {
|
||||||
var lastToastShown = 0L
|
var lastToastShown = 0L
|
||||||
|
|
||||||
lateinit var barChart: BarChart
|
lateinit var barChart: BarChart
|
||||||
@@ -149,12 +149,10 @@ class StatisticsActivity : AppCompatActivity() {
|
|||||||
array[index].y += 1F
|
array[index].y += 1F
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Log.d(TAG, "values.size: ${values.size}")
|
Log.d(TAG, "values.size: ${values.size}")
|
||||||
for ((key, value) in values) {
|
for ((key, value) in values) {
|
||||||
Log.d(TAG, "key: $key, value.size: ${value.size} ,value: ${value.joinToString { it.y.toLong().toString() }}")
|
Log.d(TAG, "key: $key, value.size: ${value.size} ,value: ${value.joinToString { it.y.toLong().toString() }}")
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// make sure legend names are not too long
|
// make sure legend names are not too long
|
||||||
fun shorten(notes: String): String {
|
fun shorten(notes: String): String {
|
||||||
@@ -796,19 +794,10 @@ class StatisticsActivity : AppCompatActivity() {
|
|||||||
val month = dateTime.get(Calendar.MONTH) + 1 // month starts at 0
|
val month = dateTime.get(Calendar.MONTH) + 1 // month starts at 0
|
||||||
val week = dateTime.get(Calendar.WEEK_OF_YEAR)
|
val week = dateTime.get(Calendar.WEEK_OF_YEAR)
|
||||||
val day = dateTime.get(Calendar.DAY_OF_MONTH)
|
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) {
|
return when (timeRangeSelection) {
|
||||||
TimeRange.DAY -> "$day/$month/$yearFixed"
|
TimeRange.DAY -> "$day/$month/$year"
|
||||||
TimeRange.WEEK -> "$week/$yearFixed"
|
TimeRange.WEEK -> "$week/$year"
|
||||||
TimeRange.MONTH -> "$month/$yearFixed"
|
TimeRange.MONTH -> "$month/$year"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -925,10 +914,9 @@ class StatisticsActivity : AppCompatActivity() {
|
|||||||
dateTime.time = Date(seconds * 1000)
|
dateTime.time = Date(seconds * 1000)
|
||||||
val years = dateTime.get(Calendar.YEAR) - 1970
|
val years = dateTime.get(Calendar.YEAR) - 1970
|
||||||
val weeks = dateTime.get(Calendar.WEEK_OF_YEAR)
|
val weeks = dateTime.get(Calendar.WEEK_OF_YEAR)
|
||||||
val month = dateTime.get(Calendar.MONTH) + 1 // month starts at 0
|
val month = dateTime.get(Calendar.MONTH)
|
||||||
|
// dirty hack to get monotone number of weeks
|
||||||
if (month == 12 && weeks == 1) {
|
if (month == 11 && weeks == 1) {
|
||||||
// The first week if the year might start in the previous year.
|
|
||||||
return 52 * (years + 1) + weeks
|
return 52 * (years + 1) + weeks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user