public String getMileageUnitString() { String units = _preferences.mileage_units().get(); if (units.equalsIgnoreCase("kmpl")) return "km/L"; if (units.equalsIgnoreCase("mpg_us")) return "mpg (US)"; if (units.equalsIgnoreCase("mpg_imp")) return "mpg (Imp)"; return "L/100km"; }
public double mileage(double mileage) { String units = _preferences.mileage_units().get(); if (units.equalsIgnoreCase("kmpl")) return 100 / mileage; if (units.equalsIgnoreCase("mpg_us")) return mileageFromMetric(mileage, Gallons.US); if (units.equalsIgnoreCase("mpg_imp")) return mileageFromMetric(mileage, Gallons.Imperial); else return mileage; }
public String getDistanceUnitString() { String units = _preferences.distance_units().get(); if (units.equalsIgnoreCase("m")) return "Miles"; return "km"; }
public String getVolumeUnitString() { String units = _preferences.volume_units().get(); if (units.equalsIgnoreCase("gal_us")) return "Gal (US)"; if (units.equalsIgnoreCase("gal_imp")) return "Gal (Imp)"; return "L"; }
public double distance(double kms) { String units = _preferences.distance_units().get(); if (units.equalsIgnoreCase("m")) return kilometersToMiles(kms); return kms; }
public double volume(double litres) { String units = _preferences.volume_units().get(); if (units.equalsIgnoreCase("gal_us")) return litersToGallons(litres, Gallons.US); if (units.equalsIgnoreCase("gal_imp")) return litersToGallons(litres, Gallons.Imperial); return litres; }