diff --git a/app/src/main/java/com/example/sebastianesau/camera/ImagePicker/PickImage.java b/app/src/main/java/com/example/sebastianesau/camera/ImagePicker/PickImage.java index 063ae0d..1e0f986 100644 --- a/app/src/main/java/com/example/sebastianesau/camera/ImagePicker/PickImage.java +++ b/app/src/main/java/com/example/sebastianesau/camera/ImagePicker/PickImage.java @@ -15,8 +15,6 @@ import android.util.Log; import android.widget.Toast; -import com.example.sebastianesau.camera.Storrage; - import java.io.File; import java.io.IOException; import java.util.ArrayList; diff --git a/app/src/main/java/com/example/sebastianesau/camera/Storrage.java b/app/src/main/java/com/example/sebastianesau/camera/ImagePicker/Storrage.java similarity index 63% rename from app/src/main/java/com/example/sebastianesau/camera/Storrage.java rename to app/src/main/java/com/example/sebastianesau/camera/ImagePicker/Storrage.java index dfb1df4..00710f9 100644 --- a/app/src/main/java/com/example/sebastianesau/camera/Storrage.java +++ b/app/src/main/java/com/example/sebastianesau/camera/ImagePicker/Storrage.java @@ -1,4 +1,4 @@ -package com.example.sebastianesau.camera; +package com.example.sebastianesau.camera.ImagePicker; import android.os.Environment; import android.os.StatFs; @@ -7,8 +7,6 @@ public class Storrage { - //TODO testen mit File.getUsableSpace() - public static boolean isExternalStorrageReady() { return isExternalStorageAvailable() && !isExternalStorageReadOnly(); } @@ -31,50 +29,35 @@ private static boolean isExternalStorageAvailable() { public static long getFreeInternalStorrageSize() { File path = Environment.getDataDirectory(); - StatFs stat = new StatFs(path.getPath()); - long free_memory = stat.getAvailableBlocksLong() * stat.getBlockSizeLong(); //return value is in bytes - - return free_memory; + return path.getUsableSpace(); } public static long getUsedInternalStorrageSize() { File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); long free_memory = (stat.getBlockCountLong() - stat.getAvailableBlocksLong()) * stat.getBlockSizeLong(); //return value is in bytes - return free_memory; } public static long getInternalStorrageSize() { File path = Environment.getDataDirectory(); - StatFs stat = new StatFs(path.getPath()); - long free_memory = stat.getBlockCountLong() * stat.getBlockSizeLong(); //return value is in bytes - - return free_memory; + return path.getTotalSpace(); } - public static long getFreeExternalStorrageSize(){ - + public static long getFreeExternalStorrageSize() { File path = Environment.getExternalStorageDirectory(); - StatFs stat = new StatFs(path.getPath()); - long free_memory = stat.getAvailableBlocksLong() * stat.getBlockSizeLong(); //return value is in bytes - - return free_memory; + return path.getUsableSpace(); } - public static long getUsedExternalStorrageSize(){ + public static long getUsedExternalStorrageSize() { File path = Environment.getExternalStorageDirectory(); StatFs stat = new StatFs(path.getPath()); long free_memory = (stat.getBlockCountLong() - stat.getAvailableBlocksLong()) * stat.getBlockSizeLong(); //return value is in bytes - return free_memory; } - public static long getExternalStorrageSize(){ + public static long getExternalStorrageSize() { File path = Environment.getExternalStorageDirectory(); - StatFs stat = new StatFs(path.getPath()); - long free_memory = stat.getBlockCountLong() * stat.getBlockSizeLong(); //return value is in bytes - - return free_memory; + return path.getTotalSpace(); } }