Skip to content

Commit

Permalink
create a data class Task.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
comye1 committed Apr 29, 2021
1 parent 5ac61e2 commit fa75c41
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions app/src/main/java/com/codinginflow/mvvmtodo/data/Task.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.codinginflow.mvvmtodo.data

import android.os.Parcelable
import androidx.room.Entity
import androidx.room.PrimaryKey
import kotlinx.android.parcel.Parcelize
import java.text.DateFormat

@Entity(tableName = "task_table")
@Parcelize
data class Task (
val name: String,
val important: Boolean = false,
val completed: Boolean = false,
val created: Long = System.currentTimeMillis(),
@PrimaryKey(autoGenerate = true) val id: Int = 0
) : Parcelable {
val createdDateFormatted: String
get() = DateFormat.getDateTimeInstance().format(created)
}

0 comments on commit fa75c41

Please sign in to comment.