diff --git a/src/main/java/com/owncloud/android/datamodel/MediaFolder.java b/src/main/java/com/owncloud/android/datamodel/MediaFolder.java index 71e3fcc129..3bd4229b8a 100644 --- a/src/main/java/com/owncloud/android/datamodel/MediaFolder.java +++ b/src/main/java/com/owncloud/android/datamodel/MediaFolder.java @@ -30,7 +30,6 @@ public class MediaFolder { public static final Integer CUSTOM = 0; public static final Integer IMAGE = 1; public static final Integer VIDEO = 2; - public static final Integer LEGACY = 3; /** name of the folder. */ public String folderName; diff --git a/src/main/java/com/owncloud/android/providers/FileContentProvider.java b/src/main/java/com/owncloud/android/providers/FileContentProvider.java index 7860dc4e75..e2653815b4 100644 --- a/src/main/java/com/owncloud/android/providers/FileContentProvider.java +++ b/src/main/java/com/owncloud/android/providers/FileContentProvider.java @@ -988,11 +988,16 @@ public class FileContentProvider extends ContentProvider { Log_OC.i(SQL, "Entering in the #20 ADD in onUpgrade"); db.beginTransaction(); try { - // add type column default being LEGACY (3) + // add type column default being CUSTOM (0) db.execSQL(ALTER_TABLE + ProviderTableMeta.SYNCED_FOLDERS_TABLE_NAME + ADD_COLUMN + ProviderTableMeta.SYNCED_FOLDER_TYPE + - " INTEGER " + " DEFAULT 3"); + " INTEGER " + " DEFAULT 0"); + // create arbitrary data table + createArbitraryData(db); + + // magic to split out existing synced folders in two when needed + // otherwise, we migrate them to their proper type (image or video) ContentResolver contentResolver = getContext().getContentResolver(); SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(contentResolver); @@ -1001,7 +1006,8 @@ public class FileContentProvider extends ContentProvider { final List videoMediaFolders = MediaProvider.getVideoFolders(contentResolver, 0); ArrayList idsToDelete = new ArrayList<>(); - for (SyncedFolder syncedFolder : syncedFolderProvider.getSyncedFolders()) { + List syncedFolders = syncedFolderProvider.getSyncedFolders(); + for (SyncedFolder syncedFolder : syncedFolders) { idsToDelete.add(syncedFolder.getId()); for (int i = 0; i < imageMediaFolders.size(); i++) { if (imageMediaFolders.get(i).absolutePath.equals(syncedFolder.getLocalPath())) {