From 385df437c0d3fc960df6357dfc73678b8793d790 Mon Sep 17 00:00:00 2001 From: Pablo Guardiola Date: Mon, 29 Jan 2018 22:06:49 +0100 Subject: [PATCH] change mapstate to double instead of float (#60) --- .../android/telemetry/MapClickEvent.java | 18 +++++++++--------- .../android/telemetry/MapDragendEvent.java | 18 +++++++++--------- .../com/mapbox/android/telemetry/MapState.java | 14 +++++++------- .../android/telemetry/MapEventFactoryTest.java | 6 +++--- .../TelemetryClientMapEventsTest.java | 6 +++--- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/libtelemetry/src/main/java/com/mapbox/android/telemetry/MapClickEvent.java b/libtelemetry/src/main/java/com/mapbox/android/telemetry/MapClickEvent.java index 52d8ea55b..ff52a5b39 100644 --- a/libtelemetry/src/main/java/com/mapbox/android/telemetry/MapClickEvent.java +++ b/libtelemetry/src/main/java/com/mapbox/android/telemetry/MapClickEvent.java @@ -15,11 +15,11 @@ class MapClickEvent extends Event implements Parcelable { @SerializedName("gesture") private final String gesture; @SerializedName("lat") - private float latitude; + private double latitude; @SerializedName("lng") - private float longitude; + private double longitude; @SerializedName("zoom") - private float zoom; + private double zoom; @SerializedName("orientation") private String orientation = null; @SerializedName("batteryLevel") @@ -75,9 +75,9 @@ private MapClickEvent(Parcel in) { event = in.readString(); created = in.readString(); gesture = in.readString(); - latitude = in.readFloat(); - longitude = in.readFloat(); - zoom = in.readFloat(); + latitude = in.readDouble(); + longitude = in.readDouble(); + zoom = in.readDouble(); orientation = in.readString(); batteryLevel = in.readByte() == 0x00 ? null : in.readInt(); byte pluggedInVal = in.readByte(); @@ -98,9 +98,9 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeString(event); dest.writeString(created); dest.writeString(gesture); - dest.writeFloat(latitude); - dest.writeFloat(longitude); - dest.writeFloat(zoom); + dest.writeDouble(latitude); + dest.writeDouble(longitude); + dest.writeDouble(zoom); dest.writeString(orientation); if (batteryLevel == null) { dest.writeByte((byte) (0x00)); diff --git a/libtelemetry/src/main/java/com/mapbox/android/telemetry/MapDragendEvent.java b/libtelemetry/src/main/java/com/mapbox/android/telemetry/MapDragendEvent.java index 3ad85c715..9e8275950 100644 --- a/libtelemetry/src/main/java/com/mapbox/android/telemetry/MapDragendEvent.java +++ b/libtelemetry/src/main/java/com/mapbox/android/telemetry/MapDragendEvent.java @@ -13,11 +13,11 @@ class MapDragendEvent extends Event implements Parcelable { @SerializedName("created") private String created; @SerializedName("lat") - private float latitude; + private double latitude; @SerializedName("lng") - private float longitude; + private double longitude; @SerializedName("zoom") - private float zoom; + private double zoom; @SerializedName("orientation") private String orientation = null; @SerializedName("batteryLevel") @@ -71,9 +71,9 @@ void setWifi(boolean wifi) { private MapDragendEvent(Parcel in) { event = in.readString(); created = in.readString(); - latitude = in.readFloat(); - longitude = in.readFloat(); - zoom = in.readFloat(); + latitude = in.readDouble(); + longitude = in.readDouble(); + zoom = in.readDouble(); orientation = in.readString(); batteryLevel = in.readByte() == 0x00 ? null : in.readInt(); byte pluggedInVal = in.readByte(); @@ -93,9 +93,9 @@ public int describeContents() { public void writeToParcel(Parcel dest, int flags) { dest.writeString(event); dest.writeString(created); - dest.writeFloat(latitude); - dest.writeFloat(longitude); - dest.writeFloat(zoom); + dest.writeDouble(latitude); + dest.writeDouble(longitude); + dest.writeDouble(zoom); dest.writeString(orientation); if (batteryLevel == null) { dest.writeByte((byte) (0x00)); diff --git a/libtelemetry/src/main/java/com/mapbox/android/telemetry/MapState.java b/libtelemetry/src/main/java/com/mapbox/android/telemetry/MapState.java index f3fac458e..336077c56 100644 --- a/libtelemetry/src/main/java/com/mapbox/android/telemetry/MapState.java +++ b/libtelemetry/src/main/java/com/mapbox/android/telemetry/MapState.java @@ -1,12 +1,12 @@ package com.mapbox.android.telemetry; public class MapState { - private float latitude; - private float longitude; - private float zoom; + private double latitude; + private double longitude; + private double zoom; private String gesture; - public MapState(float latitude, float longitude, float zoom) { + public MapState(double latitude, double longitude, double zoom) { this.latitude = latitude; this.longitude = longitude; this.zoom = zoom; @@ -20,15 +20,15 @@ String getGesture() { return gesture; } - float getLatitude() { + double getLatitude() { return latitude; } - float getLongitude() { + double getLongitude() { return longitude; } - float getZoom() { + double getZoom() { return zoom; } } diff --git a/libtelemetry/src/test/java/com/mapbox/android/telemetry/MapEventFactoryTest.java b/libtelemetry/src/test/java/com/mapbox/android/telemetry/MapEventFactoryTest.java index b96ba67d3..9e16dd65a 100644 --- a/libtelemetry/src/test/java/com/mapbox/android/telemetry/MapEventFactoryTest.java +++ b/libtelemetry/src/test/java/com/mapbox/android/telemetry/MapEventFactoryTest.java @@ -142,9 +142,9 @@ private void initializeMapboxTelemetry() { } private MapState obtainAValidMapState() { - float aLatitude = 40.416775f; - float aLongitude = -3.703790f; - float aZoom = 1.5f; + double aLatitude = 40.416775d; + double aLongitude = -3.703790d; + double aZoom = 1.5d; return new MapState(aLatitude, aLongitude, aZoom); } } \ No newline at end of file diff --git a/libtelemetry/src/test/java/com/mapbox/android/telemetry/TelemetryClientMapEventsTest.java b/libtelemetry/src/test/java/com/mapbox/android/telemetry/TelemetryClientMapEventsTest.java index 27e39a91c..323b5f5dd 100644 --- a/libtelemetry/src/test/java/com/mapbox/android/telemetry/TelemetryClientMapEventsTest.java +++ b/libtelemetry/src/test/java/com/mapbox/android/telemetry/TelemetryClientMapEventsTest.java @@ -134,9 +134,9 @@ private void initializeMapboxTelemetry(Context context) { } private MapState obtainDefaultMapState() { - float aLatitude = 40.416775f; - float aLongitude = -3.703790f; - float aZoom = 1.5f; + double aLatitude = 40.416775d; + double aLongitude = -3.703790d; + double aZoom = 1.5d; return new MapState(aLatitude, aLongitude, aZoom); }