diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 815f6b1..f587fed 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -15,8 +15,8 @@ android { applicationId = "de.timklge.karooheadwind" minSdk = 26 targetSdk = 35 - versionCode = 8 - versionName = "1.2" + versionCode = 9 + versionName = "1.2.1" } signingConfigs { diff --git a/app/manifest.json b/app/manifest.json index 8373ae6..4c8f8c9 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -3,9 +3,9 @@ "packageName": "de.timklge.karooheadwind", "iconUrl": "https://github.com/timklge/karoo-headwind/releases/latest/download/karoo-headwind.png", "latestApkUrl": "https://github.com/timklge/karoo-headwind/releases/latest/download/app-release.apk", - "latestVersion": "1.2", - "latestVersionCode": 8, + "latestVersion": "1.2.1", + "latestVersionCode": 9, "developer": "timklge", "description": "Provides headwind direction, wind speed and other weather data fields", - "releaseNotes": "Add tailwind and ride speed data field, Add error indication in data fields, Add date on weather data fields, Add preview of data fields when editing profiles" + "releaseNotes": "Add tailwind and ride speed data field, reduce font size in tailwind indicators" } \ No newline at end of file diff --git a/app/src/main/kotlin/de/timklge/karooheadwind/KarooHeadwindExtension.kt b/app/src/main/kotlin/de/timklge/karooheadwind/KarooHeadwindExtension.kt index 70fee64..f178061 100644 --- a/app/src/main/kotlin/de/timklge/karooheadwind/KarooHeadwindExtension.kt +++ b/app/src/main/kotlin/de/timklge/karooheadwind/KarooHeadwindExtension.kt @@ -41,7 +41,7 @@ import kotlin.math.absoluteValue import kotlin.time.Duration.Companion.hours import kotlin.time.Duration.Companion.minutes -class KarooHeadwindExtension : KarooExtension("karoo-headwind", "1.2") { +class KarooHeadwindExtension : KarooExtension("karoo-headwind", "1.2.1") { companion object { const val TAG = "karoo-headwind" } diff --git a/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/HeadwindDirectionDataType.kt b/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/HeadwindDirectionDataType.kt index a5bf09b..03c6a64 100644 --- a/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/HeadwindDirectionDataType.kt +++ b/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/HeadwindDirectionDataType.kt @@ -122,7 +122,7 @@ class HeadwindDirectionDataType( } val result = glance.compose(context, DpSize.Unspecified) { - HeadwindDirection(baseBitmap, windDirection.roundToInt(), config.textSize, text) + HeadwindDirection(baseBitmap, windDirection.roundToInt(), config.textSize, text, viewSize = config.viewSize) } emitter.updateView(result.remoteViews) diff --git a/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/HeadwindDirectionView.kt b/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/HeadwindDirectionView.kt index 34481df..37fd07e 100644 --- a/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/HeadwindDirectionView.kt +++ b/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/HeadwindDirectionView.kt @@ -19,18 +19,15 @@ import androidx.glance.layout.Box import androidx.glance.layout.Column import androidx.glance.layout.ContentScale import androidx.glance.layout.Row -import androidx.glance.layout.fillMaxHeight import androidx.glance.layout.fillMaxSize import androidx.glance.layout.padding -import androidx.glance.layout.width +import androidx.glance.layout.size import androidx.glance.preview.ExperimentalGlancePreviewApi -import androidx.glance.preview.Preview import androidx.glance.text.FontFamily import androidx.glance.text.FontWeight import androidx.glance.text.Text import androidx.glance.text.TextStyle import de.timklge.karooheadwind.KarooHeadwindExtension -import de.timklge.karooheadwind.R import kotlin.math.roundToInt data class BitmapWithBearing(val bitmap: Bitmap, val bearing: Int) @@ -69,9 +66,11 @@ fun getArrowBitmapByBearing(baseBitmap: Bitmap, bearing: Int): Bitmap { } @OptIn(ExperimentalGlancePreviewApi::class) -@Preview(widthDp = 200, heightDp = 150) @Composable -fun HeadwindDirection(baseBitmap: Bitmap, bearing: Int, fontSize: Int, overlayText: String, overlaySubText: String? = null, dayColor: Color = Color.Black, nightColor: Color = Color.White) { +fun HeadwindDirection(baseBitmap: Bitmap, bearing: Int, fontSize: Int, + overlayText: String, overlaySubText: String? = null, + dayColor: Color = Color.Black, nightColor: Color = Color.White, + viewSize: Pair) { Box( modifier = GlanceModifier.fillMaxSize().padding(5.dp), contentAlignment = Alignment( @@ -97,21 +96,22 @@ fun HeadwindDirection(baseBitmap: Bitmap, bearing: Int, fontSize: Int, overlayTe ) } else { Row(modifier = GlanceModifier.fillMaxSize(), verticalAlignment = Alignment.CenterVertically) { - Column(modifier = GlanceModifier.defaultWeight()){ - Image( - provider = ImageProvider(getArrowBitmapByBearing(baseBitmap, bearing)), - contentDescription = "Relative wind direction indicator", - contentScale = ContentScale.Fit, - colorFilter = ColorFilter.tint(ColorProvider(dayColor, nightColor)) - ) + Column(horizontalAlignment = Alignment.CenterHorizontally, verticalAlignment = Alignment.CenterVertically) { + Column(modifier = GlanceModifier.size(40.dp)) { + Image( + provider = ImageProvider(getArrowBitmapByBearing(baseBitmap, bearing)), + contentDescription = "Relative wind direction indicator", + contentScale = ContentScale.Fit, + colorFilter = ColorFilter.tint(ColorProvider(dayColor, nightColor)) + ) + } } Column(modifier = GlanceModifier.defaultWeight(), horizontalAlignment = Alignment.Horizontal.CenterHorizontally) { - Text( overlayText, maxLines = 1, - style = TextStyle(ColorProvider(dayColor, nightColor), fontSize = (0.7 * fontSize).sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Bold), + style = TextStyle(ColorProvider(dayColor, nightColor), fontSize = (0.65 * fontSize).sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Bold), modifier = GlanceModifier.background(Color(1f, 1f, 1f, 0.4f), Color(0f, 0f, 0f, 0.4f)).padding(1.dp) ) diff --git a/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/TailwindAndRideSpeedDataType.kt b/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/TailwindAndRideSpeedDataType.kt index 95504c8..d73f801 100644 --- a/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/TailwindAndRideSpeedDataType.kt +++ b/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/TailwindAndRideSpeedDataType.kt @@ -200,7 +200,7 @@ class TailwindAndRideSpeedDataType( val result = glance.compose(context, DpSize.Unspecified) { HeadwindDirection(baseBitmap, windDirection.roundToInt(), config.textSize, text, subtextWithSign, - dayColor, nightColor) + dayColor, nightColor, viewSize = config.viewSize) } emitter.updateView(result.remoteViews)