From 4049e3ac550dd106a24fd1916db498a27b4377ee Mon Sep 17 00:00:00 2001 From: Michael Bukachi Date: Wed, 8 Nov 2023 13:21:38 +0300 Subject: [PATCH] fix: Fix broken organizer images --- gradle/libs.versions.toml | 7 ++++--- .../common/components/OrganizedBySection.kt | 19 ++++++++++++++----- presentation/src/main/res/values/strings.xml | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4b20d07e..40db8bc8 100755 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -29,7 +29,7 @@ hiltsecond = "1.1.0-rc01" runtime = "2.8.1" material = "1.10.0" junit = "1.1.5" -coli = "2.4.0" +coil = "2.4.0" activity = "1.8.0" preview_customview = "1.2.0-alpha02" poolingcontainer = "1.0.0" @@ -70,7 +70,8 @@ android-test-espresso = { module = "androidx.test.espresso:espresso-core", versi android-test-idling = { module = "androidx.test.espresso:espresso-idling-resource", version.ref = "espresso" } android-test-junit4 = { module = "androidx.test.ext:junit", version.ref = "junit"} androidx-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "splash" } -coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coli"} +coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil"} +coil-svg = { module = "io.coil-kt:coil-svg", version.ref = "coil"} compose-activity = { module = "androidx.activity:activity-compose", version.ref = "activity"} compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "composecompiler"} compose-material-3 = { module = "androidx.compose.material3:material3" } @@ -145,7 +146,7 @@ kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", ve ksp-gradlePlugin = { module = "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" } [bundles] -compose = ["coil-compose", "compose-activity", "compose-compiler", "compose-material-3", "compose-materialIcons", "compose-runtimeLivedata", "compose-ui", "compose-ui-util", "compose-ui-tooling", "compose-ui-tooling-preview", "paging-compose", "compose-preview-customview", "compose-preview-customview-poolingcontainer", "compose-constraintlayout", "compose-lifecycle-runtime"] +compose = ["coil-compose", "coil-svg", "compose-activity", "compose-compiler", "compose-material-3", "compose-materialIcons", "compose-runtimeLivedata", "compose-ui", "compose-ui-util", "compose-ui-tooling", "compose-ui-tooling-preview", "paging-compose", "compose-preview-customview", "compose-preview-customview-poolingcontainer", "compose-constraintlayout", "compose-lifecycle-runtime"] lifecycle = ["lifecycle-livedataKtx", "lifecycle-runtimeKtx", "lifecycle-viewmodel-compose"] room = ["room-ktx", "room-paging", "room-runtime"] ktor = ["ktor-core", "ktor-android", "ktor-json", "ktor-content-negotiation", "ktor-auth", "ktor-logging", "ktor-okhttp"] diff --git a/presentation/src/main/java/com/android254/presentation/common/components/OrganizedBySection.kt b/presentation/src/main/java/com/android254/presentation/common/components/OrganizedBySection.kt index 9a42cd51..f2fd2568 100644 --- a/presentation/src/main/java/com/android254/presentation/common/components/OrganizedBySection.kt +++ b/presentation/src/main/java/com/android254/presentation/common/components/OrganizedBySection.kt @@ -27,6 +27,7 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import coil.compose.AsyncImage +import coil.decode.SvgDecoder import coil.request.ImageRequest import com.droidconke.chai.chaiColorsPalette import com.droidconke.chai.components.ChaiTitle @@ -50,7 +51,7 @@ fun OrganizedBySection( ) { ChaiTitle( modifier = Modifier - .fillMaxWidth(), + .fillMaxWidth().padding(start = 20.dp), titleText = stringResource(id = R.string.organized_by), titleColor = MaterialTheme.chaiColorsPalette.textLabelAndHeadings ) @@ -61,16 +62,24 @@ fun OrganizedBySection( modifier = Modifier .fillMaxWidth(), horizontalArrangement = Arrangement.Center, - verticalArrangement = Arrangement.Center + verticalArrangement = Arrangement.spacedBy(12.dp) ) { organizationLogos.forEach { logo -> AsyncImage( modifier = Modifier + .height(200.dp) .padding(6.dp), - model = ImageRequest.Builder(LocalContext.current) - .data(logo) - .build(), + model = if (logo.endsWith("svg")) { + ImageRequest.Builder(LocalContext.current) + .data(logo) + .decoderFactory(SvgDecoder.Factory()) + .build() + } else { + ImageRequest.Builder(LocalContext.current) + .data(logo) + .build() + }, placeholder = painterResource(R.drawable.ic_google_logo_icon), contentDescription = stringResource(id = R.string.logo) ) diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 9dc8971c..aeae271a 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -28,7 +28,7 @@ About Droidcon is a global conference focused on the engineering of Android applications. Droidcon provides a forum for developers to network with other developers, share techniques, announce apps and products, and to learn and teach.\n\nThis three-day developer focused gathering will be held in Nairobi, Kenya on November 8th to 10th 2023 and will be the largest of its kind in Africa.\n\nIt will have workshops and codelabs focused on the building of Android applications and will give participants an excellent chance to learn about the local Android development ecosystem, opportunities and services as well as meet the engineers and companies who work on them. Organizing Team - Organized by; + Organizers Logo User profile droidcon Image