@@ -7,13 +7,8 @@ import androidx.compose.ui.graphics.Color
77import androidx.compose.ui.graphics.toArgb
88import com.what3words.core.types.geometry.W3WCoordinates
99import com.what3words.core.types.geometry.W3WRectangle
10- import kotlinx.serialization.KSerializer
11- import kotlinx.serialization.Serializable
12- import kotlinx.serialization.descriptors.PrimitiveKind
13- import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
14- import kotlinx.serialization.descriptors.SerialDescriptor
15- import kotlinx.serialization.encoding.Decoder
16- import kotlinx.serialization.encoding.Encoder
10+ import com.what3words.core.types.language.W3WLanguage
11+ import com.what3words.core.types.language.W3WProprietaryLanguage
1712
1813/* *
1914 * Represents a marker on a map, associated with a what3words address.
@@ -31,6 +26,7 @@ data class W3WMarker(
3126 val square : W3WRectangle ,
3227 val color : W3WMarkerColor ,
3328 val center : W3WCoordinates ,
29+ val language : W3WLanguage ,
3430 val title : String? = null ,
3531 val snippet : String? = null ,
3632 val zoomOutScale : Float = 1f ,
@@ -56,6 +52,7 @@ data class W3WMarker(
5652 parcel.readDouble(),
5753 parcel.readDouble()
5854 ),
55+ W3WProprietaryLanguage (parcel.readString()!! , parcel.readString(), null , null ),
5956 parcel.readString(),
6057 parcel.readString()
6158 )
@@ -96,12 +93,9 @@ data class W3WMarker(
9693 * @property slash The color of the slash in the marker.
9794 * @property id A unique identifier generated from the combination of background and slash colors.
9895 */
99- @Serializable
10096@Immutable
10197data class W3WMarkerColor (
102- @Serializable(with = ColorSerializer ::class )
10398 val background : Color ,
104- @Serializable(with = ColorSerializer ::class )
10599 val slash : Color
106100) {
107101 val id: Long
@@ -110,16 +104,4 @@ data class W3WMarkerColor(
110104 val slashLong = slash.toArgb().toLong() and 0xFFFFFFFFL
111105 return (backgroundLong shl 32 ) or slashLong
112106 }
113- }
114-
115- object ColorSerializer : KSerializer<Color> {
116- override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor (" Color" , PrimitiveKind .LONG )
117-
118- override fun serialize (encoder : Encoder , value : Color ) {
119- encoder.encodeLong(value.value.toLong())
120- }
121-
122- override fun deserialize (decoder : Decoder ): Color {
123- return Color (decoder.decodeLong().toULong())
124- }
125107}
0 commit comments