public class DistanceCalculator
extends java.lang.Object
Constructor and Description |
---|
DistanceCalculator()
Default constructor: properties are initialized with null or respectively 0.
|
Modifier and Type | Method and Description |
---|---|
float |
getAchievedDistance(android.location.Location newLocation) |
float |
getDistance() |
android.location.Location |
getEndLocation() |
android.location.Location |
getStartLocation() |
void |
init(android.location.Location firstLocation)
First initialize of the object.
|
void |
reset()
Reset the properties with null or respectively 0.
|
void |
restore(android.content.Context context,
int type)
Try to restore the distance property from the shared preference if are available
|
java.lang.String |
toString()
String representation for the distance calculator
|
void |
update(android.location.Location newLocation)
Update the properties on receiving a new location
|
public DistanceCalculator()
public android.location.Location getStartLocation()
public android.location.Location getEndLocation()
public float getDistance()
public void init(android.location.Location firstLocation)
firstLocation
- - The first received locationpublic void update(android.location.Location newLocation)
newLocation
- - The new location receivedpublic float getAchievedDistance(android.location.Location newLocation)
public void reset()
public void restore(android.content.Context context, int type)
context
- - The context of the applicationtype
- - The type of the request: 0 for fetching the total distance - 1 for the custom one.public java.lang.String toString()
toString
in class java.lang.Object