diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 538e3c1..caad759 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -7,6 +7,7 @@ plugins { id("com.android.application") id("kotlin-android") id("kotlin-parcelize") + id("com.google.devtools.ksp") id("kotlin-kapt") id("androidx.navigation.safeargs.kotlin") id("com.google.gms.google-services") @@ -127,7 +128,6 @@ android { } kotlinOptions { jvmTarget = JavaVersion.VERSION_17.toString() -// freeCompilerArgs = listOf("-Xallow-result-return-type") } // https://developer.android.com/topic/libraries/data-binding buildFeatures { @@ -156,14 +156,14 @@ dependencies { // List of KTX extensions // https://developer.android.com/kotlin/ktx/extensions-list - implementation("androidx.core:core-ktx:1.10.0") - implementation("androidx.activity:activity-ktx:1.7.1") + implementation("androidx.core:core-ktx:1.10.1") + implementation("androidx.activity:activity-ktx:1.7.2") implementation("androidx.fragment:fragment-ktx:1.5.7") // Lifecycle // https://developer.android.com/jetpack/androidx/releases/lifecycle implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1") - implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.1") +// implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.1") implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1") implementation("androidx.lifecycle:lifecycle-common-java8:2.6.1") @@ -174,7 +174,7 @@ dependencies { // room // https://developer.android.com/topic/libraries/architecture/room implementation("androidx.room:room-runtime:2.5.1") - kapt("androidx.room:room-compiler:2.5.1") + ksp("androidx.room:room-compiler:2.5.1") implementation("androidx.room:room-ktx:2.5.1") // paging @@ -189,13 +189,13 @@ dependencies { // coroutines // https://github.com/Kotlin/kotlinx.coroutines - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.0") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1") + testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1") // moshi - implementation("com.squareup.moshi:moshi-kotlin:1.14.0") - kapt("com.squareup.moshi:moshi-kotlin-codegen:1.14.0") + implementation("com.squareup.moshi:moshi-kotlin:1.15.0") + ksp("com.squareup.moshi:moshi-kotlin-codegen:1.15.0") // retrofit // https://github.com/square/retrofit @@ -215,13 +215,12 @@ dependencies { // glide // https://github.com/bumptech/glide implementation("com.github.bumptech.glide:glide:4.15.1") - kapt("com.github.bumptech.glide:compiler:4.15.1") + ksp("com.github.bumptech.glide:ksp:4.15.1") // dagger hilt - implementation("com.google.dagger:hilt-android:2.45") - kapt("com.google.dagger:hilt-android-compiler:2.45") + implementation("com.google.dagger:hilt-android:2.46.1") + kapt("com.google.dagger:hilt-android-compiler:2.46.1") implementation("androidx.hilt:hilt-navigation-fragment:1.0.0") -// implementation("androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03") kapt("androidx.hilt:hilt-compiler:1.0.0") // runtime permission @@ -381,12 +380,12 @@ dependencies { // or Material Design 2 implementation("androidx.compose.material:material:1.4.3") // Material Design 3 - implementation("androidx.compose.material3:material3:1.1.0-rc01") + implementation("androidx.compose.material3:material3:1.1.0") // Android Studio Preview support implementation("androidx.compose.ui:ui-tooling-preview:1.4.3") debugImplementation("androidx.compose.ui:ui-tooling:1.4.3") // UI Tests - androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.5.0-alpha03") + androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.4.3") debugImplementation("androidx.compose.ui:ui-test-manifest:1.4.3") // Animations implementation("androidx.compose.animation:animation:1.4.3") @@ -399,20 +398,22 @@ dependencies { // Optional - Add full set of material icons implementation("androidx.compose.material:material-icons-extended:1.4.3") // Optional - Add window size utils - implementation("androidx.compose.material3:material3-window-size-class:1.0.1") + implementation("androidx.compose.material3:material3-window-size-class:1.1.0") // Optional - Integration with activities - implementation("androidx.activity:activity-compose:1.7.1") + implementation("androidx.activity:activity-compose:1.7.2") // Optional - Integration with ViewModels implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1") // Optional - Integration with LiveData - implementation("androidx.compose.runtime:runtime-livedata:1.4.3") +// implementation("androidx.compose.runtime:runtime-livedata:1.4.3") + // Lifecycle utilities for Compose + implementation("androidx.lifecycle:lifecycle-runtime-compose:2.6.1") // navigation implementation("androidx.navigation:navigation-compose:2.5.3") implementation("androidx.hilt:hilt-navigation-compose:1.0.0") // https://github.com/skydoves/landscapist // implementation("com.github.skydoves:landscape-bom:2.1.7") - implementation("com.github.skydoves:landscapist-glide:2.1.13") - implementation("com.github.skydoves:landscapist-placeholder:2.1.13") + implementation("com.github.skydoves:landscapist-glide:2.2.0") + implementation("com.github.skydoves:landscapist-placeholder:2.2.0") // https://google.github.io/accompanist/ // https://github.com/google/accompanist val accompanistVersion = "0.28.0" diff --git a/app/src/main/java/com/example/moviedb/compose/ui/home/HomeScreen.kt b/app/src/main/java/com/example/moviedb/compose/ui/home/HomeScreen.kt index be87e0c..2c0232a 100644 --- a/app/src/main/java/com/example/moviedb/compose/ui/home/HomeScreen.kt +++ b/app/src/main/java/com/example/moviedb/compose/ui/home/HomeScreen.kt @@ -16,7 +16,6 @@ import androidx.compose.material.pullrefresh.pullRefresh import androidx.compose.material.pullrefresh.rememberPullRefreshState import androidx.compose.material3.Text import androidx.compose.runtime.* -import androidx.compose.runtime.livedata.observeAsState import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color diff --git a/app/src/main/java/com/example/moviedb/di/AppModule.kt b/app/src/main/java/com/example/moviedb/di/AppModule.kt index 84922f9..b08cfee 100644 --- a/app/src/main/java/com/example/moviedb/di/AppModule.kt +++ b/app/src/main/java/com/example/moviedb/di/AppModule.kt @@ -1,7 +1,6 @@ package com.example.moviedb.di import android.content.Context -import android.content.SharedPreferences import android.content.res.AssetManager import android.content.res.Resources import androidx.datastore.core.DataStore @@ -38,10 +37,10 @@ class AppModule { @Provides fun provideAssetManager(context: Context): AssetManager = context.assets - @Singleton + /*@Singleton @Provides fun provideSharedPrefs(context: Context): SharedPreferences = - context.getSharedPreferences(context.packageName, Context.MODE_PRIVATE) + context.getSharedPreferences(context.packageName, Context.MODE_PRIVATE)*/ @Singleton @Provides diff --git a/app/src/main/java/com/example/moviedb/ui/widgets/NavigationExtension.kt b/app/src/main/java/com/example/moviedb/ui/widgets/NavigationExtension.kt index ac71cc7..9208fe3 100644 --- a/app/src/main/java/com/example/moviedb/ui/widgets/NavigationExtension.kt +++ b/app/src/main/java/com/example/moviedb/ui/widgets/NavigationExtension.kt @@ -8,11 +8,10 @@ import android.content.Intent import android.util.SparseArray import androidx.core.util.forEach import androidx.fragment.app.FragmentManager -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData import androidx.navigation.NavController import androidx.navigation.fragment.NavHostFragment import com.google.android.material.bottomnavigation.BottomNavigationView +import kotlinx.coroutines.flow.MutableStateFlow /** * Manages the various graphs needed for a [BottomNavigationView]. @@ -24,12 +23,12 @@ fun BottomNavigationView.setupWithNavController( fragmentManager: FragmentManager, containerId: Int, intent: Intent -): LiveData { +): MutableStateFlow { // Map of tags val graphIdToTagMap = SparseArray() // Result. Mutable live data with the selected controlled - val selectedNavController = MutableLiveData() + val selectedNavController = MutableStateFlow(NavController(context)) var firstFragmentGraphId = 0 diff --git a/app/src/main/java/com/example/moviedb/utils/BindingUtils.kt b/app/src/main/java/com/example/moviedb/utils/BindingUtils.kt index fd04baa..3a05ded 100644 --- a/app/src/main/java/com/example/moviedb/utils/BindingUtils.kt +++ b/app/src/main/java/com/example/moviedb/utils/BindingUtils.kt @@ -118,7 +118,7 @@ fun ImageView.loadImage( } } - GlideApp.with(context).load(imageUrl).apply { + Glide.with(context).load(imageUrl).apply { transition(DrawableTransitionOptions.withCrossFade()) addListener(requestListener) // breaks sharedElementEnterTransition diff --git a/build.gradle.kts b/build.gradle.kts index 77f30c5..2f037d2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,13 +2,12 @@ buildscript { repositories { google() mavenCentral() -// maven("https://maven.google.com") } dependencies { - classpath("com.android.tools.build:gradle:8.0.1") + classpath("com.android.tools.build:gradle:8.0.2") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21") classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.5.3") - classpath("com.google.dagger:hilt-android-gradle-plugin:2.44.2") + classpath("com.google.dagger:hilt-android-gradle-plugin:2.46.1") // classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Libs.kotlinVersion}") // classpath("androidx.navigation:navigation-safe-args-gradle-plugin:${Libs.navigationVersion}") // classpath("com.google.dagger:hilt-android-gradle-plugin:${Libs.daggerHiltVersion}") @@ -21,10 +20,13 @@ allprojects { repositories { google() mavenCentral() -// maven("https://maven.google.com") } } tasks.register("clean", Delete::class.java) { delete(rootProject.buildDir) } + +plugins { + id("com.google.devtools.ksp") version "1.8.21-1.0.11" apply false +} diff --git a/gradle.properties b/gradle.properties index 371aede..067f013 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,6 +22,7 @@ android.databinding.incremental=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official kapt.incremental.apt=true +ksp.incremental.apt=true android.defaults.buildfeatures.buildconfig=true android.nonTransitiveRClass=true android.nonFinalResIds=false