Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Commit

Permalink
Storrage Methoden geändert
Browse files Browse the repository at this point in the history
  • Loading branch information
tk2232 committed Sep 7, 2018
1 parent 243bbc1 commit a4fa63b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.sebastianesau.camera;
package com.example.sebastianesau.camera.ImagePicker;

import android.os.Environment;
import android.os.StatFs;
Expand All @@ -7,8 +7,6 @@

public class Storrage {

//TODO testen mit File.getUsableSpace()

public static boolean isExternalStorrageReady() {
return isExternalStorageAvailable() && !isExternalStorageReadOnly();
}
Expand All @@ -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();
}
}

0 comments on commit a4fa63b

Please sign in to comment.