Skip to content
Snippets Groups Projects
Commit e73dc148 authored by akwizgran's avatar akwizgran
Browse files

Avoid using a deprecated API if possible.

parent a56516f8
No related branches found
No related tags found
No related merge requests found
......@@ -4,12 +4,15 @@ import java.io.File;
import java.io.IOException;
import net.sf.briar.api.os.FileUtils;
import android.os.Build;
import android.os.StatFs;
class AndroidFileUtils implements FileUtils {
public long getFreeSpace(File f) throws IOException {
StatFs s = new StatFs(f.getAbsolutePath());
if(Build.VERSION.SDK_INT >= 18)
return s.getAvailableBlocksLong() * s.getBlockSizeLong();
return (long) s.getAvailableBlocks() * s.getBlockSize();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment