|
|
@ -7,23 +7,16 @@ import androidx.room.Embedded
|
|
|
|
import androidx.room.Ignore
|
|
|
|
import androidx.room.Ignore
|
|
|
|
import java.io.Serializable
|
|
|
|
import java.io.Serializable
|
|
|
|
|
|
|
|
|
|
|
|
class Location : Serializable, Parcelable {
|
|
|
|
data class Location(
|
|
|
|
@Embedded lateinit var geofence: Geofence
|
|
|
|
@Embedded val geofence: Geofence,
|
|
|
|
@Embedded lateinit var place: Place
|
|
|
|
@Embedded val place: Place,
|
|
|
|
|
|
|
|
) : Serializable, Parcelable {
|
|
|
|
constructor()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Ignore
|
|
|
|
|
|
|
|
constructor(geofence: Geofence, place: Place) {
|
|
|
|
|
|
|
|
this.geofence = geofence
|
|
|
|
|
|
|
|
this.place = place
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Ignore
|
|
|
|
@Ignore
|
|
|
|
private constructor(parcel: Parcel) {
|
|
|
|
private constructor(parcel: Parcel): this(
|
|
|
|
geofence = parcel.readParcelable(Geofence::class.java.classLoader)!!
|
|
|
|
geofence = parcel.readParcelable(Geofence::class.java.classLoader)!!,
|
|
|
|
place = parcel.readParcelable(Place::class.java.classLoader)!!
|
|
|
|
place = parcel.readParcelable(Place::class.java.classLoader)!!,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
val task: Long
|
|
|
|
val task: Long
|
|
|
|
get() = geofence.task
|
|
|
|
get() = geofence.task
|
|
|
@ -66,24 +59,6 @@ class Location : Serializable, Parcelable {
|
|
|
|
dest.writeParcelable(place, flags)
|
|
|
|
dest.writeParcelable(place, flags)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
override fun equals(other: Any?): Boolean {
|
|
|
|
|
|
|
|
if (this === other) return true
|
|
|
|
|
|
|
|
if (other !is Location) return false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (geofence != other.geofence) return false
|
|
|
|
|
|
|
|
if (place != other.place) return false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun hashCode(): Int {
|
|
|
|
|
|
|
|
var result = geofence.hashCode()
|
|
|
|
|
|
|
|
result = 31 * result + place.hashCode()
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun toString(): String = "Location(geofence=$geofence, place=$place)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
companion object {
|
|
|
|
@JvmField val CREATOR: Parcelable.Creator<Location> = object : Parcelable.Creator<Location> {
|
|
|
|
@JvmField val CREATOR: Parcelable.Creator<Location> = object : Parcelable.Creator<Location> {
|
|
|
|
override fun createFromParcel(`in`: Parcel): Location = Location(`in`)
|
|
|
|
override fun createFromParcel(`in`: Parcel): Location = Location(`in`)
|
|
|
|