Skip to content

Commit

Permalink
#169: ExifInterface via IFile/FileFacade
Browse files Browse the repository at this point in the history
  • Loading branch information
k3b committed Apr 19, 2020
1 parent bb08d55 commit 0ff6b0c
Show file tree
Hide file tree
Showing 5 changed files with 274 additions and 301 deletions.
14 changes: 11 additions & 3 deletions fotolib2/src/main/java/de/k3b/io/FileFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
add support for Android DocumentFile
*/
public class FileFacade implements IFile {
private final java.io.File file;
private java.io.File file;

public FileFacade(java.io.File file) {
this.file = file;
Expand Down Expand Up @@ -64,16 +64,24 @@ public static FileFacade[] get(java.io.File[] files) {
@Deprecated
@Override
public boolean renameTo(IFile newName) {
return file.renameTo(((FileFacade) newName).file);
return renameImpl(((FileFacade) newName).file);
}

@Override
public boolean renameTo(String newName) {
File newFile = new File(this.file.getParentFile(), newName);
final boolean result = this.file.renameTo(newFile);
final boolean result = renameImpl(newFile);
return result;
}

private boolean renameImpl(File newFile) {
final boolean success = this.file.renameTo(newFile);
if (success) {
this.file = newFile;
}
return success;
}

@Override
public boolean delete() {
return file.delete();
Expand Down
Loading

0 comments on commit 0ff6b0c

Please sign in to comment.