public class SpeedFormatter
extends java.lang.Object
implements android.content.SharedPreferences.OnSharedPreferenceChangeListener
Modifier and Type | Field and Description |
---|---|
static int |
KMPH |
static int |
KTS |
static int |
MPH |
static int |
MPS |
static java.lang.String |
TAG |
Modifier and Type | Method and Description |
---|---|
static SpeedFormatter |
getInstance() |
java.lang.String |
getSpeedFormatted(double speed)
Given a speed in m/s, converts to String based on appropriate speed units as selected by
user in preferences.
|
java.lang.String |
getSpeedFormatted(double speed,
int speed_unit)
Given a speed in m/s, converts to String based on appropriate speed units as passed in.
|
java.lang.String |
getSpeedFormatted(MapItem item)
Given a map item, determine the speed in the preferred speed designated by the speed unit preference.
|
void |
onSharedPreferenceChanged(android.content.SharedPreferences sp,
java.lang.String key) |
public static final java.lang.String TAG
public static final int MPH
public static final int KMPH
public static final int KTS
public static final int MPS
public void onSharedPreferenceChanged(android.content.SharedPreferences sp, java.lang.String key)
onSharedPreferenceChanged
in interface android.content.SharedPreferences.OnSharedPreferenceChangeListener
public java.lang.String getSpeedFormatted(MapItem item)
public java.lang.String getSpeedFormatted(double speed)
speed
- in m/spublic java.lang.String getSpeedFormatted(double speed, int speed_unit)
speed
- in m/sspeed_unit
- 0=MPH, 1=KMPH, 2=KTS, 3=MPSpublic static SpeedFormatter getInstance()