mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-15 07:28:30 +00:00
Limit gallery to most recent 5k items for now.
This commit is contained in:
@@ -56,6 +56,8 @@ public class MediaRepository {
|
||||
private static final String TAG = Log.tag(MediaRepository.class);
|
||||
private static final String CAMERA = "Camera";
|
||||
|
||||
private static final int MAX_MEDIA_ITEMS = 5_000;
|
||||
|
||||
/**
|
||||
* Retrieves a list of folders that contain media.
|
||||
*/
|
||||
@@ -270,7 +272,7 @@ public class MediaRepository {
|
||||
}
|
||||
|
||||
try (Cursor cursor = context.getContentResolver().query(contentUri, projection, selection, selectionArgs, sortBy)) {
|
||||
while (cursor != null && cursor.moveToNext()) {
|
||||
while (cursor != null && cursor.moveToNext() && media.size() < MAX_MEDIA_ITEMS) {
|
||||
long rowId = cursor.getLong(cursor.getColumnIndexOrThrow(projection[0]));
|
||||
Uri uri = ContentUris.withAppendedId(contentUri, rowId);
|
||||
String mimetype = cursor.getString(cursor.getColumnIndexOrThrow(Images.Media.MIME_TYPE));
|
||||
|
||||
Reference in New Issue
Block a user