projects
/
pub
/
Android
/
ownCloud.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
35602ae
)
Refactored local deletion to unify through FileDataStorageManager
author
David A. Velasco
<dvelasco@solidgear.es>
Wed, 27 Nov 2013 08:44:54 +0000
(09:44 +0100)
committer
David A. Velasco
<dvelasco@solidgear.es>
Wed, 27 Nov 2013 08:44:54 +0000
(09:44 +0100)
src/com/owncloud/android/datamodel/FileDataStorageManager.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/ui/fragment/FileDetailFragment.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/ui/preview/PreviewImageFragment.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/ui/preview/PreviewMediaFragment.java
patch
|
blob
|
blame
|
history
diff --git
a/src/com/owncloud/android/datamodel/FileDataStorageManager.java
b/src/com/owncloud/android/datamodel/FileDataStorageManager.java
index
fb55e93
..
042709a
100644
(file)
--- a/
src/com/owncloud/android/datamodel/FileDataStorageManager.java
+++ b/
src/com/owncloud/android/datamodel/FileDataStorageManager.java
@@
-434,7
+434,7
@@
public class FileDataStorageManager {
}
updateFolderSize(file.getParentId());
}
}
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
boolean success = new File(file.getStoragePath()).delete();
if (!removeDBData && success) {
// maybe unnecessary, but should be checked TODO remove if unnecessary
diff --git
a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java
b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java
index
ea0f814
..
e024bc6
100644
(file)
--- a/
src/com/owncloud/android/ui/fragment/FileDetailFragment.java
+++ b/
src/com/owncloud/android/ui/fragment/FileDetailFragment.java
@@
-473,12
+473,10
@@
public class FileDetailFragment extends FileFragment implements
@Override
public void onNeutral(String callerTag) {
@Override
public void onNeutral(String callerTag) {
- File f = null;
OCFile file = getFile();
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);
file.setStoragePath(null);
- mStorageManager.saveFile(file);
updateFileDetails(file, mAccount);
}
}
updateFileDetails(file, mAccount);
}
}
diff --git
a/src/com/owncloud/android/ui/preview/PreviewImageFragment.java
b/src/com/owncloud/android/ui/preview/PreviewImageFragment.java
index
ebc17c6
..
0ae6868
100644
(file)
--- a/
src/com/owncloud/android/ui/preview/PreviewImageFragment.java
+++ b/
src/com/owncloud/android/ui/preview/PreviewImageFragment.java
@@
-16,7
+16,6
@@
*/
package com.owncloud.android.ui.preview;
*/
package com.owncloud.android.ui.preview;
-import java.io.File;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
@@
-388,15
+387,9
@@
public class PreviewImageFragment extends FileFragment implements OnRemoteOper
*/
@Override
public void onNeutral(String callerTag) {
*/
@Override
public void onNeutral(String callerTag) {
- // TODO this code should be made in a secondary thread,
OCFile file = getFile();
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();
}
/**
}
/**
diff --git
a/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java
b/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java
index
0cce76a
..
b21f333
100644
(file)
--- a/
src/com/owncloud/android/ui/preview/PreviewMediaFragment.java
+++ b/
src/com/owncloud/android/ui/preview/PreviewMediaFragment.java
@@
-16,7
+16,6
@@
*/
package com.owncloud.android.ui.preview;
*/
package com.owncloud.android.ui.preview;
-import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
@@
-672,16
+671,10
@@
public class PreviewMediaFragment extends FileFragment implements
*/
@Override
public void onNeutral(String callerTag) {
*/
@Override
public void onNeutral(String callerTag) {
- // TODO this code should be made in a secondary thread,
OCFile file = getFile();
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();
}
/**
}
/**