X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/c9626772a19c0f5631ae5b58c09dda39d0baa878..40b5fb815613c4cf9023c9c9ad93cda0d2521f86:/src/com/owncloud/android/providers/FileContentProvider.java diff --git a/src/com/owncloud/android/providers/FileContentProvider.java b/src/com/owncloud/android/providers/FileContentProvider.java index 1a5810bd..fc038070 100644 --- a/src/com/owncloud/android/providers/FileContentProvider.java +++ b/src/com/owncloud/android/providers/FileContentProvider.java @@ -171,7 +171,7 @@ public class FileContentProvider extends ContentProvider { if (mUriMatcher.match(uri) == SINGLE_FILE || mUriMatcher.match(uri) == DIRECTORY) { String fileId = uri.toString().substring(uri.toString().lastIndexOf(FileUtils.PATH_SEPARATOR) + 1); Uri selectFileUri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_FILE, fileId); - String[] fileProjection = new String[] { ProviderTableMeta.FILE_PARENT}; + String[] fileProjection = new String[] { ProviderTableMeta.FILE_PARENT }; Cursor fileCursor = query(selectFileUri, fileProjection, null, null, null); if (fileCursor != null && fileCursor.moveToFirst()) { @@ -294,6 +294,8 @@ public class FileContentProvider extends ContentProvider { Uri newUri = null; SQLiteDatabase db = mDbHelper.getWritableDatabase(); db.beginTransaction(); + + // Insert action try { newUri = insert(db, uri, values); db.setTransactionSuccessful(); @@ -301,6 +303,12 @@ public class FileContentProvider extends ContentProvider { db.endTransaction(); } getContext().getContentResolver().notifyChange(newUri, null); + + // Get parentId to notify the change + long parentId = getParentId(newUri); + // Notify the change to the parent folder + notifyChangeToParentUri(parentId); + return newUri; } @@ -475,6 +483,12 @@ public class FileContentProvider extends ContentProvider { db.endTransaction(); } getContext().getContentResolver().notifyChange(uri, null); + + // Get parentId to notify the change + long parentId = getParentId(uri); + // Notify the change to the parent folder + notifyChangeToParentUri(parentId); + return count; }