diff --git a/commons/ui/build.gradle.kts b/commons/ui/build.gradle.kts index 8f4e4b2..6e59a7f 100644 --- a/commons/ui/build.gradle.kts +++ b/commons/ui/build.gradle.kts @@ -10,4 +10,4 @@ android { dependencies { implementation(project(BuildModules.CORE)) -} \ No newline at end of file +} diff --git a/commons/ui/src/main/kotlin/com/teacherworkout/commons/ui/composables/LessonCard.kt b/commons/ui/src/main/kotlin/com/teacherworkout/commons/ui/composables/LessonCard.kt index a7a4957..49e2d23 100644 --- a/commons/ui/src/main/kotlin/com/teacherworkout/commons/ui/composables/LessonCard.kt +++ b/commons/ui/src/main/kotlin/com/teacherworkout/commons/ui/composables/LessonCard.kt @@ -43,9 +43,13 @@ fun LessonCard( modifier = Modifier.fillMaxSize() ) { Image( - modifier = Modifier.fillMaxHeight(), - contentScale = ContentScale.FillHeight, - painter = rememberImagePainter(lesson.thumbnail.url), + modifier = Modifier + .aspectRatio(1f) + .fillMaxHeight(), + contentScale = ContentScale.Crop, + painter = rememberImagePainter(lesson.thumbnail.url) { + error(R.drawable.art1) + }, contentDescription = lesson.title ) diff --git a/commons/ui/src/main/kotlin/com/teacherworkout/commons/ui/composables/LessonThemeCard.kt b/commons/ui/src/main/kotlin/com/teacherworkout/commons/ui/composables/LessonThemeCard.kt index 3ba8ba5..bcc1e98 100644 --- a/commons/ui/src/main/kotlin/com/teacherworkout/commons/ui/composables/LessonThemeCard.kt +++ b/commons/ui/src/main/kotlin/com/teacherworkout/commons/ui/composables/LessonThemeCard.kt @@ -3,10 +3,7 @@ package com.teacherworkout.commons.ui.composables import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.Image import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxHeight -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.Card import androidx.compose.material.MaterialTheme @@ -39,9 +36,13 @@ fun LessonThemeCard( modifier = Modifier.fillMaxSize() ){ Image( - modifier = Modifier.fillMaxHeight(), - contentScale = ContentScale.FillHeight, - painter = rememberImagePainter(lessonTheme.thumbnail.url), + modifier = Modifier + .aspectRatio(1f) + .fillMaxHeight(), + contentScale = ContentScale.Crop, + painter = rememberImagePainter(lessonTheme.thumbnail.url) { + error(R.drawable.art1) + }, contentDescription = lessonTheme.thumbnail.description ) Row( diff --git a/core/src/main/kotlin/com/teacherworkout/core/data/ErrorEntity.kt b/core/src/main/kotlin/com/teacherworkout/core/data/ErrorEntity.kt index c7df3f2..31b5d95 100644 --- a/core/src/main/kotlin/com/teacherworkout/core/data/ErrorEntity.kt +++ b/core/src/main/kotlin/com/teacherworkout/core/data/ErrorEntity.kt @@ -5,4 +5,4 @@ sealed class ErrorEntity(val message: String?) { object ServerError: ApiError("Server error") object NotFound: ApiError("Not found") } -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/teacherworkout/core/data/repositories/impl/ApolloLessonsRepository.kt b/core/src/main/kotlin/com/teacherworkout/core/data/repositories/impl/ApolloLessonsRepository.kt index 39de2dd..c665ee0 100644 --- a/core/src/main/kotlin/com/teacherworkout/core/data/repositories/impl/ApolloLessonsRepository.kt +++ b/core/src/main/kotlin/com/teacherworkout/core/data/repositories/impl/ApolloLessonsRepository.kt @@ -63,4 +63,4 @@ class ApolloLessonsRepository(private val apolloClient: ApolloClient): LessonsRe executeQuery(LessonEntityQuery(id)) { it.lessonStatuses!!.single().lesson } -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/com/teacherworkout/core/di/NetworkModule.kt b/core/src/main/kotlin/com/teacherworkout/core/di/NetworkModule.kt index 22580da..51be1f3 100644 --- a/core/src/main/kotlin/com/teacherworkout/core/di/NetworkModule.kt +++ b/core/src/main/kotlin/com/teacherworkout/core/di/NetworkModule.kt @@ -14,4 +14,4 @@ val networkModule = module { single{ ApolloLessonsRepository(get()) } -} \ No newline at end of file +}