Example #1
0
 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";
 }
Example #2
0
 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;
 }
Example #3
0
 public String getDistanceUnitString() {
   String units = _preferences.distance_units().get();
   if (units.equalsIgnoreCase("m")) return "Miles";
   return "km";
 }
Example #4
0
 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";
 }
Example #5
0
 public double distance(double kms) {
   String units = _preferences.distance_units().get();
   if (units.equalsIgnoreCase("m")) return kilometersToMiles(kms);
   return kms;
 }
Example #6
0
 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;
 }