mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
ファイル作成/削除を追加 WIP
This commit is contained in:
parent
eb6a13baba
commit
67350639c7
|
@ -2,6 +2,7 @@ package one.nem.lacerta.source.file;
|
|||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -16,6 +17,9 @@ public interface FileManager {
|
|||
void createDir(String dirName);
|
||||
void removeDir(String dirName);
|
||||
|
||||
File createFile(String fileName);
|
||||
void removeFile(String fileName);
|
||||
|
||||
void saveBitmapAtCurrent(Bitmap bitmap, String fileName);
|
||||
Bitmap loadBitmap(Path path);
|
||||
void removeBitmap(Path path);
|
||||
|
|
|
@ -14,6 +14,8 @@ import dagger.assisted.Assisted;
|
|||
import dagger.assisted.AssistedInject;
|
||||
import one.nem.lacerta.source.file.FileManager;
|
||||
|
||||
import one.nem.lacerta.utils.LacertaLogger;
|
||||
|
||||
public class FileManagerImpl implements FileManager {
|
||||
|
||||
// RootDir
|
||||
|
@ -32,8 +34,12 @@ public class FileManagerImpl implements FileManager {
|
|||
}
|
||||
}
|
||||
|
||||
// Injection
|
||||
private LacertaLogger logger;
|
||||
|
||||
@AssistedInject
|
||||
public FileManagerImpl(@Assisted Path rootDir) {
|
||||
public FileManagerImpl(LacertaLogger logger, @Assisted Path rootDir) {
|
||||
this.logger = logger;
|
||||
this.rootDir = rootDir;
|
||||
this.currentDir = rootDir;
|
||||
}
|
||||
|
@ -73,6 +79,7 @@ public class FileManagerImpl implements FileManager {
|
|||
|
||||
@Override
|
||||
public void createDir(String dirName) {
|
||||
//ディレクトリ作成
|
||||
currentDir.resolve(dirName).toFile().mkdir(); // TODO-rca: エラーハンドリング
|
||||
}
|
||||
|
||||
|
@ -81,6 +88,17 @@ public class FileManagerImpl implements FileManager {
|
|||
currentDir.resolve(dirName).toFile().delete(); // TODO-rca: エラーハンドリング
|
||||
}
|
||||
|
||||
@Override
|
||||
public File createFile(String fileName) {
|
||||
return currentDir.resolve(fileName).toFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFile(String fileName) {
|
||||
currentDir.resolve(fileName).toFile().delete(); // TODO-rca: エラーハンドリング
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void saveBitmapAtCurrent(Bitmap bitmap, String fileName) { // TODO-rca: ファイル形式を変更できるようにする?
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue
Block a user