Added dependency injections for FileUtils and removed redundant code

This commit is contained in:
Ernir Erlingsson
2015-12-10 10:49:28 +01:00
parent fb2a44c478
commit a5fd7ff9dc
12 changed files with 41 additions and 70 deletions

View File

@@ -1,25 +0,0 @@
package org.briarproject.system;
import org.briarproject.api.system.FileUtils;
import java.io.File;
import java.io.IOException;
public class AndroidFileUtils implements FileUtils {
public long getTotalSpace(File f) throws IOException {
return f.getTotalSpace();
}
public long getFreeSpace(File f) throws IOException {
return f.getUsableSpace();
}
public static void deleteFileOrDir(File f) {
if (f.isFile())
f.delete();
else if (f.isDirectory())
for (File child : f.listFiles())
deleteFileOrDir(child);
}
}

View File

@@ -14,7 +14,7 @@ public class AndroidSystemModule extends AbstractModule {
bind(Clock.class).to(SystemClock.class);
bind(Timer.class).to(SystemTimer.class);
bind(SeedProvider.class).to(AndroidSeedProvider.class);
bind(FileUtils.class).to(AndroidFileUtils.class);
bind(FileUtils.class).to(FileUtilsImpl.class);
bind(LocationUtils.class).to(AndroidLocationUtils.class);
}
}