scan only the affected items on Delete

This commit is contained in:
tibbi 2016-03-05 21:57:10 +01:00
parent 5e845c694c
commit 09e4f00f27
2 changed files with 6 additions and 3 deletions

View File

@ -183,7 +183,8 @@ public class PhotosActivity extends AppCompatActivity
file.delete();
}
MediaScannerConnection.scanFile(this, new String[]{path}, null, null);
final String[] deletedPaths = toBeDeleted.toArray(new String[toBeDeleted.size()]);
MediaScannerConnection.scanFile(this, deletedPaths, null, null);
}
private View.OnClickListener undoDeletion = new View.OnClickListener() {

View File

@ -102,8 +102,10 @@ public class ViewPagerActivity extends AppCompatActivity
private void deleteImage() {
Helpers.showToast(this, R.string.deleting);
final File file = getCurrentFile();
file.delete();
MediaScannerConnection.scanFile(this, new String[]{path}, null, this);
if (file.delete()) {
final String[] deletedPath = new String[]{file.getAbsolutePath()};
MediaScannerConnection.scanFile(this, deletedPath, null, this);
}
}
private boolean isDirEmpty() {