Skip to content

Commit

Permalink
Merge pull request #39 from nikeight/master
Browse files Browse the repository at this point in the history
Migrate to Kotlin `2.0.0` and  to`version-catalog` from `buildSrc`.
  • Loading branch information
pushpalroy authored Sep 1, 2024
2 parents b748628 + 4cfdbb4 commit 4bf1f97
Show file tree
Hide file tree
Showing 145 changed files with 3,808 additions and 2,484 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
object ProjectProperties {
const val COMPILE_SDK = 33
const val COMPILE_SDK = 35
const val MIN_SDK = 28
const val TARGET_SDK = 33
const val TARGET_SDK = 35
const val APPLICATION_ID = "com.jetapps.jettaskboard"
}
207 changes: 108 additions & 99 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
import Lib.Android.ACCOMPANIST_SYSTEM_UI_CONTROLLER

plugins {
id(BuildPlugins.ANDROID_APPLICATION_PLUGIN)
id(BuildPlugins.KOTLIN_ANDROID_PLUGIN)
id(BuildPlugins.KOTLIN_PARCELABLE_PLUGIN)
id(BuildPlugins.KOTLIN_KAPT)
id(BuildPlugins.DAGGER_HILT)
id(libs.plugins.android.application.get().pluginId)
id("org.jetbrains.kotlin.android")
id(libs.plugins.compose.get().pluginId)
id(libs.plugins.hilt.get().pluginId)
id(libs.plugins.baselineprofile.get().pluginId)
id("com.google.devtools.ksp")
}

android {
compileSdk = ProjectProperties.COMPILE_SDK
namespace = "com.jetapps.jettaskboard"
compileSdk = 35

defaultConfig {
applicationId = ProjectProperties.APPLICATION_ID
minSdk = ProjectProperties.MIN_SDK
targetSdk = ProjectProperties.TARGET_SDK
applicationId = "com.jetapps.jettaskboard"
minSdk = 28
targetSdk = 35
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
vectorDrawables {
useSupportLibrary = true
}
}

buildTypes {
Expand All @@ -33,119 +35,126 @@ android {
}
}

buildFeatures {
dataBinding = true
}

buildFeatures {
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = Lib.Android.COMPOSE_COMPILER_VERSION
}
packagingOptions {
resources.excludes.add("META-INF/LICENSE.txt")
resources.excludes.add("META-INF/NOTICE.txt")
resources.excludes.add("LICENSE.txt")
resources.excludes.add("/META-INF/{AL2.0,LGPL2.1}")
packaging {
resources {
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}
}

// Required for annotation processing plugins like Dagger
kapt {
generateStubs = true
correctErrorTypes = true
}

dependencies {
implementation(platform(Lib.Android.COMPOSE_BOM))
implementation(project(":feature:dashboard"))
implementation(project(":feature:card"))
implementation(project(":feature:taskboard"))
implementation(project(":feature:search"))

implementation(project(":core:data"))
implementation(project(":core:domain"))
implementation(project(":core:designsystem"))
implementation(project(":core:navigation"))

implementation("androidx.tracing:tracing-ktx:1.1.0")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.material3:material3-window-size-class")

/* Android Designing and layout */
implementation(Lib.Android.COMPOSE_LIVEDATA)
implementation(Lib.Android.COMPOSE_NAVIGATION)
implementation(Lib.Kotlin.KT_STD)
implementation(Lib.Android.MATERIAL_DESIGN)
implementation(Lib.Android.CONSTRAINT_LAYOUT_COMPOSE)
implementation(Lib.Android.ACCOMPANIST_INSETS)
implementation(Lib.Android.ACCOMPANIST_INSETS_UI)
implementation(ACCOMPANIST_SYSTEM_UI_CONTROLLER)
implementation(Lib.Android.ACCOMPANIST_FLOW_LAYOUTS)
implementation(Lib.Android.COMPOSE_WINDOW_MATRICES)

implementation(Lib.Android.APP_COMPAT)

implementation(Lib.Kotlin.KTX_CORE)

/* Image Loading */
implementation(Lib.Android.COIL_COMPOSE)
implementation(Lib.Android.ACCOMPANIST_COIL)

/*DI*/
implementation(Lib.Di.hiltAndroid)
implementation(Lib.Di.hiltNavigationCompose)
implementation(Lib.Android.COMPOSE_TOOLING_PREVIEW)
debugImplementation(Lib.Android.COMPOSE_TOOLING)

implementation(Lib.Android.PROFILE_INSTALLER)

kapt(Lib.Di.hiltCompiler)
kapt(Lib.Di.hiltAndroidCompiler)

// Projects
implementation(projects.feature.dashboard)
implementation(projects.feature.card)
implementation(projects.feature.taskboard)
implementation(projects.feature.search)
implementation(projects.core.data)
implementation(projects.core.domain)
implementation(projects.core.designsystem)
implementation(projects.core.navigation)

// Compose
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.compose.material3.adaptive)
implementation(libs.androidx.compose.material3.adaptive.layout)
implementation(libs.androidx.compose.material3.adaptive.navigation)
implementation(libs.androidx.compose.material3.windowSizeClass)
implementation(libs.androidx.compose.runtime.tracing)
implementation(libs.androidx.tracing.ktx)
implementation(libs.androidx.compose.constraint.layout)
implementation(libs.androidx.compose.accompanist.insets)
implementation(libs.androidx.compose.accompanist.insets.ui)
implementation(libs.androidx.compose.accompanist.flow.layout)

// Core
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.core.splashscreen)
implementation(libs.androidx.lifecycle.runtimeCompose)
implementation(libs.androidx.window.core)
implementation(libs.androidx.window)

// Kotlin
// implementation(libs.kotlin.stdlib)

// Hilt
implementation(libs.hilt.android)
ksp(libs.hilt.compiler)
implementation(libs.androidx.hilt.navigation.compose)

// implementation(libs.hilt.core)
// implementation(libs.hilt.compiler)
// implementation(libs.hilt.ext.compiler)
// implementation(libs.hilt.ext.work)

// Tooling
implementation(libs.androidx.compose.ui.tooling.preview)
debugImplementation(libs.androidx.compose.ui.tooling)

// Coil
implementation(libs.coil.kt)

// Navigation
implementation(libs.androidx.navigation.compose)

// Profile Installer
implementation(libs.androidx.profileinstaller)

/* Logger */
implementation(Lib.Logger.TIMBER)
implementation(libs.timber)

/* Async */
implementation(Lib.Async.COROUTINES)
implementation(Lib.Async.COROUTINES_ANDROID)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.coroutines.android)

/* Glance AppWidgets */
implementation(Lib.Glance.GLANCE)
implementation(libs.glance)

/* Room */
implementation(Lib.Room.roomRuntime)
kapt(Lib.Room.roomCompiler)
implementation(Lib.Room.roomKtx)
implementation(Lib.Room.roomPaging)
implementation(libs.room.runtime)
ksp(libs.room.compiler)
implementation(libs.room.ktx)
implementation(libs.room.paging)

/* Datastore */
implementation(Lib.Android.JETPACK_DATASTORE)
implementation(Lib.Android.JETPACK_DATASTORE_PREFERENCE_CORE)

/*Testing*/
testImplementation(TestLib.JUNIT)
testImplementation(TestLib.CORE_TEST)
testImplementation(TestLib.ANDROID_JUNIT)
testImplementation(TestLib.ARCH_CORE)
testImplementation(TestLib.MOCK_WEB_SERVER)
testImplementation(TestLib.ROBO_ELECTRIC)
testImplementation(TestLib.COROUTINES)
testImplementation(TestLib.MOCKK)
androidTestImplementation(Lib.Android.COMPOSE_JUNIT)
debugImplementation(Lib.Android.COMPOSE_TEST_MANIFEST)
implementation(libs.androidx.dataStore)
implementation(libs.androidx.dataStore.core)

debugImplementation(libs.androidx.compose.ui.testManifest)

// Test Dependencies
kspTest(libs.hilt.compiler)
testImplementation(libs.junit)
// testImplementation(libs.androidx.test.ext.junit)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.hilt.android.testing)
testImplementation(libs.robolectric)
testImplementation(libs.androidx.test.core)
testImplementation(libs.androidx.arch.core)
testImplementation(libs.mockk)
androidTestImplementation(kotlin("test"))
androidTestImplementation(projects.core.testing)
androidTestImplementation(libs.androidx.test.espresso.core)
androidTestImplementation(libs.androidx.navigation.testing)
androidTestImplementation(libs.androidx.compose.ui.test)
androidTestImplementation(libs.hilt.android.testing)
}

ktlint {
android.set(true)
outputColorName.set("RED")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ class JetTaskBoardApplication : Application() {

override fun onCreate() {
super.onCreate()
if (BuildConfig.DEBUG) {
Timber.plant(DebugTree())
}
// Todo: Plant the Timber
// if (BuildConfig.DEBUG) {
// Timber.plant(DebugTree())
// }
}
}
17 changes: 6 additions & 11 deletions app/src/main/java/com/jetapps/jettaskboard/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,21 @@ package com.jetapps.jettaskboard
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass
import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
import androidx.window.core.layout.WindowWidthSizeClass
import com.jetapps.jettaskboard.ui.JtbApp
import dagger.hilt.android.AndroidEntryPoint

@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
@AndroidEntryPoint
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// WindowCompat.setDecorFitsSystemWindows(window, false)

setContent {
// We can also use a custom solution like:
// val windowSize = rememberWindowSizeClass()
// val isExpandedScreen = windowSize == WindowSize.Expanded
val adaptiveInfo = currentWindowAdaptiveInfo()
val isExpandedScreen = with(adaptiveInfo) {
windowSizeClass.windowWidthSizeClass == WindowWidthSizeClass.EXPANDED
}

val windowSize = calculateWindowSizeClass(this).widthSizeClass
val isExpandedScreen = windowSize == WindowWidthSizeClass.Expanded
JtbApp(isExpandedScreen = isExpandedScreen)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ fun JtbNavHost(
) {
dashboardGraph(
isExpandedScreen = isExpandedScreen,
navigateToTaskBoard = {
navigateToTaskBoard = { boardId ->
onNavigateToDestination(
TaskBoardDestination,
TaskBoardDestination.route
TaskBoardDestination.route + "/$boardId"
)
},
navigateToCreateCard = {
Expand All @@ -77,10 +77,10 @@ fun JtbNavHost(
taskBoardGraph(
isExpandedScreen = isExpandedScreen,
onBackClick = onBackClick,
navigateToCreateCard = {
navigateToCreateCard = { boardId, listId, cardId ->
onNavigateToDestination(
CardDetailsDestination,
CardDetailsDestination.route
CardDetailsDestination.route + "/$boardId" + "/$listId" + "/$cardId"
)
},
navigateToChangeBackgroundScreen = {
Expand All @@ -97,7 +97,16 @@ fun JtbNavHost(
)

createBoardGraph(
onBackClick = onBackClick
onBackClick = onBackClick,
navigateToBoardRoute = { passedId ->
// Clear the Create Board Screen then only
// Navigate to the TaskBoard Screen
navController.popBackStack()
onNavigateToDestination(
TaskBoardDestination,
TaskBoardDestination.route + "/$passedId",
)
}
)

searchGraph(
Expand Down
Loading

0 comments on commit 4bf1f97

Please sign in to comment.