Subversion Repositories SmartDukaan

Rev

Rev 34813 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34813 Rev 34835
Line 270... Line 270...
270
 
270
 
271
		return input; // If no match is found, return the original string
271
		return input; // If no match is found, return the original string
272
	}
272
	}
273
 
273
 
274
	public static String formatDistance(double distanceInMeters) {
274
	public static String formatDistance(double distanceInMeters) {
275
		if (distanceInMeters >= 1000) {
275
		if (distanceInMeters <= 950) {
276
			return String.format("%.2f km", distanceInMeters / 1000.0);
276
			int roundedMeters = ((int) Math.ceil(distanceInMeters / 100.0)) * 100;
277
		} else if (distanceInMeters >= 1) {
277
			double distanceKm = roundedMeters / 1000.0;
278
			return String.format("%.0f m", distanceInMeters);
278
			return String.format("%.2f", distanceKm);
279
		} else {
279
		} else {
280
			return String.format("%.0f cm", distanceInMeters * 100);
280
			return String.format("%.2f", distanceInMeters / 1000.0);
281
		}
281
		}
282
	}
282
	}
283
 
283
 
284
}
284
}