diff --git a/Sources/app/build.gradle b/Sources/app/build.gradle index 01e74c5..3440a82 100644 --- a/Sources/app/build.gradle +++ b/Sources/app/build.gradle @@ -1,16 +1,17 @@ plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' + id 'kotlin-kapt' } android { namespace 'fr.iut.pm.movieapplication' - compileSdk 32 + compileSdk 33 defaultConfig { applicationId "fr.iut.pm.movieapplication" minSdk 16 - targetSdk 32 + targetSdk 33 versionCode 1 versionName "1.0" @@ -27,6 +28,11 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + + packagingOptions { + exclude 'META-INF/atomicfu.kotlin_module' + } + kotlinOptions { jvmTarget = '1.8' } @@ -34,12 +40,35 @@ android { dependencies { - implementation 'androidx.core:core-ktx:1.7.0' - implementation 'androidx.appcompat:appcompat:1.5.1' - implementation 'com.google.android.material:material:1.6.1' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.room:room-common:2.4.2' - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' -} \ No newline at end of file + implementation "androidx.appcompat:appcompat:$rootProject.appCompatVersion" + implementation "androidx.activity:activity-ktx:$rootProject.activityVersion" + + // Room components + implementation "androidx.room:room-ktx:$rootProject.roomVersion" + kapt "androidx.room:room-compiler:$rootProject.roomVersion" + androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion" + + // Lifecycle components + implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$rootProject.lifecycleVersion" + implementation "androidx.lifecycle:lifecycle-livedata-ktx:$rootProject.lifecycleVersion" + implementation "androidx.lifecycle:lifecycle-common-java8:$rootProject.lifecycleVersion" + + // Kotlin components + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutines" + api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutines" + + // UI + implementation "androidx.constraintlayout:constraintlayout:$rootProject.constraintLayoutVersion" + implementation "com.google.android.material:material:$rootProject.materialVersion" + + // Testing + testImplementation "junit:junit:$rootProject.junitVersion" + androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion" + androidTestImplementation ("androidx.test.espresso:espresso-core:$rootProject.espressoVersion", { + exclude group: 'com.android.support', module: 'support-annotations' + }) + androidTestImplementation "androidx.test.ext:junit:$rootProject.androidxJunitVersion" + +} + diff --git a/Sources/app/src/main/java/fr/iut/pm/movieapplication/data/dao/MovieDAO.kt b/Sources/app/src/main/java/fr/iut/pm/movieapplication/data/dao/MovieDAO.kt new file mode 100644 index 0000000..bd50cd9 --- /dev/null +++ b/Sources/app/src/main/java/fr/iut/pm/movieapplication/data/dao/MovieDAO.kt @@ -0,0 +1,15 @@ +package fr.iut.pm.movieapplication.data.dao + +import androidx.room.Dao +import androidx.room.Query +import fr.iut.pm.movieapplication.model.Movie +import kotlinx.coroutines.flow.Flow + +@Dao +interface MovieDAO { + + @Query("SELECT * FROM movies_table ORDER BY original_title ASC") + fun getMovieByAlphabetizeMovie() : Flow> + + +} \ No newline at end of file diff --git a/Sources/app/src/main/res/layout/activity_main.xml b/Sources/app/src/main/res/layout/activity_main.xml index cbde526..fef6e47 100644 --- a/Sources/app/src/main/res/layout/activity_main.xml +++ b/Sources/app/src/main/res/layout/activity_main.xml @@ -6,4 +6,17 @@ android:layout_height="match_parent" tools:context=".ui.activity.MainActivity"> + + \ No newline at end of file diff --git a/Sources/build.gradle b/Sources/build.gradle index da6a4a3..f8c3a46 100644 --- a/Sources/build.gradle +++ b/Sources/build.gradle @@ -5,3 +5,19 @@ plugins { id 'org.jetbrains.kotlin.android' version '1.7.10' apply false } +ext { + activityVersion = '1.6.1' + appCompatVersion = '1.6.0' + constraintLayoutVersion = '2.1.4' + coreTestingVersion = '2.1.0' + coroutines = '1.6.4' + lifecycleVersion = '2.5.1' + materialVersion = '1.7.0' + roomVersion = '2.5.0' + kotlin_version = '1.7.20' + // testing + junitVersion = '4.13.2' + espressoVersion = '3.1.0' + androidxJunitVersion = '1.1.5' + +} diff --git a/Sources/gradle.properties b/Sources/gradle.properties index 3c5031e..ee1d843 100644 --- a/Sources/gradle.properties +++ b/Sources/gradle.properties @@ -20,4 +20,5 @@ kotlin.code.style=official # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true \ No newline at end of file +android.nonTransitiveRClass=true +kapt.use.jvm.ir=true \ No newline at end of file