fix GPX track size display

This commit is contained in:
sonora 2017-04-25 22:43:03 +02:00
parent 420255b947
commit 81fae15d00
2 changed files with 5 additions and 3 deletions

View file

@ -104,6 +104,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
public static final String UPDATES_TAB = "updates";
public static final MessageFormat formatGb = new MessageFormat("{0, number,#.##} GB", Locale.US);
public static final MessageFormat formatMb = new MessageFormat("{0, number,##.#} MB", Locale.US);
public static final MessageFormat formatKb = new MessageFormat("{0, number,##.#} kB", Locale.US);
private static boolean SUGGESTED_TO_DOWNLOAD_BASEMAP = false;
private BannerAndDownloadFreeVersion visibleBanner;

View file

@ -108,6 +108,7 @@ import static net.osmand.plus.OsmAndFormatter.YARDS_IN_ONE_METER;
import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_COLOR_ATTR;
import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_WIDTH_ATTR;
import static net.osmand.plus.download.DownloadActivity.formatMb;
import static net.osmand.plus.download.DownloadActivity.formatKb;
public class GpxUiHelper {
@ -727,10 +728,10 @@ public class GpxUiHelper {
String date = "";
String size = "";
if (info.getFileSize() >= 0) {
if (info.getFileSize() > 100) {
size = formatMb.format(new Object[]{(float) info.getFileSize() / (1 << 10)});
if (info.getFileSize() > (100 * (1 << 10))) {
size = formatMb.format(new Object[]{(float) info.getFileSize() / (1 << 20)});
} else {
size = info.getFileSize() + " kB";
size = formatKb.format(new Object[]{(float) info.getFileSize() / (1 << 10)});
}
}
DateFormat df = app.getResourceManager().getDateFormat();