Small fixes

This commit is contained in:
Nazar-Kutz 2020-03-04 10:18:24 +02:00
parent 5447289720
commit 1f187e218a

View file

@ -679,14 +679,6 @@ public class AndroidUtils {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
}
public static float getFreeSpaceGb(File dir) {
if (dir.canRead()) {
StatFs fs = new StatFs(dir.getAbsolutePath());
return (float) (fs.getBlockSize()) * fs.getAvailableBlocks() / (1 << 30);
}
return -1;
}
public static ArrayList<View> getChildrenViews(ViewGroup vg) {
ArrayList<View> result = new ArrayList<>();
for (int i = 0; i < vg.getChildCount(); i++) {
@ -696,6 +688,14 @@ public class AndroidUtils {
return result;
}
public static float getFreeSpaceGb(File dir) {
if (dir.canRead()) {
StatFs fs = new StatFs(dir.getAbsolutePath());
return (float) (fs.getBlockSize()) * fs.getAvailableBlocks() / (1 << 30);
}
return -1;
}
public static float getTotalSpaceGb(File dir) {
if (dir.canRead()) {
return (float) (dir.getTotalSpace()) / (1 << 30);