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
23 changes: 12 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@
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 {
google()
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
Expand Down
44 changes: 25 additions & 19 deletions data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@ plugins {
id("kotlin-android")
id("kotlin-kapt")
id("dagger.hilt.android.plugin")
id("com.google.devtools.ksp")
}

def apiKeyPropertiesFile = rootProject.file('apikey.properties')
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"
Expand All @@ -37,40 +35,48 @@ 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
}
}

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")
}
3 changes: 1 addition & 2 deletions data/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timgortworst.cleanarchitecture.data">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
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?,
@field:Json(name = "total_results") val totalResults: Int?,
@field:Json(name = "results") val results: List<Result>?,
) {

@JsonClass(generateAdapter = true)
data class Result(
@field:Json(name = "adult") val adult: Boolean?,
@field:Json(name = "backdrop_path") val backdropPath: String?,
Expand Down
11 changes: 8 additions & 3 deletions domain/build.gradle
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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?,
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Movie>,
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
kotlin.code.style=official
android.nonTransitiveRClass=true
android.nonFinalResIds=false
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
50 changes: 27 additions & 23 deletions presentation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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"

Expand Down Expand Up @@ -68,57 +68,61 @@ 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")
}
}

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")
}
3 changes: 1 addition & 2 deletions presentation/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timgortworst.cleanarchitecture.presentation">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -171,7 +171,7 @@ class MovieDetailsFragment : Fragment(), AppBarOffsetListener.OnScrollStateListe
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
target: Target<Drawable?>,
isFirstResource: Boolean
): Boolean {
startPostponedEnterTransition()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down