diff --git a/app/src/main/java/com/example/plainolnotes4/data/AppDatabase.kt b/app/src/main/java/com/example/plainolnotes4/data/AppDatabase.kt deleted file mode 100644 index 6a60efa..0000000 --- a/app/src/main/java/com/example/plainolnotes4/data/AppDatabase.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.example.plainolnotes4.data - -import android.content.Context -import androidx.room.Database -import androidx.room.Room -import androidx.room.RoomDatabase -import androidx.room.TypeConverters - -@Database(entities = [NoteEntity::class], version = 1, exportSchema = false) -@TypeConverters(DateConverter::class) -abstract class AppDatabase: RoomDatabase() { - - companion object { - private var INSTANCE: AppDatabase? = null - - fun getInstance(context: Context): AppDatabase? { - if (INSTANCE == null) { - synchronized(AppDatabase::class) { - INSTANCE = Room.databaseBuilder( - context.applicationContext, - AppDatabase::class.java, - "plainolnotes.db" - ).build() - } - } - return INSTANCE - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/example/plainolnotes4/data/DateConverter.kt b/app/src/main/java/com/example/plainolnotes4/data/DateConverter.kt deleted file mode 100644 index e929d1b..0000000 --- a/app/src/main/java/com/example/plainolnotes4/data/DateConverter.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.example.plainolnotes4.data - -import androidx.room.TypeConverter -import java.util.* - -class DateConverter { - - @TypeConverter - fun fromTimestamp(value: Long): Date { - return Date(value) - } - - @TypeConverter - fun dateToTimestamp(date: Date): Long { - return date.time - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/example/plainolnotes4/data/NoteDao.kt b/app/src/main/java/com/example/plainolnotes4/data/NoteDao.kt deleted file mode 100644 index ac83317..0000000 --- a/app/src/main/java/com/example/plainolnotes4/data/NoteDao.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.example.plainolnotes4.data - -import androidx.lifecycle.LiveData -import androidx.room.* - -@Dao -interface NoteDao { - @Insert(onConflict = OnConflictStrategy.REPLACE) - fun insertNote(note: NoteEntity) - - @Insert(onConflict = OnConflictStrategy.IGNORE) - fun insertNotes(notes: List) - - @Delete - fun deleteNote(note: NoteEntity) - - @Delete - fun deleteNotes(notes: List) - - @Query("SELECT * FROM notes WHERE id = :id") - fun getNoteById(id: Int) - - @Query("SELECT * FROM notes ORDER BY date ASC") - fun getAll(): LiveData> - - @Query("DELETE FROM notes") - fun deleteAll(): Int - - @Query("SELECT COUNT(*) FROM notes") - fun getCount(): Int - -} \ No newline at end of file