Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Commit 5a9cfd8

Browse files
authored
Merge pull request #478 from tiwiz/clean-projects
Update Feed-Compose to latest compose version
2 parents b9e3899 + 6ce1455 commit 5a9cfd8

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

CanonicalLayouts/feed-compose/app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ composeCompiler {
6767
}
6868

6969
dependencies {
70-
def composeBom = platform('androidx.compose:compose-bom:2024.08.00')
70+
def composeBom = platform('androidx.compose:compose-bom:2024.09.00')
7171
implementation(composeBom)
7272
androidTestImplementation(composeBom)
7373

@@ -76,9 +76,9 @@ dependencies {
7676
implementation 'androidx.compose.material3:material3'
7777
implementation 'androidx.compose.material3:material3-window-size-class'
7878
implementation "androidx.compose.ui:ui-tooling-preview"
79-
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.4'
80-
implementation 'androidx.activity:activity-compose:1.9.1'
81-
implementation 'androidx.navigation:navigation-compose:2.7.7'
79+
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.5'
80+
implementation 'androidx.activity:activity-compose:1.9.2'
81+
implementation 'androidx.navigation:navigation-compose:2.8.0'
8282
implementation 'io.coil-kt:coil-compose:2.2.1'
8383

8484
testImplementation 'junit:junit:4.13.2'

CanonicalLayouts/feed-compose/app/src/main/java/com/example/feedcompose/ui/components/TopAppBar.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,21 @@ package com.example.feedcompose.ui.components
1919
import androidx.compose.material3.ExperimentalMaterial3Api
2020
import androidx.compose.material3.Icon
2121
import androidx.compose.material3.IconButton
22-
import androidx.compose.material3.SmallTopAppBar
2322
import androidx.compose.material3.Text
23+
import androidx.compose.material3.TopAppBar
2424
import androidx.compose.runtime.Composable
2525
import androidx.compose.ui.res.painterResource
2626
import androidx.compose.ui.res.stringResource
2727
import com.example.feedcompose.R
2828

29+
2930
@OptIn(ExperimentalMaterial3Api::class)
3031
@Composable
31-
internal fun TopAppBar(onBackPressed: () -> Unit = {}) {
32-
SmallTopAppBar(
33-
title = { Text(text = stringResource(id = R.string.app_name)) },
34-
navigationIcon = { BackButton(onBackPressed) }
35-
)
32+
internal fun SweetTopAppBar(onBackPressed: () -> Unit) {
33+
TopAppBar(title = { Text(text = stringResource(id = R.string.app_name)) },
34+
navigationIcon = {
35+
BackButton(onBackPressed = onBackPressed)
36+
})
3637
}
3738

3839
@Composable

CanonicalLayouts/feed-compose/app/src/main/java/com/example/feedcompose/ui/screen/SweetsDetails.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import androidx.compose.ui.unit.dp
3838
import coil.compose.AsyncImage
3939
import com.example.feedcompose.R
4040
import com.example.feedcompose.data.Sweets
41-
import com.example.feedcompose.ui.components.TopAppBar
41+
import com.example.feedcompose.ui.components.SweetTopAppBar
4242

4343
@Composable
4444
fun SweetsDetails(
@@ -53,18 +53,21 @@ fun SweetsDetails(
5353
scrollState = scrollState,
5454
onBackPressed = onBackPressed
5555
)
56+
5657
WindowWidthSizeClass.Compact -> SweetsDetailsVertical(
5758
sweets = sweets,
5859
scrollState = scrollState,
5960
onBackPressed = onBackPressed
6061
)
62+
6163
else -> {
6264
when (windowSizeClass.heightSizeClass) {
6365
WindowHeightSizeClass.Expanded -> SweetsDetailsVertical(
6466
sweets = sweets,
6567
scrollState = scrollState,
6668
onBackPressed = onBackPressed
6769
)
70+
6871
else -> SweetsDetailsHorizontal(
6972
sweets = sweets,
7073
scrollState = scrollState,
@@ -82,7 +85,7 @@ private fun SweetsDetailsVertical(
8285
onBackPressed: () -> Unit
8386
) {
8487
Column(modifier = Modifier.verticalScroll(scrollState)) {
85-
TopAppBar(onBackPressed = onBackPressed)
88+
SweetTopAppBar(onBackPressed = onBackPressed)
8689
AsyncImage(
8790
model = sweets.imageUrl,
8891
contentDescription = stringResource(id = R.string.thumbnail_content_description),
@@ -105,7 +108,7 @@ private fun SweetsDetailsHorizontal(
105108
onBackPressed: () -> Unit
106109
) {
107110
Column {
108-
TopAppBar(onBackPressed = onBackPressed)
111+
SweetTopAppBar(onBackPressed = onBackPressed)
109112
Row {
110113
AsyncImage(
111114
model = sweets.imageUrl,

CanonicalLayouts/supporting-pane-compose/app/src/main/java/com/example/supportingpanecompose/MainActivity.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 The Android Open Source Project
2+
* Copyright 2024 The Android Open Source Project
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,13 +20,11 @@ import android.os.Bundle
2020
import androidx.activity.ComponentActivity
2121
import androidx.activity.compose.setContent
2222
import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi
23-
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
2423
import com.example.supportingpanecompose.ui.SupportingPaneSample
2524
import com.example.supportingpanecompose.ui.theme.SupportingPaneCompose
2625

2726
@OptIn(ExperimentalMaterial3AdaptiveApi::class)
2827
class MainActivity : ComponentActivity() {
29-
@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
3028
override fun onCreate(savedInstanceState: Bundle?) {
3129
super.onCreate(savedInstanceState)
3230
setContent {

0 commit comments

Comments
 (0)