This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kevin
committed
Apr 4, 2019
1 parent
d9799df
commit 6fc5fcf
Showing
8 changed files
with
664 additions
and
110 deletions.
There are no files selected for viewing
122 changes: 122 additions & 0 deletions
122
...MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapClickEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
package com.mapbox.mapboxsdk.module.telemetry; | ||
|
||
import android.content.Context; | ||
import android.os.Parcel; | ||
import android.os.Parcelable; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import com.mapbox.android.telemetry.Event; | ||
import com.mapbox.android.telemetry.TelemetryUtils; | ||
|
||
class MapClickEvent extends Event implements Parcelable { | ||
private static final String MAP_CLICK = "map.click"; | ||
|
||
@SerializedName("event") | ||
private final String event; | ||
@SerializedName("created") | ||
private String created; | ||
@SerializedName("gesture") | ||
private final String gesture; | ||
@SerializedName("lat") | ||
private double latitude; | ||
@SerializedName("lng") | ||
private double longitude; | ||
@SerializedName("zoom") | ||
private double zoom; | ||
@SerializedName("orientation") | ||
private String orientation = null; | ||
@SerializedName("batteryLevel") | ||
private Integer batteryLevel; | ||
@SerializedName("pluggedIn") | ||
private Boolean pluggedIn; | ||
@SerializedName("carrier") | ||
private String carrier = null; | ||
@SerializedName("cellularNetworkType") | ||
private String cellularNetworkType; | ||
@SerializedName("wifi") | ||
private Boolean wifi = null; | ||
|
||
MapClickEvent(MapState mapState) { | ||
this.event = MAP_CLICK; | ||
this.gesture = mapState.getGesture(); | ||
this.latitude = mapState.getLatitude(); | ||
this.longitude = mapState.getLongitude(); | ||
this.zoom = mapState.getZoom(); | ||
this.created = TelemetryUtils.obtainCurrentDate(); | ||
this.batteryLevel = 0; | ||
this.pluggedIn = false; | ||
this.cellularNetworkType = ""; | ||
} | ||
|
||
MapClickEvent setDeviceInfo(Context context) { | ||
this.batteryLevel = TelemetryUtils.obtainBatteryLevel(context); | ||
this.pluggedIn = TelemetryUtils.isPluggedIn(context); | ||
this.cellularNetworkType = TelemetryUtils.obtainCellularNetworkType(context); | ||
return this; | ||
} | ||
|
||
void setOrientation(String orientation) { | ||
this.orientation = orientation; | ||
} | ||
|
||
void setCarrier(String carrier) { | ||
this.carrier = carrier; | ||
} | ||
|
||
void setWifi(boolean wifi) { | ||
this.wifi = wifi; | ||
} | ||
|
||
private MapClickEvent(Parcel in) { | ||
event = in.readString(); | ||
created = in.readString(); | ||
gesture = in.readString(); | ||
latitude = in.readDouble(); | ||
longitude = in.readDouble(); | ||
zoom = in.readDouble(); | ||
orientation = in.readString(); | ||
batteryLevel = in.readInt(); | ||
pluggedIn = in.readByte() != 0x00; | ||
carrier = in.readString(); | ||
cellularNetworkType = in.readString(); | ||
byte wifiVal = in.readByte(); | ||
wifi = wifiVal == 0x02 ? null : wifiVal != 0x00; | ||
} | ||
|
||
@Override | ||
public int describeContents() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void writeToParcel(Parcel dest, int flags) { | ||
dest.writeString(event); | ||
dest.writeString(created); | ||
dest.writeString(gesture); | ||
dest.writeDouble(latitude); | ||
dest.writeDouble(longitude); | ||
dest.writeDouble(zoom); | ||
dest.writeString(orientation); | ||
dest.writeInt(batteryLevel); | ||
dest.writeByte((byte) (pluggedIn ? 0x01 : 0x00)); | ||
dest.writeString(carrier); | ||
dest.writeString(cellularNetworkType); | ||
if (wifi == null) { | ||
dest.writeByte((byte) (0x02)); | ||
} else { | ||
dest.writeByte((byte) (wifi ? 0x01 : 0x00)); | ||
} | ||
} | ||
|
||
public static final Creator<MapClickEvent> CREATOR = new Creator<MapClickEvent>() { | ||
@Override | ||
public MapClickEvent createFromParcel(Parcel in) { | ||
return new MapClickEvent(in); | ||
} | ||
|
||
@Override | ||
public MapClickEvent[] newArray(int size) { | ||
return new MapClickEvent[size]; | ||
} | ||
}; | ||
} |
117 changes: 117 additions & 0 deletions
117
...pboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapDragendEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
package com.mapbox.mapboxsdk.module.telemetry; | ||
|
||
import android.content.Context; | ||
import android.os.Parcel; | ||
import android.os.Parcelable; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import com.mapbox.android.telemetry.Event; | ||
import com.mapbox.android.telemetry.TelemetryUtils; | ||
|
||
class MapDragendEvent extends Event implements Parcelable { | ||
private static final String MAP_DRAGEND = "map.dragend"; | ||
|
||
@SerializedName("event") | ||
private final String event; | ||
@SerializedName("created") | ||
private String created; | ||
@SerializedName("lat") | ||
private double latitude; | ||
@SerializedName("lng") | ||
private double longitude; | ||
@SerializedName("zoom") | ||
private double zoom; | ||
@SerializedName("orientation") | ||
private String orientation = null; | ||
@SerializedName("batteryLevel") | ||
private int batteryLevel; | ||
@SerializedName("pluggedIn") | ||
private Boolean pluggedIn; | ||
@SerializedName("carrier") | ||
private String carrier = null; | ||
@SerializedName("cellularNetworkType") | ||
private String cellularNetworkType; | ||
@SerializedName("wifi") | ||
private Boolean wifi = null; | ||
|
||
MapDragendEvent(MapState mapState) { | ||
this.event = MAP_DRAGEND; | ||
this.latitude = mapState.getLatitude(); | ||
this.longitude = mapState.getLongitude(); | ||
this.zoom = mapState.getZoom(); | ||
this.created = TelemetryUtils.obtainCurrentDate(); | ||
this.batteryLevel = 0; | ||
this.pluggedIn = false; | ||
this.cellularNetworkType = ""; | ||
} | ||
|
||
MapDragendEvent setDeviceInfo(Context context) { | ||
this.batteryLevel = TelemetryUtils.obtainBatteryLevel(context); | ||
this.pluggedIn = TelemetryUtils.isPluggedIn(context); | ||
this.cellularNetworkType = TelemetryUtils.obtainCellularNetworkType(context); | ||
return this; | ||
} | ||
|
||
void setOrientation(String orientation) { | ||
this.orientation = orientation; | ||
} | ||
|
||
void setCarrier(String carrier) { | ||
this.carrier = carrier; | ||
} | ||
|
||
void setWifi(boolean wifi) { | ||
this.wifi = wifi; | ||
} | ||
|
||
private MapDragendEvent(Parcel in) { | ||
event = in.readString(); | ||
created = in.readString(); | ||
latitude = in.readDouble(); | ||
longitude = in.readDouble(); | ||
zoom = in.readDouble(); | ||
orientation = in.readString(); | ||
batteryLevel = in.readInt(); | ||
pluggedIn = in.readByte() != 0x00; | ||
carrier = in.readString(); | ||
cellularNetworkType = in.readString(); | ||
byte wifiVal = in.readByte(); | ||
wifi = wifiVal == 0x02 ? null : wifiVal != 0x00; | ||
} | ||
|
||
@Override | ||
public int describeContents() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void writeToParcel(Parcel dest, int flags) { | ||
dest.writeString(event); | ||
dest.writeString(created); | ||
dest.writeDouble(latitude); | ||
dest.writeDouble(longitude); | ||
dest.writeDouble(zoom); | ||
dest.writeString(orientation); | ||
dest.writeInt(batteryLevel); | ||
dest.writeByte((byte) (pluggedIn ? 0x01 : 0x00)); | ||
dest.writeString(carrier); | ||
dest.writeString(cellularNetworkType); | ||
if (wifi == null) { | ||
dest.writeByte((byte) (0x02)); | ||
} else { | ||
dest.writeByte((byte) (wifi ? 0x01 : 0x00)); | ||
} | ||
} | ||
|
||
public static final Creator<MapDragendEvent> CREATOR = new Creator<MapDragendEvent>() { | ||
@Override | ||
public MapDragendEvent createFromParcel(Parcel in) { | ||
return new MapDragendEvent(in); | ||
} | ||
|
||
@Override | ||
public MapDragendEvent[] newArray(int size) { | ||
return new MapDragendEvent[size]; | ||
} | ||
}; | ||
} |
Oops, something went wrong.