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
5 changes: 2 additions & 3 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 Expand Up @@ -102,7 +102,6 @@ Please get **Android Studio Bumblebee latest Canary** [from here](https://develo

## Coming Soon
- Some of the features that will be available in coming weeks
- Advance lists: Pull Refresh, Swipe lists etc
- Clean Architecture Sample with coroutines.
- Advance canvas drawing.
Much more in pipeline stay tuned!!
Expand Down
14 changes: 5 additions & 9 deletions animations/canvas/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import com.guru.composecookbook.build.dependencies.addComposeOfficialDependencies

plugins {
/**
* See [common-compose-module-configs-script-plugin.gradle.kts] file
*/
id("common-compose-module-configs-script-plugin")
/** See [common-compose-module-configs-script-plugin.gradle.kts] file */
id("common-compose-module-configs-script-plugin")
}

android {
namespace = "com.guru.composecookbook.canvas"
}
android { namespace = "com.guru.composecookbook.canvas" }

dependencies {
implementation(project(":theme"))
addComposeOfficialDependencies()
implementation(project(":theme"))
addComposeOfficialDependencies()
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,12 @@ fun MultiStateAnimationCircleFilledCanvas(color: Color = green500, radiusEnd: Fl
transition.animateFloat(
initialValue = 10f,
targetValue = radiusEnd,
animationSpec = infiniteRepeatable(tween(1200), RepeatMode.Reverse)
animationSpec = infiniteRepeatable(tween(1200), RepeatMode.Reverse),
)
Canvas(modifier = Modifier.padding(16.dp)) {
val centerOffset = Offset(10f, 10f)
drawCircle(
color = color.copy(alpha = 0.8f),
radius = floatAnim,
center = centerOffset,
)
drawCircle(
color = color.copy(alpha = 0.4f),
radius = floatAnim / 2,
center = centerOffset,
)
drawCircle(
color = color.copy(alpha = 0.2f),
radius = floatAnim / 4,
center = centerOffset,
)
drawCircle(color = color.copy(alpha = 0.8f), radius = floatAnim, center = centerOffset)
drawCircle(color = color.copy(alpha = 0.4f), radius = floatAnim / 2, center = centerOffset)
drawCircle(color = color.copy(alpha = 0.2f), radius = floatAnim / 4, center = centerOffset)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fun MultiStateAnimationCircleStrokeCanvas() {
transition.animateFloat(
initialValue = 0f,
targetValue = 360f,
animationSpec = infiniteRepeatable(tween(800), RepeatMode.Restart)
animationSpec = infiniteRepeatable(tween(800), RepeatMode.Restart),
)
val stroke = Stroke(8f)
Canvas(modifier = Modifier.padding(16.dp).size(100.dp)) {
Expand Down
16 changes: 6 additions & 10 deletions animations/lottie/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ import com.guru.composecookbook.build.dependencies.addCoreAndroidDependencies
import com.guru.composecookbook.build.dependencies.addThirdPartyUiDependencies

plugins {
/**
* See [common-compose-module-configs-script-plugin.gradle.kts] file
*/
id("common-compose-module-configs-script-plugin")
/** See [common-compose-module-configs-script-plugin.gradle.kts] file */
id("common-compose-module-configs-script-plugin")
}

android {
namespace = "com.guru.composecookbook.lottie"
}
android { namespace = "com.guru.composecookbook.lottie" }

dependencies {
addComposeOfficialDependencies()
addCoreAndroidDependencies()
addThirdPartyUiDependencies()
addComposeOfficialDependencies()
addCoreAndroidDependencies()
addThirdPartyUiDependencies()
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ fun LottieCryptoLoadingView(context: Context) {
LottieLoadingView(
context = context,
file = "cryptoload.json",
modifier = Modifier.fillMaxWidth().height(150.dp)
modifier = Modifier.fillMaxWidth().height(150.dp),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ fun LottieFoodView(context: Context) {
LottieLoadingView(
context = context,
file = "food.json",
modifier = Modifier.fillMaxWidth().height(200.dp)
modifier = Modifier.fillMaxWidth().height(200.dp),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ fun LottieLoaderLoadingView(context: Context) {
LottieLoadingView(
context = context,
file = "loader.json",
modifier = Modifier.fillMaxWidth().height(200.dp)
modifier = Modifier.fillMaxWidth().height(200.dp),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fun LottieLoadingView(
context: Context,
file: String,
modifier: Modifier = Modifier,
iterations: Int = 10
iterations: Int = 10,
) {
val composition by rememberLottieComposition(LottieCompositionSpec.Asset(file))
LottieAnimation(composition, modifier = modifier.defaultMinSize(300.dp), iterations = iterations)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ fun LottieWorkingLoadingView(context: Context) {
LottieLoadingView(
context = context,
file = "working.json",
modifier = Modifier.fillMaxWidth().height(250.dp)
modifier = Modifier.fillMaxWidth().height(250.dp),
)
}
170 changes: 76 additions & 94 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,113 +16,95 @@ import com.guru.composecookbook.build.dependencies.addThirdPartyUiDependencies
import com.guru.composecookbook.build.dependencies.addThirdPartyUnitTestsDependencies

plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-kapt")
id("com.android.application")
id("kotlin-android")
id("com.google.devtools.ksp")
id("org.jetbrains.kotlin.plugin.compose")
}

android {
compileSdk = ProjectConfigs.compileSdkVersion
namespace = ProjectConfigs.applicationId

compileSdk = ProjectConfigs.compileSdkVersion
namespace = ProjectConfigs.applicationId
defaultConfig {
applicationId = ProjectConfigs.applicationId
minSdk = ProjectConfigs.minSdkVersion
targetSdk = ProjectConfigs.targetSdkVersion
versionCode = 1
versionName = "1.0"
multiDexEnabled = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

defaultConfig {
applicationId = ProjectConfigs.applicationId
minSdk = ProjectConfigs.minSdkVersion
targetSdk = ProjectConfigs.targetSdkVersion
versionCode = 1
versionName = "1.0"
multiDexEnabled = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
// useIR = true
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"

}
kapt {
correctErrorTypes = true
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = ProjectConfigs.kotlinCompilerExtensionVersion
}
lint {
abortOnError = false
}
testOptions {
unitTests.all {
it.useJUnitPlatform()
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
// useIR = true
freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn"
}
buildFeatures { compose = true }
lint { abortOnError = false }
testOptions { unitTests.all { it.useJUnitPlatform() } }
}

dependencies {
implementation(project(":data"))
implementation(project(":theme"))
implementation(project(":demos:instagram"))
implementation(project(":demos:spotify"))
implementation(project(":demos:twitter"))
implementation(project(":demos:tiktok"))
implementation(project(":demos:youtube"))
implementation(project(":demos:gmail"))
implementation(project(":demos:datingapp"))
implementation(project(":demos:paint"))
implementation(project(":demos:cryptoapp:app"))
implementation(project(":demos:moviesapp:app"))
implementation(project(":demos:meditation"))
implementation(project(":templates:onboarding"))
implementation(project(":templates:paymentcard"))
implementation(project(":templates:pinlock"))
implementation(project(":templates:profile"))
implementation(project(":templates:login"))
implementation(project(":templates:cascademenu"))
implementation(project(":components:fab"))
implementation(project(":components:charts"))
implementation(project(":components:tags"))
implementation(project(":components:carousel"))
implementation(project(":components:verticalgrid"))
implementation(project(":components:colorpicker"))
implementation(project(":components:comingsoon"))
implementation(project(":animations:canvas"))
implementation(project(":animations:lottie"))
implementation(project(":data"))
implementation(project(":theme"))
implementation(project(":demos:instagram"))
implementation(project(":demos:spotify"))
implementation(project(":demos:twitter"))
implementation(project(":demos:tiktok"))
implementation(project(":demos:youtube"))
implementation(project(":demos:gmail"))
implementation(project(":demos:datingapp"))
implementation(project(":demos:paint"))
implementation(project(":demos:cryptoapp:app"))
implementation(project(":demos:moviesapp:app"))
implementation(project(":demos:meditation"))
implementation(project(":templates:onboarding"))
implementation(project(":templates:paymentcard"))
implementation(project(":templates:pinlock"))
implementation(project(":templates:profile"))
implementation(project(":templates:login"))
implementation(project(":templates:cascademenu"))
implementation(project(":components:fab"))
implementation(project(":components:charts"))
implementation(project(":components:tags"))
implementation(project(":components:carousel"))
implementation(project(":components:verticalgrid"))
implementation(project(":components:colorpicker"))
implementation(project(":components:comingsoon"))
implementation(project(":animations:canvas"))
implementation(project(":animations:lottie"))

addKotlinDependencies()
addKotlinDependencies()

addDataDependencies()
addDataDependencies()

addComposeOfficialDependencies()
addComposeDebugDependencies()
addComposeThirdPartyDependencies()
addComposeOfficialDependencies()
addComposeDebugDependencies()
addComposeThirdPartyDependencies()

addThirdPartyUiDependencies()
addThirdPartyUiDependencies()

addCoreAndroidDependencies()
addCoreAndroidUiDependencies()
addGoogleAndroidDependencies()
addNetworkingDependencies()
addCoreAndroidDependencies()
addCoreAndroidUiDependencies()
addGoogleAndroidDependencies()
addNetworkingDependencies()

addKotlinTestDependencies()
addJunit5TestDependencies()
addThirdPartyUnitTestsDependencies()
addKotlinTestDependencies()
addJunit5TestDependencies()
addThirdPartyUnitTestsDependencies()

addAndroidInstrumentationTestsDependencies()
addBiometricDependency()
}
addAndroidInstrumentationTestsDependencies()
addBiometricDependency()
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class HomeScreenTest {
*/
private fun hasTextInProvidedDemoData(
homeScreenListItems: List<HomeScreenItems>,
ignoreCase: Boolean = false
ignoreCase: Boolean = false,
) =
SemanticsMatcher(
description =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class FlingSettingsPageTest {

Assert.assertEquals(
FlingStateStore.INSTANCE.type.name.lowercase(Locale.getDefault()),
"native"
"native",
)
}
}
Expand All @@ -103,7 +103,7 @@ class FlingSettingsPageTest {

Assert.assertEquals(
FlingStateStore.INSTANCE.type.name.lowercase(Locale.getDefault()),
"smooth"
"smooth",
)
}
}
Expand All @@ -122,7 +122,7 @@ class FlingSettingsPageTest {

Assert.assertEquals(
FlingStateStore.INSTANCE.type.name.lowercase(Locale.getDefault()),
"custom"
"custom",
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ enum class BottomNavType {
WIDGETS,
ANIMATION,
DEMOUI,
TEMPLATE
TEMPLATE,
}
Loading