+
+
+ public void removeFile(OCFile file, boolean removeLocalCopy) {
+ Uri file_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_FILE, ""+file.getFileId());
+ if (getContentProviderClient() != null) {
+ try {
+ getContentProviderClient().delete(file_uri,
+ ProviderTableMeta.FILE_ACCOUNT_OWNER+"=?",
+ new String[]{mAccount.name});
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ } else {
+ getContentResolver().delete(file_uri,
+ ProviderTableMeta.FILE_ACCOUNT_OWNER+"=?",
+ new String[]{mAccount.name});
+ }
+ if (file.isDown() && removeLocalCopy) {
+ new File(file.getStoragePath()).delete();
+ }
+ if (file.isFolder() && removeLocalCopy) {
+ File f = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file));
+ if (f.exists() && f.isDirectory() && (f.list() == null || f.list().length == 0)) {
+ f.delete();
+ }
+ }
+
+ if (file.getFileLength() > 0) {
+ updateSizesToTheRoot(file.getParentId());
+ }