diff --git a/build.gradle b/build.gradle index 6aac524..976de0c 100644 --- a/build.gradle +++ b/build.gradle @@ -2,15 +2,15 @@ buildscript { ext { - kotlin_version = "1.4.20" - retrofit_version = "2.9.0" - lifecycle_version = "2.3.1" - room_version = "2.3.0" - moshi_version = "1.6.0" - nav_version = "2.3.0" - hilt_version = '2.35' - fragment_version = '1.3.4' - paging_version = '3.0.0' + kotlin_version = '2.1.10' + retrofit_version = "2.11.0" + lifecycle_version = "2.8.7" + room_version = "2.6.1" + moshi_version = "1.15.2" + nav_version = '2.8.8' + hilt_version = '2.55' + fragment_version = '1.8.6' + paging_version = '3.3.6' } repositories { @@ -18,10 +18,11 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.2.1' + classpath 'com.android.tools.build:gradle:8.9.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version" - classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version") + classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" + classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:2.1.10-1.0.31" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/data/build.gradle b/data/build.gradle index 6d86aba..297d1bf 100644 --- a/data/build.gradle +++ b/data/build.gradle @@ -3,6 +3,7 @@ plugins { id("kotlin-android") id("kotlin-kapt") id("dagger.hilt.android.plugin") + id("com.google.devtools.ksp") } def apiKeyPropertiesFile = rootProject.file('apikey.properties') @@ -10,14 +11,11 @@ def apiKeyProperties = new Properties() apiKeyProperties.load(new FileInputStream(apiKeyPropertiesFile)) android { - compileSdkVersion 30 - buildToolsVersion "30.0.3" - + namespace 'com.timgortworst.cleanarchitecture.data' + compileSdk = 35 defaultConfig { - minSdkVersion 23 - targetSdkVersion 30 - versionCode 1 - versionName "1.0" + minSdkVersion 25 + targetSdkVersion 35 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" @@ -37,11 +35,16 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } + kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "21" + } + + buildFeatures { + buildConfig true } } @@ -49,28 +52,31 @@ dependencies { implementation project(":domain") implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.3.0' - implementation 'androidx.appcompat:appcompat:1.1.0' - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + implementation 'androidx.core:core-ktx:1.15.0' + implementation 'androidx.appcompat:appcompat:1.7.0' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.2.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' implementation "androidx.paging:paging-runtime-ktx:$paging_version" // network api "com.squareup.retrofit2:retrofit:$retrofit_version" api "com.squareup.retrofit2:converter-moshi:$retrofit_version" - implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1' + implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0' + implementation "com.squareup.moshi:moshi:$moshi_version" + implementation "com.squareup.moshi:moshi-kotlin:$moshi_version" + ksp("com.squareup.moshi:moshi-kotlin-codegen:$moshi_version") // database implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-ktx:$room_version" - kapt "androidx.room:room-compiler:$room_version" + ksp("androidx.room:room-compiler:$room_version") // shared preferences - implementation 'androidx.preference:preference:1.1.1' + implementation 'androidx.preference:preference-ktx:1.2.1' // Dependency Injection implementation("com.google.dagger:hilt-android:$hilt_version") - kapt("com.google.dagger:hilt-android-compiler:$hilt_version") + ksp("com.google.dagger:hilt-android-compiler:$hilt_version") } \ No newline at end of file diff --git a/data/src/main/AndroidManifest.xml b/data/src/main/AndroidManifest.xml index 7b611d0..c7e7078 100644 --- a/data/src/main/AndroidManifest.xml +++ b/data/src/main/AndroidManifest.xml @@ -1,3 +1,2 @@ - + \ No newline at end of file diff --git a/data/src/main/java/com/timgortworst/cleanarchitecture/data/di/AppModule.kt b/data/src/main/java/com/timgortworst/cleanarchitecture/data/di/AppModule.kt index b153d52..4c9c7ec 100644 --- a/data/src/main/java/com/timgortworst/cleanarchitecture/data/di/AppModule.kt +++ b/data/src/main/java/com/timgortworst/cleanarchitecture/data/di/AppModule.kt @@ -3,6 +3,7 @@ package com.timgortworst.cleanarchitecture.data.di import android.content.Context import androidx.room.Room import com.squareup.moshi.Moshi +import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import com.timgortworst.cleanarchitecture.data.BuildConfig import com.timgortworst.cleanarchitecture.data.error.ErrorHandlerImpl import com.timgortworst.cleanarchitecture.data.local.* @@ -75,7 +76,9 @@ abstract class AppModule { @MoshiDefault fun provideMoshi( builder: Moshi.Builder - ): Moshi = builder.build() + ): Moshi = builder + .add(KotlinJsonAdapterFactory()) + .build() @Provides fun provideMoshiBuilder() = Moshi.Builder() diff --git a/data/src/main/java/com/timgortworst/cleanarchitecture/data/model/movie/MoviesJson.kt b/data/src/main/java/com/timgortworst/cleanarchitecture/data/model/movie/MoviesJson.kt index 221ec8a..94ceeaa 100644 --- a/data/src/main/java/com/timgortworst/cleanarchitecture/data/model/movie/MoviesJson.kt +++ b/data/src/main/java/com/timgortworst/cleanarchitecture/data/model/movie/MoviesJson.kt @@ -1,8 +1,10 @@ package com.timgortworst.cleanarchitecture.data.model.movie import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class MoviesJson( @field:Json(name = "page") val page: Int?, @field:Json(name = "total_pages") val totalPages: Int?, @@ -10,6 +12,7 @@ data class MoviesJson( @field:Json(name = "results") val results: List?, ) { + @JsonClass(generateAdapter = true) data class Result( @field:Json(name = "adult") val adult: Boolean?, @field:Json(name = "backdrop_path") val backdropPath: String?, diff --git a/domain/build.gradle b/domain/build.gradle index 8f57df0..555a748 100644 --- a/domain/build.gradle +++ b/domain/build.gradle @@ -1,15 +1,20 @@ plugins { id("java-library") id("kotlin") + id("com.google.devtools.ksp") } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1' implementation "javax.inject:javax.inject:1" implementation("androidx.paging:paging-common:$paging_version") + + implementation "com.squareup.moshi:moshi:$moshi_version" + implementation "com.squareup.moshi:moshi-kotlin:$moshi_version" + ksp("com.squareup.moshi:moshi-kotlin-codegen:$moshi_version") } -sourceCompatibility = "1.8" -targetCompatibility = "1.8" +sourceCompatibility = JavaVersion.VERSION_21 +targetCompatibility = JavaVersion.VERSION_21 diff --git a/domain/src/main/java/com/timgortworst/cleanarchitecture/domain/model/movie/Movie.kt b/domain/src/main/java/com/timgortworst/cleanarchitecture/domain/model/movie/Movie.kt index af6f84a..0644180 100644 --- a/domain/src/main/java/com/timgortworst/cleanarchitecture/domain/model/movie/Movie.kt +++ b/domain/src/main/java/com/timgortworst/cleanarchitecture/domain/model/movie/Movie.kt @@ -1,5 +1,8 @@ package com.timgortworst.cleanarchitecture.domain.model.movie +import com.squareup.moshi.JsonClass + +@JsonClass(generateAdapter = true) data class Movie( val adult: Boolean, val backdropPath: String?, diff --git a/domain/src/main/java/com/timgortworst/cleanarchitecture/domain/model/movie/Movies.kt b/domain/src/main/java/com/timgortworst/cleanarchitecture/domain/model/movie/Movies.kt index 3fed789..955903a 100644 --- a/domain/src/main/java/com/timgortworst/cleanarchitecture/domain/model/movie/Movies.kt +++ b/domain/src/main/java/com/timgortworst/cleanarchitecture/domain/model/movie/Movies.kt @@ -1,5 +1,8 @@ package com.timgortworst.cleanarchitecture.domain.model.movie +import com.squareup.moshi.JsonClass + +@JsonClass(generateAdapter = true) data class Movies( val page: Int, val results: List, diff --git a/gradle.properties b/gradle.properties index 4dbdf96..1077f43 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,4 +18,6 @@ android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +android.nonTransitiveRClass=true +android.nonFinalResIds=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7b76d69..c1933ca 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Jul 08 14:10:48 CEST 2020 +#Sun Mar 09 12:25:49 EET 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip diff --git a/presentation/build.gradle b/presentation/build.gradle index 7d27826..3528d3b 100644 --- a/presentation/build.gradle +++ b/presentation/build.gradle @@ -4,6 +4,7 @@ plugins { id 'kotlin-kapt' id 'dagger.hilt.android.plugin' id 'androidx.navigation.safeargs' + id 'com.google.devtools.ksp' } def apiKeyPropertiesFile = rootProject.file('apikey.properties') @@ -17,17 +18,16 @@ def keystoreProperties = new Properties() keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) android { - compileSdkVersion 30 - buildToolsVersion "30.0.3" - + namespace 'com.timgortworst.cleanarchitecture.presentation' + compileSdk = 35 applicationVariants.all { variant -> variant.resValue "string", "versionName", variant.versionName } defaultConfig { applicationId "com.timgortworst.cleanarchitecture" - minSdkVersion 23 - targetSdkVersion 30 + minSdkVersion 25 + targetSdkVersion 35 versionCode 1 versionName "1.0.0" @@ -68,16 +68,20 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "21" } buildFeatures { viewBinding true + buildConfig true + } + ksp { + arg("room.schemaLocation", "$projectDir/schemas") } } @@ -85,40 +89,40 @@ dependencies { implementation project(":domain") implementation project(":data") - implementation 'androidx.core:core-ktx:1.3.2' + implementation 'androidx.core:core-ktx:1.15.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.1.1' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.1' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.10.1' // google - android - implementation 'androidx.recyclerview:recyclerview:1.2.1' - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation 'androidx.recyclerview:recyclerview:1.4.0' + implementation 'androidx.constraintlayout:constraintlayout:2.2.1' implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" implementation "androidx.paging:paging-runtime-ktx:$paging_version" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" - implementation 'androidx.appcompat:appcompat:1.3.0' - implementation 'com.google.android.material:material:1.4.0-beta01' + implementation 'androidx.appcompat:appcompat:1.7.0' + implementation 'com.google.android.material:material:1.12.0' // testing - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.2.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' // Image caching - implementation 'com.github.bumptech.glide:glide:4.12.0' - kapt 'com.github.bumptech.glide:compiler:4.12.0' + implementation 'com.github.bumptech.glide:glide:4.16.0' + ksp('com.github.bumptech.glide:compiler:4.16.0') // Navigation Component implementation("androidx.navigation:navigation-fragment-ktx:$nav_version") implementation("androidx.navigation:navigation-ui-ktx:$nav_version") implementation "androidx.fragment:fragment-ktx:$fragment_version" - implementation 'androidx.preference:preference-ktx:1.1.1' + implementation 'androidx.preference:preference-ktx:1.2.1' // Dependency Injection implementation("com.google.dagger:hilt-android:$hilt_version") - kapt("com.google.dagger:hilt-android-compiler:$hilt_version") + ksp("com.google.dagger:hilt-android-compiler:$hilt_version") } diff --git a/presentation/src/main/AndroidManifest.xml b/presentation/src/main/AndroidManifest.xml index 81816eb..d14e153 100644 --- a/presentation/src/main/AndroidManifest.xml +++ b/presentation/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/presentation/src/main/java/com/timgortworst/cleanarchitecture/presentation/features/movie/details/MovieDetailsFragment.kt b/presentation/src/main/java/com/timgortworst/cleanarchitecture/presentation/features/movie/details/MovieDetailsFragment.kt index 153ac48..fae0814 100644 --- a/presentation/src/main/java/com/timgortworst/cleanarchitecture/presentation/features/movie/details/MovieDetailsFragment.kt +++ b/presentation/src/main/java/com/timgortworst/cleanarchitecture/presentation/features/movie/details/MovieDetailsFragment.kt @@ -68,9 +68,9 @@ class MovieDetailsFragment : Fragment(), AppBarOffsetListener.OnScrollStateListe enterTransition = inflater.inflateTransition(R.transition.media_detail_enter) returnTransition = inflater.inflateTransition(android.R.transition.fade) - sharedElementEnterTransition = TransitionInflater.from(context) + sharedElementEnterTransition = TransitionInflater.from(requireContext()) .inflateTransition(R.transition.shared_element_transition) - .addListener(object : TransitionListenerAdapter() { + ?.addListener(object : TransitionListenerAdapter() { override fun onTransitionEnd(transition: Transition) { exitTransition = null } @@ -171,7 +171,7 @@ class MovieDetailsFragment : Fragment(), AppBarOffsetListener.OnScrollStateListe override fun onLoadFailed( e: GlideException?, model: Any?, - target: Target?, + target: Target, isFirstResource: Boolean ): Boolean { startPostponedEnterTransition() diff --git a/presentation/src/main/java/com/timgortworst/cleanarchitecture/presentation/features/movie/list/MoviesFragment.kt b/presentation/src/main/java/com/timgortworst/cleanarchitecture/presentation/features/movie/list/MoviesFragment.kt index a11f151..2208932 100644 --- a/presentation/src/main/java/com/timgortworst/cleanarchitecture/presentation/features/movie/list/MoviesFragment.kt +++ b/presentation/src/main/java/com/timgortworst/cleanarchitecture/presentation/features/movie/list/MoviesFragment.kt @@ -51,7 +51,7 @@ class MoviesFragment : Fragment() { savedInstanceState: Bundle? ): View { _binding = FragmentMediaListBinding.inflate(layoutInflater, container, false) - sharedElementReturnTransition = TransitionInflater.from(context) + sharedElementReturnTransition = TransitionInflater.from(requireContext()) .inflateTransition(R.transition.shared_element_transition) return binding.root }