Skip to content

Commit

Permalink
Update libs 2024 (#54)
Browse files Browse the repository at this point in the history
## Context
- Gradle, AGP, kotlin, ++
- Update target Sdk to 35
  • Loading branch information
cmorigaki authored Dec 23, 2024
1 parent e81e927 commit 1ce4cf3
Show file tree
Hide file tree
Showing 17 changed files with 81 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions features/recipe-collection/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ android {

dependencies {
implementation libs.compose.swipeRefresh
implementation libs.compose.materialIcons

implementation project(ProjectConfig.analytics)
implementation project(ProjectConfig.device)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package br.com.recipebook.recipecollection

import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import br.com.recipebook.designsystem.compose.RecipeBookTheme
Expand All @@ -22,6 +23,7 @@ class RecipeCollectionActivity : AppCompatActivity() {
private val mainNavigator: MainNavigator by inject()

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
observeState()
observeActionCommand()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.sizeIn
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.itemsIndexed
Expand Down Expand Up @@ -45,11 +47,9 @@ import coil.compose.rememberImagePainter
import coil.size.OriginalSize
import com.google.accompanist.swiperefresh.SwipeRefresh
import com.google.accompanist.swiperefresh.rememberSwipeRefreshState
import kotlinx.coroutines.ExperimentalCoroutinesApi

private const val RecipeImgRatio = 1.3333334f

@OptIn(ExperimentalCoroutinesApi::class)
@Composable
fun RecipeCollectionView(
state: RecipeCollectionViewState,
Expand Down Expand Up @@ -92,6 +92,11 @@ private fun RecipeCollectionViewLoaded(
) {
itemsIndexed(state.recipes) { index, item ->
RecipeCollectionItem(
modifier = if (index == state.recipes.lastIndex) {
Modifier.navigationBarsPadding()
} else {
Modifier
},
recipe = item,
index = index,
onItemClick = onItemClick,
Expand All @@ -102,12 +107,11 @@ private fun RecipeCollectionViewLoaded(
}
}

@OptIn(ExperimentalMaterialApi::class)
@Composable
private fun TopBar(
onSettingsClick: () -> Unit,
) {
Row(modifier = Modifier.fillMaxWidth()) {
Row(modifier = Modifier.fillMaxWidth().statusBarsPadding()) {
Text(
modifier = Modifier
.weight(1f)
Expand All @@ -134,26 +138,27 @@ private fun TopBar(
@OptIn(ExperimentalMaterialApi::class)
@Composable
private fun RecipeCollectionItem(
modifier: Modifier = Modifier,
recipe: RecipeItem,
index: Int,
onItemClick: (item: RecipeItem) -> Unit,
) {
val modifier = if (index % 2 == 0) {
Modifier.padding(
val newModifier = if (index % 2 == 0) {
modifier.padding(
start = Spacing.MarginNormal100,
end = Spacing.MarginNormal100 / 2,
bottom = Spacing.MarginNormal100,
)
} else {
Modifier.padding(
modifier.padding(
start = Spacing.MarginNormal100 / 2,
end = Spacing.MarginNormal100,
bottom = Spacing.MarginNormal100,
)
}

Card(
modifier = modifier,
modifier = newModifier,
onClick = { onItemClick(recipe) },
elevation = 2.dp
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.ui.unit.dp
import androidx.core.view.WindowCompat
import androidx.lifecycle.lifecycleScope
import br.com.recipebook.designsystem.compose.RecipeBookTheme
import br.com.recipebook.recipedetail.presentation.RecipeDetailViewModel
Expand All @@ -22,8 +22,8 @@ class RecipeDetailActivity : AppCompatActivity() {
private val viewModel: RecipeDetailViewModel by viewModel(parameters = { parametersOf(safeArgs) })

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
WindowCompat.setDecorFitsSystemWindows(window, false)
observeState()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
Expand Down Expand Up @@ -34,12 +35,10 @@ import br.com.recipebook.recipedetail.presentation.model.DescriptionItem
import br.com.recipebook.recipedetail.presentation.model.IngredientHeaderItem
import br.com.recipebook.recipedetail.presentation.model.InstructionHeaderItem
import coil.compose.rememberImagePainter
import kotlinx.coroutines.ExperimentalCoroutinesApi
import me.onebone.toolbar.CollapsingToolbarScaffold
import me.onebone.toolbar.ScrollStrategy
import me.onebone.toolbar.rememberCollapsingToolbarScaffoldState

@OptIn(ExperimentalCoroutinesApi::class)
@Composable
fun RecipeDetailView(
state: RecipeDetailViewState,
Expand Down Expand Up @@ -134,30 +133,41 @@ private fun RecipeDetailLoaded(
) {
LazyColumn {
items(state.listItems) {
val modifier = if(state.listItems.last() == it) {
Modifier.navigationBarsPadding()
} else {
Modifier
}
when (it) {
IngredientHeaderItem -> ItemHeader(stringResource(id = R.string.recipeDetailIngredients))
InstructionHeaderItem -> ItemHeader(stringResource(id = R.string.recipeDetailInstruction))
is DescriptionItem -> Item(it.description)
IngredientHeaderItem -> ItemHeader(modifier, stringResource(id = R.string.recipeDetailIngredients))
InstructionHeaderItem -> ItemHeader(modifier, stringResource(id = R.string.recipeDetailInstruction))
is DescriptionItem -> Item(modifier, it.description)
}
}
}
}
}

@Composable
private fun ItemHeader(text: String) {
private fun ItemHeader(
modifier: Modifier = Modifier,
text: String,
) {
Text(
text = text,
modifier = Modifier.padding(Spacing.MarginNormal100),
modifier = modifier.padding(Spacing.MarginNormal100),
style = MaterialTheme.typography.h6,
)
}

@Composable
private fun Item(text: String) {
private fun Item(
modifier: Modifier = Modifier,
text: String,
) {
Text(
text = text,
modifier = Modifier.padding(
modifier = modifier.padding(
start = Spacing.MarginLarge100,
top = Spacing.MarginSmall100,
end = Spacing.MarginSmall100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import br.com.recipebook.designsystem.compose.RecipeBookTheme
Expand All @@ -15,6 +16,7 @@ class SettingsThemeActivity : AppCompatActivity() {
private val viewModel: SettingsThemeViewModel by viewModel()

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
observeState()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeContentPadding
import androidx.compose.material.RadioButton
import androidx.compose.material.Surface
import androidx.compose.runtime.Composable
Expand All @@ -28,7 +29,7 @@ fun SettingsThemeView(
onItemClick: (item: SettingsThemeAction) -> Unit,
) {
Surface {
Column(modifier = Modifier.fillMaxSize()) {
Column(modifier = Modifier.fillMaxSize().safeContentPadding()) {
DSTopAppBar(
titleResId = R.string.settings_theme_title,
onBackClick = onBackClick,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import br.com.recipebook.designsystem.compose.RecipeBookTheme
Expand All @@ -20,6 +21,7 @@ class SettingsActivity : AppCompatActivity() {
private val mainNavigator: MainNavigator by inject()

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
observeState()
observeActionCommand()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeContentPadding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
Expand Down Expand Up @@ -51,7 +52,7 @@ fun SettingsView(
onItemClick: (item: SettingsItem) -> Unit,
) {
Surface {
Column(modifier = Modifier.fillMaxSize()) {
Column(modifier = Modifier.fillMaxSize().safeContentPadding()) {
DSTopAppBar(
titleResId = R.string.settings_title,
onBackClick = onBackClick,
Expand Down
28 changes: 14 additions & 14 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
[versions]
gradleplugin = "8.5.2"
kotlin = "2.0.0"
ksp = "2.0.0-1.0.24"
gradleplugin = "8.7.3"
kotlin = "2.1.0"
ksp = "2.1.0-1.0.28"
minSdk = "23"
compileSdk = "34"
compileSdk = "35"

[libraries]
# Kotlin
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
kotlin-jdk = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.8.1" }
kotlin-result = { module = "com.michael-bull.kotlin-result:kotlin-result", version = "1.1.18" }
coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.10.1" }
kotlin-result = { module = "com.michael-bull.kotlin-result:kotlin-result", version = "1.1.21" }

# Debug
leak-canary = { module = "com.squareup.leakcanary:leakcanary-android", version = "2.13" }

# Compose
compose-bom = { module = "androidx.compose:compose-bom", version = "2024.06.00" }
compose-bom = { module = "androidx.compose:compose-bom", version = "2024.12.01" }
compose-ui = { module = "androidx.compose.ui:ui" }
compose-foundation = { module = "androidx.compose.foundation:foundation" }
compose-material = { module = "androidx.compose.material:material" }
compose-materialIcons = { module = "androidx.compose.material:material-icons-core" }
compose-materialIconsExt = { module = "androidx.compose.material:material-icons-extended" }
compose-tooling = { module = "androidx.compose.ui:ui-tooling" }
compose-activity = { module = "androidx.activity:activity-compose", version = "1.9.1" }
compose-activity = { module = "androidx.activity:activity-compose", version = "1.9.3" }
compose-swipeRefresh = { module = "com.google.accompanist:accompanist-swiperefresh", version = "0.34.0" }
compose-collapsingToolbar = { module = "me.onebone:toolbar-compose", version = "2.3.5" }

# Network related libraries
retrofit = { module = "com.squareup.retrofit2:retrofit", version = "2.11.0" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version = "4.12.0" }
moshi-converter = { module = "com.squareup.retrofit2:converter-moshi", version = "2.11.0" }
moshi-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version = "1.15.1" }
moshi = { module = "com.squareup.moshi:moshi", version = "1.15.1" }
moshi-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version = "1.15.2" }
moshi = { module = "com.squareup.moshi:moshi", version = "1.15.2" }

# Android components
appCompat = { module = "androidx.appcompat:appcompat", version = "1.7.0" }
viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version = "2.8.4" }
fragment = { module = "androidx.fragment:fragment-ktx", version = "1.8.2" }
viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version = "2.8.7" }
fragment = { module = "androidx.fragment:fragment-ktx", version = "1.8.5" }
material = { module = "com.google.android.material:material", version = "1.12.0" }

# Android utilities
Expand All @@ -54,7 +54,7 @@ coil = { module = "io.coil-kt:coil", version = "2.7.0" }
coil-compose = { module = "io.coil-kt:coil-compose", version = "2.7.0" }

# Crash reporting library
sentry = { module = "io.sentry:sentry-android", version = "7.9.0" }
sentry = { module = "io.sentry:sentry-android", version = "7.18.0" }

# Analytics
amplitude = { module = "com.amplitude:android-sdk", version = "3.35.1" }
Expand All @@ -77,4 +77,4 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
easylauncher = { id = "com.starter.easylauncher", version = "6.2.0" }
gradle-deps-update = { id = "com.github.ben-manes.versions", version = "0.51.0" }
compose = { id = "org.jetbrains.kotlin.plugin.compose", version = "2.0.0" }
compose = { id = "org.jetbrains.kotlin.plugin.compose", version = "2.1.0" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
1 change: 1 addition & 0 deletions infrastructure/design-system/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ dependencies {
implementation platform(libs.compose.bom)
implementation libs.compose.tooling
implementation libs.compose.material
implementation libs.compose.materialIcons

implementation project(ProjectConfig.utilityAndroid)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -76,7 +76,7 @@ fun DSTopAppBar(
) {
IconButton(onClick = onBackClick) {
Icon(
imageVector = Icons.Filled.ArrowBack,
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = "",
tint = if (tint != Color.Unspecified) {
tint
Expand Down
Loading

0 comments on commit 1ce4cf3

Please sign in to comment.