}
updateFolderSize(file.getParentId());
}
- if (removeLocalCopy && file.isDown()) {
+ if (removeLocalCopy && file.isDown() && file.getStoragePath() != null) {
boolean success = new File(file.getStoragePath()).delete();
if (!removeDBData && success) {
// maybe unnecessary, but should be checked TODO remove if unnecessary
@Override
public void onNeutral(String callerTag) {
- File f = null;
OCFile file = getFile();
- if (file.isDown() && (f = new File(file.getStoragePath())).exists()) {
- f.delete();
+ mStorageManager.removeFile(file, false, true); // TODO perform in background task / new thread
+ if (file.getStoragePath() != null) {
file.setStoragePath(null);
- mStorageManager.saveFile(file);
updateFileDetails(file, mAccount);
}
}
*/
package com.owncloud.android.ui.preview;
-import java.io.File;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
*/
@Override
public void onNeutral(String callerTag) {
- // TODO this code should be made in a secondary thread,
OCFile file = getFile();
- if (file.isDown()) { // checks it is still there
- File f = new File(file.getStoragePath());
- f.delete();
- file.setStoragePath(null);
- mStorageManager.saveFile(file);
- finish();
- }
+ mStorageManager.removeFile(file, false, true); // TODO perform in background task / new thread
+ finish();
}
/**
*/
package com.owncloud.android.ui.preview;
-import java.io.File;
import java.util.ArrayList;
import java.util.List;
*/
@Override
public void onNeutral(String callerTag) {
- // TODO this code should be made in a secondary thread,
OCFile file = getFile();
- if (file.isDown()) { // checks it is still there
- stopPreview(true);
- File f = new File(file.getStoragePath());
- f.delete();
- file.setStoragePath(null);
- mStorageManager.saveFile(file);
- finish();
- }
+ stopPreview(true);
+ mStorageManager.removeFile(file, false, true); // TODO perform in background task / new thread
+ finish();
}
/**