mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 05:35:39 +03:00
- trigger mediaScan when files are deleted remote
This commit is contained in:
parent
cb9927fb00
commit
95967c2151
1 changed files with 18 additions and 0 deletions
|
@ -346,7 +346,13 @@ public class FileDataStorageManager {
|
||||||
).withSelection(where, whereArgs).build());
|
).withSelection(where, whereArgs).build());
|
||||||
|
|
||||||
if (file.isDown()) {
|
if (file.isDown()) {
|
||||||
|
String path = file.getStoragePath();
|
||||||
new File(file.getStoragePath()).delete();
|
new File(file.getStoragePath()).delete();
|
||||||
|
|
||||||
|
// Notify MediaScanner about removed file
|
||||||
|
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
||||||
|
intent.setData(Uri.fromFile(new File(path)));
|
||||||
|
MainApp.getAppContext().sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -542,11 +548,17 @@ public class FileDataStorageManager {
|
||||||
success &= removeLocalFolder(file);
|
success &= removeLocalFolder(file);
|
||||||
} else {
|
} else {
|
||||||
if (file.isDown()) {
|
if (file.isDown()) {
|
||||||
|
String path = file.getStoragePath();
|
||||||
File localFile = new File(file.getStoragePath());
|
File localFile = new File(file.getStoragePath());
|
||||||
success &= localFile.delete();
|
success &= localFile.delete();
|
||||||
if (success) {
|
if (success) {
|
||||||
file.setStoragePath(null);
|
file.setStoragePath(null);
|
||||||
saveFile(file);
|
saveFile(file);
|
||||||
|
|
||||||
|
// Notify MediaScanner about removed file
|
||||||
|
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
||||||
|
intent.setData(Uri.fromFile(new File(path)));
|
||||||
|
MainApp.getAppContext().sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -568,7 +580,13 @@ public class FileDataStorageManager {
|
||||||
if (localFile.isDirectory()) {
|
if (localFile.isDirectory()) {
|
||||||
success &= removeLocalFolder(localFile);
|
success &= removeLocalFolder(localFile);
|
||||||
} else {
|
} else {
|
||||||
|
String path = localFile.getAbsolutePath();
|
||||||
success &= localFile.delete();
|
success &= localFile.delete();
|
||||||
|
|
||||||
|
// Notify MediaScanner about removed file
|
||||||
|
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
||||||
|
intent.setData(Uri.fromFile(new File(path)));
|
||||||
|
MainApp.getAppContext().sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue