This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sourceSets { | |
| ... | |
| val androidMain by getting { | |
| dependencies { | |
| implementation("androidx.activity:activity-compose:1.7.2") | |
| implementation("androidx.appcompat:appcompat:1.6.1") | |
| implementation("androidx.core:core-ktx:1.10.1") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kotlin { | |
| ... | |
| sourceSets { | |
| val commonTest by getting { | |
| dependencies { | |
| implementation(kotlin("test")) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kotlin { | |
| // Android | |
| jvm { | |
| compilations.all { | |
| kotlinOptions.jvmTarget = "1.8" | |
| } | |
| withJava() | |
| testRuns["test"].executionTask.configure { | |
| useJUnitPlatform() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pluginManagement { | |
| repositories { | |
| google() | |
| gradlePluginPortal() | |
| mavenCentral() | |
| } | |
| } | |
| dependencyResolutionManagement { | |
| repositories { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plugins { | |
| kotlin("multiplatform") version "1.9.0" | |
| } | |
| kotlin { | |
| // Targets | |
| // Source Sets | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Entity | |
| public class Product { | |
| // productId, name, price, @Ignore image | |
| @TypeConverters(value = SQLTypeConverters.class) | |
| @ColumnInfo(defaultValue = "CURRENT_TIMESTAMP") | |
| public Date timestamp; | |
| public Product(long productId, String name, double price) { | |
| this.productId = productId; | |
| this.name = name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SQLTypeConverters { | |
| @TypeConverter | |
| public Date fromTimestamp(String value) { | |
| Date defaultDate = new Date(); | |
| SimpleDateFormat format = new SimpleDateFormat(); | |
| try { | |
| return value.equals("") ? defaultDate : format.parse(value); | |
| } catch (ParseException e) { | |
| e.printStackTrace(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Entity | |
| public class Product { | |
| // ... productId, name, price, @Ignore image | |
| @ColumnInfo(defaultValue = "CURRENT_TIMESTAMP") | |
| public String timestamp; | |
| public Product(long productId, String name, double price) { | |
| this.productId = productId; | |
| this.name = name; | |
| this.price = price; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Room | |
| .databaseBuilder(this, Database.class, "database") | |
| .addMigrations(Migrations.MIGRATION_1_2) | |
| .fallbackToDestructiveMigration() | |
| .build(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Room | |
| .databaseBuilder(this, Database.class, "database") | |
| .addMigrations(Migrations.MIGRATION_1_2) | |
| .build(); |
NewerOlder