Skip to content

Commit 63b7902

Browse files
authored
Merge pull request #104 from GetStream/migrate/compose-deprecated
Migrate SmallTopAppBar to TopAppBar
2 parents 913f84f + e23c755 commit 63b7902

File tree

7 files changed

+15
-27
lines changed

7 files changed

+15
-27
lines changed

app/src/main/kotlin/io/getstream/whatsappclone/ui/WhatsAppTopBar.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ package io.getstream.whatsappclone.ui
1919
import androidx.compose.foundation.layout.Spacer
2020
import androidx.compose.foundation.layout.fillMaxWidth
2121
import androidx.compose.foundation.layout.size
22+
import androidx.compose.material.TopAppBar
2223
import androidx.compose.material3.Icon
2324
import androidx.compose.material3.MaterialTheme
24-
import androidx.compose.material3.SmallTopAppBar
2525
import androidx.compose.material3.Text
26-
import androidx.compose.material3.TopAppBarDefaults
2726
import androidx.compose.runtime.Composable
2827
import androidx.compose.ui.Modifier
2928
import androidx.compose.ui.res.stringResource
@@ -35,7 +34,7 @@ import io.getstream.whatsappclone.designsystem.theme.WhatsAppCloneComposeTheme
3534

3635
@Composable
3736
fun WhatsAppTopBar() {
38-
SmallTopAppBar(
37+
TopAppBar(
3938
modifier = Modifier.fillMaxWidth(),
4039
title = {
4140
Text(
@@ -61,9 +60,7 @@ fun WhatsAppTopBar() {
6160
contentDescription = null
6261
)
6362
},
64-
colors = TopAppBarDefaults.smallTopAppBarColors(
65-
containerColor = MaterialTheme.colorScheme.primary
66-
)
63+
backgroundColor = MaterialTheme.colorScheme.primary
6764
)
6865
}
6966

benchmark/build.gradle.kts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ android {
4646
}
4747

4848
targetProjectPath = ":app"
49-
experimentalProperties["android.experimental.self-instrumenting"] = true
5049
}
5150

5251
dependencies {
@@ -55,9 +54,3 @@ dependencies {
5554
implementation(libs.androidx.benchmark.macro)
5655
implementation(libs.androidx.profileinstaller)
5756
}
58-
59-
androidComponents {
60-
beforeVariants(selector().all()) {
61-
it.enabled = it.buildType == "benchmark"
62-
}
63-
}

benchmark/src/main/kotlin/io/getstream/whatsappclone/benchmark/BaselineProfileGenerator.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,23 @@
1616

1717
package io.getstream.whatsappclone.benchmark
1818

19-
import androidx.benchmark.macro.ExperimentalBaselineProfilesApi
19+
import android.os.Build
20+
import androidx.annotation.RequiresApi
2021
import androidx.benchmark.macro.junit4.BaselineProfileRule
2122
import org.junit.Rule
2223
import org.junit.Test
2324

2425
/**
2526
* Generates a baseline profile which can be copied to `app/src/main/baseline-prof.txt`.
2627
*/
27-
@ExperimentalBaselineProfilesApi
28+
@RequiresApi(Build.VERSION_CODES.P)
2829
class BaselineProfileGenerator {
2930
@get:Rule
3031
val baselineProfileRule = BaselineProfileRule()
3132

3233
@Test
3334
fun startup() =
34-
baselineProfileRule.collectBaselineProfile(
35+
baselineProfileRule.collect(
3536
packageName = "io.getstream.whatsappclone"
3637
) {
3738
pressHome()

core/uistate/src/main/kotlin/io/getstream/whatsappclone/uistate/UiState.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ import io.getstream.chat.android.client.models.Channel
3535
@Immutable
3636
sealed interface UiState {
3737
data class Success(val data: Extensive) : UiState
38-
object Loading : UiState
39-
object Error : UiState
38+
data object Loading : UiState
39+
data object Error : UiState
4040
}

features/calls/src/main/kotlin/io/getstream/whatsappclone/calls/info/WhatsAppCallHistoryTopBar.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fun WhatsAppCallHistoryTopBar(
7575
contentDescription = null
7676
)
7777
},
78-
contentColor = MaterialTheme.colorScheme.primary
78+
backgroundColor = MaterialTheme.colorScheme.primary
7979
)
8080
}
8181

features/chats/src/main/kotlin/io/getstream/whatsappclone/chats/messages/WhatsAppMessageTopBar.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ import androidx.compose.foundation.layout.fillMaxWidth
2323
import androidx.compose.foundation.layout.padding
2424
import androidx.compose.foundation.layout.size
2525
import androidx.compose.foundation.shape.CircleShape
26+
import androidx.compose.material.TopAppBar
2627
import androidx.compose.material3.Icon
2728
import androidx.compose.material3.MaterialTheme
28-
import androidx.compose.material3.SmallTopAppBar
2929
import androidx.compose.material3.Text
30-
import androidx.compose.material3.TopAppBarDefaults
3130
import androidx.compose.runtime.Composable
3231
import androidx.compose.ui.Modifier
3332
import androidx.compose.ui.draw.clip
@@ -46,7 +45,7 @@ fun WhatsAppMessageTopBar(
4645
messageUiState: WhatsAppMessageUiState,
4746
onBackClick: () -> Unit
4847
) {
49-
SmallTopAppBar(
48+
TopAppBar(
5049
modifier = Modifier.fillMaxWidth(),
5150
navigationIcon = {
5251
Icon(
@@ -89,9 +88,7 @@ fun WhatsAppMessageTopBar(
8988
contentDescription = null
9089
)
9190
},
92-
colors = TopAppBarDefaults.smallTopAppBarColors(
93-
containerColor = MaterialTheme.colorScheme.primary
94-
)
91+
backgroundColor = MaterialTheme.colorScheme.primary
9592
)
9693
}
9794

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ androidDesugarJdkLibs = "1.1.5"
88
androidGradlePlugin = "8.1.2"
99
androidxActivity = "1.8.0"
1010
androidxAppCompat = "1.6.1"
11-
androidxCompose = "1.5.3"
11+
androidxCompose = "1.5.4"
1212
androidxComposeCompiler = "1.5.3"
1313
androidxComposeMaterial3 = "1.0.0-alpha13"
1414
androidxComposeConstraintLayout = "1.0.1"
1515
androidxComposeNavigation = "2.5.3"
1616
androidxCore = "1.12.0"
1717
androidxHiltNavigationCompose = "1.0.0"
1818
androidxLifecycle = "2.6.2"
19-
androidxMacroBenchmark = "1.1.1"
19+
androidxMacroBenchmark = "1.2.0"
2020
androidxNavigation = "2.5.0"
2121
androidxProfileinstaller = "1.3.1"
2222
androidxStartup = "1.1.1"

0 commit comments

Comments
 (0)