Fix a bug with SyncedFolderProvider

This commit is contained in:
Mario Danic 2017-02-05 00:07:10 +01:00 committed by AndyScherzinger
parent 1973705356
commit 4e90222439
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 12 additions and 4 deletions

View file

@ -165,7 +165,7 @@ public class SyncedFolderProvider extends Observable {
Cursor cursor = mContentResolver.query(
ProviderMeta.ProviderTableMeta.CONTENT_URI_SYNCED_FOLDERS,
null,
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_LOCAL_PATH + "==" + localPath,
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_LOCAL_PATH + "== \"" + localPath + "\"",
null,
null
);

View file

@ -323,9 +323,13 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
@Override
public void onSyncStatusToggleClick(int section, SyncedFolderDisplayItem syncedFolderDisplayItem) {
if (syncedFolderDisplayItem.getId() > UNPERSISTED_ID) {
mSyncedFolderProvider.updateFolderSyncEnabled(syncedFolderDisplayItem.getId(), syncedFolderDisplayItem.isEnabled());
mSyncedFolderProvider.updateFolderSyncEnabled(syncedFolderDisplayItem.getId(),
syncedFolderDisplayItem.isEnabled());
} else {
mSyncedFolderProvider.storeFolderSync(syncedFolderDisplayItem);
long storedId = mSyncedFolderProvider.storeFolderSync(syncedFolderDisplayItem);
if (storedId != -1) {
syncedFolderDisplayItem.setId(storedId);
}
}
}
@ -362,7 +366,11 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
if (syncedFolder.getId() == UNPERSISTED_ID) {
// newly set up folder sync config
mSyncedFolderProvider.storeFolderSync(item);
long storedId = mSyncedFolderProvider.storeFolderSync(item);
if (storedId != -1) {
item.setId(storedId);
}
} else {
// existing synced folder setup to be updated
mSyncedFolderProvider.updateSyncFolder(item);