mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 06:28:00 +01:00
rescan invalid files at mediaactivity too
This commit is contained in:
parent
b676bc7ca4
commit
399f9ee066
1 changed files with 7 additions and 0 deletions
|
@ -126,6 +126,7 @@ public class MediaActivity extends AppCompatActivity
|
||||||
|
|
||||||
private List<Media> getMedia() {
|
private List<Media> getMedia() {
|
||||||
final List<Media> myMedia = new ArrayList<>();
|
final List<Media> myMedia = new ArrayList<>();
|
||||||
|
final List<String> invalidFiles = new ArrayList<>();
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
|
@ -146,12 +147,18 @@ public class MediaActivity extends AppCompatActivity
|
||||||
final File file = new File(curPath);
|
final File file = new File(curPath);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
myMedia.add(new Media(cursor.getString(pathIndex), (i == 1)));
|
myMedia.add(new Media(cursor.getString(pathIndex), (i == 1)));
|
||||||
|
} else {
|
||||||
|
invalidFiles.add(file.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (cursor.moveToNext());
|
} while (cursor.moveToNext());
|
||||||
cursor.close();
|
cursor.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String[] invalids = invalidFiles.toArray(new String[invalidFiles.size()]);
|
||||||
|
MediaScannerConnection.scanFile(getApplicationContext(), invalids, null, null);
|
||||||
|
|
||||||
return myMedia;
|
return myMedia;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue