From dfa41e9c9418662ff112a5f2e893b3ffc7123099 Mon Sep 17 00:00:00 2001 From: Mika Date: Sat, 22 Jul 2023 21:25:44 +0200 Subject: [PATCH] Before gradle plugin update --- .idea/vcs.xml | 6 ++++ app/build.gradle | 30 +++++++++++++++++-- .../fitnessjourney/database/PictureEntity.kt | 10 +++++++ .../converter/LocalDateTimeConverter.kt | 16 ++++++++++ build.gradle | 4 +-- 5 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 .idea/vcs.xml create mode 100644 app/src/main/java/de/polyfish0/fitnessjourney/database/PictureEntity.kt create mode 100644 app/src/main/java/de/polyfish0/fitnessjourney/database/converter/LocalDateTimeConverter.kt diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 72ce03c..4b75865 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,16 +1,17 @@ plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' + id 'kotlin-kapt' } android { namespace 'de.polyfish0.fitnessjourney' - compileSdk 33 + compileSdk 34 defaultConfig { applicationId "de.polyfish0.fitnessjourney" - minSdk 24 - targetSdk 33 + minSdk 26 + targetSdk 34 versionCode 1 versionName "1.0" @@ -47,6 +48,29 @@ android { } dependencies { + def room_version = "2.5.2" + + implementation "androidx.room:room-runtime:$room_version" + annotationProcessor "androidx.room:room-compiler:$room_version" + + // To use Kotlin annotation processing tool (kapt) + kapt "androidx.room:room-compiler:$room_version" + + // optional - RxJava2 support for Room + //implementation "androidx.room:room-rxjava2:$room_version" + + // optional - RxJava3 support for Room + //implementation "androidx.room:room-rxjava3:$room_version" + + // optional - Guava support for Room, including Optional and ListenableFuture + //implementation "androidx.room:room-guava:$room_version" + + // optional - Test helpers + testImplementation "androidx.room:room-testing:$room_version" + + // optional - Paging 3 Integration + //implementation "androidx.room:room-paging:$room_version" + implementation "com.google.accompanist:accompanist-systemuicontroller:0.27.0" implementation 'com.google.android.material:material:1.9.0' implementation "androidx.navigation:navigation-compose:2.5.3" diff --git a/app/src/main/java/de/polyfish0/fitnessjourney/database/PictureEntity.kt b/app/src/main/java/de/polyfish0/fitnessjourney/database/PictureEntity.kt new file mode 100644 index 0000000..8c08863 --- /dev/null +++ b/app/src/main/java/de/polyfish0/fitnessjourney/database/PictureEntity.kt @@ -0,0 +1,10 @@ +package de.polyfish0.fitnessjourney.database + +import androidx.room.ColumnInfo +import androidx.room.PrimaryKey + +data class PictureEntity( + @PrimaryKey val pid: Int, + @ColumnInfo(name = "path") val path: String, + @ColumnInfo(name = "date") val date: Date +) \ No newline at end of file diff --git a/app/src/main/java/de/polyfish0/fitnessjourney/database/converter/LocalDateTimeConverter.kt b/app/src/main/java/de/polyfish0/fitnessjourney/database/converter/LocalDateTimeConverter.kt new file mode 100644 index 0000000..9a3ba48 --- /dev/null +++ b/app/src/main/java/de/polyfish0/fitnessjourney/database/converter/LocalDateTimeConverter.kt @@ -0,0 +1,16 @@ +package de.polyfish0.fitnessjourney.database.converter + +import androidx.room.TypeConverter +import java.time.LocalDateTime + +class LocalDateTimeConverter { + @TypeConverter + fun fromTimestamp(value: String?): LocalDateTime? { + return value?.let { LocalDateTime.parse(it) } + } + + @TypeConverter + fun dateToTimestamp(date: LocalDateTime?): String? { + return date?.toString() + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 4314313..d4fde78 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '8.0.2' apply false - id 'com.android.library' version '8.0.2' apply false + id 'com.android.application' version '8.1.0-rc01' apply false + id 'com.android.library' version '8.1.0-rc01' apply false id 'org.jetbrains.kotlin.android' version '1.7.20' apply false } \ No newline at end of file