diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 00ecb78..7b30f85 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -28,7 +28,7 @@ android { minSdk = 26 targetSdk = 36 versionCode = 1 - versionName = "1.0" + versionName = "1.0.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } @@ -38,9 +38,6 @@ android { applicationIdSuffix = ".dev" isDebuggable = true isMinifyEnabled = false - defaultConfig { - versionCode = 1 - } proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" @@ -50,9 +47,6 @@ android { isDebuggable = false isMinifyEnabled = true signingConfig = signingConfigs.getByName("pixelized") - defaultConfig { - versionCode = getGitBuildNumber() - } proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" @@ -110,19 +104,6 @@ dependencies { ksp("com.google.dagger:hilt-compiler:2.57.2") } -@Suppress("DEPRECATION") -private fun getGitBuildNumber( - charset: Charset = Charset.defaultCharset(), -): Int { - return ByteArrayOutputStream().use { stream -> - rootProject.exec { - commandLine("git", "rev-list", "--count", "HEAD") - standardOutput = stream - } - stream.toString(charset).trim().toIntOrNull() ?: 1 - } -} - fun SigningConfig.populatePixelizedSigningConfig() { storeFile = (project.properties["PIXELIZED_RELEASE_STORE_FILE"] as? String)?.let { file(it) } storePassword = project.properties["PIXELIZED_RELEASE_STORE_PASSWORD"] as? String diff --git a/app/release/baselineProfiles/0/app-release.dm b/app/release/baselineProfiles/0/app-release.dm deleted file mode 100644 index 5c6fb5a..0000000 Binary files a/app/release/baselineProfiles/0/app-release.dm and /dev/null differ diff --git a/app/release/baselineProfiles/1/app-release.dm b/app/release/baselineProfiles/1/app-release.dm deleted file mode 100644 index 5b90df9..0000000 Binary files a/app/release/baselineProfiles/1/app-release.dm and /dev/null differ diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json deleted file mode 100644 index 54e13b3..0000000 --- a/app/release/output-metadata.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "version": 3, - "artifactType": { - "type": "APK", - "kind": "Directory" - }, - "applicationId": "com.pixelized.headache", - "variantName": "release", - "elements": [ - { - "type": "SINGLE", - "filters": [], - "attributes": [], - "versionCode": 1, - "versionName": "1.0", - "outputFile": "app-release.apk" - } - ], - "elementType": "File", - "baselineProfiles": [ - { - "minApi": 28, - "maxApi": 30, - "baselineProfiles": [ - "baselineProfiles/1/app-release.dm" - ] - }, - { - "minApi": 31, - "maxApi": 2147483647, - "baselineProfiles": [ - "baselineProfiles/0/app-release.dm" - ] - } - ], - "minSdkVersionForDexing": 26 -} \ No newline at end of file diff --git a/app/src/main/java/com/pixelized/headache/ui/page/summary/monthly/MonthSummaryFactory.kt b/app/src/main/java/com/pixelized/headache/ui/page/summary/monthly/MonthSummaryFactory.kt index b25e9ac..534e593 100644 --- a/app/src/main/java/com/pixelized/headache/ui/page/summary/monthly/MonthSummaryFactory.kt +++ b/app/src/main/java/com/pixelized/headache/ui/page/summary/monthly/MonthSummaryFactory.kt @@ -62,6 +62,7 @@ class MonthSummaryFactory @Inject constructor() { ) } } + .sortedByDescending { it.date } .groupByMonth() .toSortedMap{s1, s2 -> when{ diff --git a/app/src/main/java/com/pixelized/headache/ui/page/summary/monthly/MonthSummaryPage.kt b/app/src/main/java/com/pixelized/headache/ui/page/summary/monthly/MonthSummaryPage.kt index 4d6d667..d33bca0 100644 --- a/app/src/main/java/com/pixelized/headache/ui/page/summary/monthly/MonthSummaryPage.kt +++ b/app/src/main/java/com/pixelized/headache/ui/page/summary/monthly/MonthSummaryPage.kt @@ -21,6 +21,7 @@ import androidx.compose.runtime.Stable import androidx.compose.runtime.State import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.keepScreenOn import androidx.compose.ui.tooling.preview.Preview @@ -90,14 +91,9 @@ private fun MonthSummaryContent( flingBehavior = flingBehavior, contentPadding = listPadding, verticalArrangement = Arrangement.spacedBy(space = spacing), - reverseLayout = false, + reverseLayout = true, ) { events.value.forEach { entry -> - item { - MonthSummaryTitle( - item = entry.key, - ) - } items( items = entry.value, key = { item -> item.date }, @@ -107,6 +103,11 @@ private fun MonthSummaryContent( onItem = onItem, ) } + item { + MonthSummaryTitle( + item = entry.key, + ) + } } } } diff --git a/app/src/main/java/com/pixelized/headache/ui/page/summary/report/ReportBox.kt b/app/src/main/java/com/pixelized/headache/ui/page/summary/report/ReportBox.kt index 13071a7..16fab59 100644 --- a/app/src/main/java/com/pixelized/headache/ui/page/summary/report/ReportBox.kt +++ b/app/src/main/java/com/pixelized/headache/ui/page/summary/report/ReportBox.kt @@ -1,18 +1,17 @@ package com.pixelized.headache.ui.page.summary.report -import android.R import android.annotation.SuppressLint import android.icu.text.DateFormat import android.icu.text.SimpleDateFormat import android.icu.util.Calendar import androidx.compose.foundation.background -import androidx.compose.foundation.border import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width @@ -153,13 +152,24 @@ private fun Month( ), contentAlignment = Alignment.TopCenter, ) { - Text( - style = MaterialTheme.typography.labelSmall, - overflow = TextOverflow.Ellipsis, - maxLines = 1, - color = Color.White, - text = stat.label, - ) + when (index == 0 && item.stats.size >= 2) { + true -> Text( + modifier = Modifier.offset(y = (-14).dp), + style = MaterialTheme.typography.labelSmall, + overflow = TextOverflow.Ellipsis, + maxLines = 1, + color = MaterialTheme.colorScheme.onSurface, + text = stat.label, + ) + + else -> Text( + style = MaterialTheme.typography.labelSmall, + overflow = TextOverflow.Ellipsis, + maxLines = 1, + color = Color.White, + text = stat.label, + ) + } } } } @@ -227,8 +237,8 @@ private class ReportBoxPreviewProvider : PreviewParameterProvider month(month = Calendar.JULY, headache = 7, pills = 3), month(month = Calendar.AUGUST, headache = 8, pills = 5), month(month = Calendar.SEPTEMBER, headache = 8, pills = 5), - month(month = Calendar.OCTOBER), - month(month = Calendar.NOVEMBER), + month(month = Calendar.OCTOBER, headache = 15, pills = 15), + month(month = Calendar.NOVEMBER, headache = 9, pills = 7), month(month = Calendar.DECEMBER), ) ) diff --git a/app/src/main/java/com/pixelized/headache/ui/page/summary/report/ReportFactory.kt b/app/src/main/java/com/pixelized/headache/ui/page/summary/report/ReportFactory.kt index b1d05cf..1b02f5f 100644 --- a/app/src/main/java/com/pixelized/headache/ui/page/summary/report/ReportFactory.kt +++ b/app/src/main/java/com/pixelized/headache/ui/page/summary/report/ReportFactory.kt @@ -38,17 +38,25 @@ class ReportFactory @Inject constructor() { year = yearEntry.key ) }.time, - stats = listOf( - ReportBoxUio.Bar( - color = HeadacheColorPalette.Calendar.Headache, - label = "$headache", - ratio = headache.toFloat() / dayInMonth.toFloat(), - ), - ReportBoxUio.Bar( - color = HeadacheColorPalette.Calendar.Pill, - label = "$pills", - ratio = pills.toFloat() / maxPillAmountPerMonth.toFloat(), - ), + stats = listOfNotNull( + if (headache > 0) { + ReportBoxUio.Bar( + color = HeadacheColorPalette.Calendar.Headache, + label = "$headache", + ratio = headache.toFloat() / dayInMonth.toFloat(), + ) + } else { + null + }, + if (pills > 0) { + ReportBoxUio.Bar( + color = HeadacheColorPalette.Calendar.Pill, + label = "$pills", + ratio = pills.toFloat() / maxPillAmountPerMonth.toFloat(), + ) + } else { + null + }, ).sortedByDescending { it.ratio }, ) } diff --git a/app/src/main/java/com/pixelized/headache/ui/page/summary/report/ReportPage.kt b/app/src/main/java/com/pixelized/headache/ui/page/summary/report/ReportPage.kt index a824989..4d45fd1 100644 --- a/app/src/main/java/com/pixelized/headache/ui/page/summary/report/ReportPage.kt +++ b/app/src/main/java/com/pixelized/headache/ui/page/summary/report/ReportPage.kt @@ -91,6 +91,7 @@ private fun ReportContent( state = state, flingBehavior = flingBehavior, contentPadding = paddingValues, + reverseLayout = true, verticalArrangement = Arrangement.spacedBy(space = contentSpace), ) { items( @@ -158,9 +159,9 @@ private class ReportPreviewProvider : PreviewParameterProvider { val monthFirstDayCalendar = Calendar.getInstance().apply { firstDayOfWeek = Calendar.MONDAY - setMinimalDaysInFirstWeek(1) + minimalDaysInFirstWeek = 1 } val monthLastDayCalendar = Calendar.getInstance().apply { firstDayOfWeek = Calendar.MONDAY - setMinimalDaysInFirstWeek(1) + minimalDaysInFirstWeek = 1 } val currentDayCalendar = Calendar.getInstance().apply { firstDayOfWeek = Calendar.MONDAY - setMinimalDaysInFirstWeek(1) + minimalDaysInFirstWeek = 1 } return events @@ -73,6 +73,14 @@ class YearSummaryFactory @Inject constructor() { date = monthFirstDayCalendar.time, weeks = weeks, ) + }.sortedWith { s1, s2 -> + when { + s1.date.month / 3 < s2.date.month / 3 -> 1 + s1.date.month / 3 > s2.date.month / 3 -> -1 + s1.date.month < s2.date.month -> -1 + s1.date.month > s2.date.month -> 1 + else -> 0 + } }, ) } diff --git a/app/src/main/java/com/pixelized/headache/ui/page/summary/yearly/YearSummaryPage.kt b/app/src/main/java/com/pixelized/headache/ui/page/summary/yearly/YearSummaryPage.kt index c271c11..140f877 100644 --- a/app/src/main/java/com/pixelized/headache/ui/page/summary/yearly/YearSummaryPage.kt +++ b/app/src/main/java/com/pixelized/headache/ui/page/summary/yearly/YearSummaryPage.kt @@ -111,19 +111,10 @@ fun YearSummaryContent( columns = GridCells.Adaptive(minSize = daySize * 7), horizontalArrangement = Arrangement.spacedBy(space = space), verticalArrangement = Arrangement.spacedBy(space = space), + reverseLayout = true, contentPadding = paddingValues, ) { uio.value.forEachIndexed { index, (year, months) -> - item( - span = { GridItemSpan(maxLineSpan) }, - contentType = { "Title" }, - ) { - Text( - modifier = Modifier.padding(top = 16.dp), - style = MaterialTheme.typography.displaySmall, - text = "$year", - ) - } items( items = months, key = { it.date.time }, @@ -137,6 +128,16 @@ fun YearSummaryContent( onMonth = onMonth, ) } + item( + span = { GridItemSpan(maxLineSpan) }, + contentType = { "Title" }, + ) { + Text( + modifier = Modifier.padding(top = 16.dp), + style = MaterialTheme.typography.displaySmall, + text = "$year", + ) + } } } }