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(); 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() { private View.OnClickListener undoDeletion = new View.OnClickListener() {

View file

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