Merge commit 'refs/merge-requests/23' of git://gitorious.org/f-droid/fdroidclient into merge-requests/23
This commit is contained in:
commit
addf0bcb36
@ -153,15 +153,17 @@ public class AppDetails extends ListActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String[] FRIENDLY_SIZE_FORMAT = {
|
||||||
|
"%.0f B", "%.0f KiB", "%.1f MiB", "%.2f GiB" };
|
||||||
|
|
||||||
private static String getFriendlySize(int size) {
|
private static String getFriendlySize(int size) {
|
||||||
double s = size;
|
double s = size;
|
||||||
String[] format = { "%f B", "%.0f KiB", "%.1f MiB", "%.2f GiB" };
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < format.length - 1 && s >= 1024) {
|
while (i < FRIENDLY_SIZE_FORMAT.length - 1 && s >= 1024) {
|
||||||
s = (100 * s / 1024) / 100.0;
|
s = (100 * s / 1024) / 100.0;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return String.format(format[i], s);
|
return String.format(FRIENDLY_SIZE_FORMAT[i], s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int INSTALL = Menu.FIRST;
|
private static final int INSTALL = Menu.FIRST;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user