Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<a href="https://github.com/Gurupreet/ComposeCookBook/releases/download/latest-master/app-debug.apk" >
<img src = "https://img.shields.io/badge/Master-Master?color=7885FF&label=Sample%20App&logo=android&style=for-the-badge" />
</a>
<a href = "https://developer.android.com/jetpack/androidx/versions/all-channel#december_16_2020">
<img src = "https://img.shields.io/badge/Jetpack%20Compose-1.0.1-brightgreen" />
<a href = "https://developer.android.com/develop/ui/compose/bom/bom-mapping">
<img src = "https://img.shields.io/badge/Jetpack%20Compose-BOM%202024.12.01-brightgreen" />
</a>
<a href = "https://github.com/Gurupreet/ComposeCookBook/actions/workflows/android.yml">
<img src = "https://github.com/Gurupreet/ComposeCookBook/actions/workflows/android.yml/badge.svg" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import androidx.compose.material3.Divider
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.IconButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down Expand Up @@ -39,7 +39,7 @@ fun AnimationScreen() {
Scaffold(
modifier = Modifier.testTag(TestTags.ANIM_SCREEN_ROOT),
topBar = {
SmallTopAppBar(
TopAppBar(
title = { Text(text = "Animations") },
navigationIcon = {
IconButton(onClick = { animateIcon = !animateIcon }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down Expand Up @@ -49,7 +49,7 @@ class AdvanceListsActivity : ComponentActivity() {
// A surface container using the 'background' color from the theme
Scaffold(
topBar = {
SmallTopAppBar(
TopAppBar(
title = { Text(text = "Advance Lists(In Progress)") },
navigationIcon = {
IconButton(onClick = { onBackPressed() }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.State
import androidx.compose.runtime.livedata.observeAsState
Expand Down Expand Up @@ -139,7 +139,7 @@ fun ListViewContent(
*/
Scaffold(
topBar = {
SmallTopAppBar(
TopAppBar(
title = {
Column(modifier = Modifier.padding(4.dp)) {
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down Expand Up @@ -77,7 +77,7 @@ class DialogsActivity : AppCompatActivity() {
fun DialogScreen(onBack: () -> Unit) {
Scaffold(
topBar = {
SmallTopAppBar(
TopAppBar(
title = { Text(text = "Dialogs") },
navigationIcon = {
IconButton(onClick = onBack) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
Expand Down Expand Up @@ -64,7 +64,7 @@ class DynamicUIActivity : ComponentActivity() {
fun DynamicUiWrapper(uiType: String, onback: () -> Unit) {
Scaffold(
topBar = {
SmallTopAppBar(
TopAppBar(
title = { Text(text = uiType) },
navigationIcon = {
IconButton(onClick = onback) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -73,7 +73,7 @@ fun BaseView(isDarkTheme: Boolean, content: @Composable () -> Unit) {
fun ListViewContent(listType: String, onBack: () -> Unit) {
Scaffold(
topBar = {
SmallTopAppBar(
TopAppBar(
title = {
Column(modifier = Modifier.padding(4.dp)) {
Text(text = "ListView")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar as Material3TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -57,7 +57,7 @@ fun AppBars() {
fun TopAppBarsDemo() {
SubtitleText(subtitle = "Top App bar")

SmallTopAppBar(
Material3TopAppBar(
title = { Text(text = "Home") },
navigationIcon = {
IconButton(onClick = {}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ object Dependencies {
// Removed googleMaps = "com.google.android.libraries.maps:maps" as it's not publicly available
const val playServicesMaps =
"com.google.android.gms:play-services-maps:${Versions.playServicesMaps}"
const val composeUi = "androidx.compose.ui:ui:${Versions.compose}"
const val composeUiTooling = "androidx.compose.ui:ui-tooling:${Versions.compose}"
// Compose BOM keeps all androidx.compose artifacts below at compatible versions
const val composeBom = "androidx.compose:compose-bom:${Versions.composeBom}"
const val composeUi = "androidx.compose.ui:ui"
const val composeUiTooling = "androidx.compose.ui:ui-tooling"
// Material Design 1 and 3 dependencies
const val composeMaterial = "androidx.compose.material:material:${Versions.compose}"
const val composeMaterial3 = "androidx.compose.material3:material3:${Versions.material3}"
const val composeMaterial3WindowSizeClass = "androidx.compose.material3:material3-window-size-class:${Versions.material3}"
const val composeMaterialIconsExtended =
"androidx.compose.material:material-icons-extended:${Versions.compose}"

const val composeMaterial = "androidx.compose.material:material"
const val composeMaterial3 = "androidx.compose.material3:material3"
const val composeMaterial3WindowSizeClass = "androidx.compose.material3:material3-window-size-class"
const val composeMaterialIconsExtended = "androidx.compose.material:material-icons-extended"

// Runtime and State Management
const val composeRuntime = "androidx.compose.runtime:runtime:${Versions.compose}"
const val composeRuntimeLivedata =
"androidx.compose.runtime:runtime-livedata:${Versions.compose}"
const val composeRuntime = "androidx.compose.runtime:runtime"
const val composeRuntimeLivedata = "androidx.compose.runtime:runtime-livedata"

// Layout and Navigation
const val composeConstraintLayout =
Expand All @@ -41,8 +41,8 @@ object Dependencies {
const val composeLottie = "com.airbnb.android:lottie-compose:${Versions.lottie}"
const val composeNavigation = "androidx.navigation:navigation-compose:${Versions.navCompose}"

const val composeUiTestJunit4 = "androidx.compose.ui:ui-test-junit4:${Versions.compose}"
const val composeUiTestManifest = "androidx.compose.ui:ui-test-manifest:${Versions.compose}"
const val composeUiTestJunit4 = "androidx.compose.ui:ui-test-junit4"
const val composeUiTestManifest = "androidx.compose.ui:ui-test-manifest"

/**
* Custom fling behaviour
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ package com.guru.composecookbook.build.dependencies

import org.gradle.api.artifacts.dsl.DependencyHandler

/** Imports the Compose BOM so the unversioned Compose artifacts resolve consistently. */
private fun DependencyHandler.addComposeBom(configurationName: String) {
add(configurationName, platform(Dependencies.composeBom))
}

fun DependencyHandler.addComposeOfficialDependencies() {
addComposeBom("implementation")
composeOfficialDependencies.forEach {
add("implementation", it)
}
Expand All @@ -15,6 +21,7 @@ fun DependencyHandler.addComposeThirdPartyDependencies() {
}

fun DependencyHandler.addComposeDebugDependencies() {
addComposeBom("debugImplementation")
composeDebugDependencies.forEach {
add("debugImplementation", it)
}
Expand All @@ -33,6 +40,7 @@ fun DependencyHandler.addKotlinTestDependencies() {
}

fun DependencyHandler.addDataDependencies() {
addComposeBom("implementation")
add("ksp", Dependencies.roomCompiler)
dataDependencies.forEach {
add("implementation", it)
Expand Down Expand Up @@ -76,6 +84,7 @@ fun DependencyHandler.addThirdPartyUnitTestsDependencies() {
}

fun DependencyHandler.addAndroidInstrumentationTestsDependencies() {
addComposeBom("androidTestImplementation")
androidInstrumentationTestsDependencies.forEach {
add("androidTestImplementation", it)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.guru.composecookbook.build.dependencies

internal object Versions {
const val compose = "1.6.1" // Latest stable Compose UI version
const val composeBom = "2024.12.01" // Compose BOM maps ui/material/runtime etc. versions
const val activityCompose = "1.8.2" // Latest stable
const val pagingCompose = "3.2.1" // Latest stable
const val navCompose = "2.7.7" // Latest stable navigation
Expand All @@ -10,7 +10,7 @@ internal object Versions {
const val coilCompose = "2.5.0" // Latest stable
const val kotlin = "2.1.20" // Kotlin 2.x with the K2 compiler
const val coroutines = "1.7.3" // Latest stable
const val androidLifecycleGrouped = "2.7.0" // Latest stable
const val androidLifecycleGrouped = "2.8.7" // Latest stable 2.8.x
const val flinger = "1.0.5" // Keeping as is since it's a third-party lib
const val paging = "3.2.1" // Latest stable
const val lottie = "6.3.0" // Latest stable
Expand All @@ -19,7 +19,6 @@ internal object Versions {
const val appcompat = "1.6.1" // Latest stable
const val paletteKtx = "1.0.0" // Latest stable
const val material = "1.11.0" // Latest stable Material Design 1
const val material3 = "1.2.1" // Latest stable Material 3
const val playServicesAds = "22.5.0" // Latest stable
const val googleMaps = "2.0.1" // Latest Google Maps version
const val playServicesMaps = "18.2.0" // Latest stable
Expand Down
1 change: 1 addition & 0 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ plugins {
android { namespace = "com.guru.composecookbook.data" }

dependencies {
implementation(platform(com.guru.composecookbook.build.dependencies.Dependencies.composeBom))
implementation(com.guru.composecookbook.build.dependencies.Dependencies.composeRuntime)
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.NavigationBar
import androidx.compose.material3.NavigationBarItem
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.contentColorFor
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
Expand Down Expand Up @@ -115,7 +115,7 @@ fun DatingHomeAppbar(navType: MutableState<DatingNavType>) {
DatingNavType.CHATS -> "Chats"
DatingNavType.PROFILE -> "My Profile"
}
SmallTopAppBar(
TopAppBar(
title = { Text(title, style = typography.h6) },
actions = { IconButton(onClick = {}) { Icons.Default.MyLocation } },
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.Text
import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
Expand Down Expand Up @@ -59,7 +59,7 @@ fun StoryItem(
)
.clickable(
interactionSource = interactionSource,
indication = rememberRipple(bounded = false, radius = ProfileSizes.large / 2),
indication = ripple(bounded = false, radius = ProfileSizes.large / 2),
enabled = true,
onClickLabel = null,
onClick = onClick,
Expand Down
Loading