mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 08:38:33 +00:00
Localize 'camera' folder title.
This commit is contained in:
parent
07952f2146
commit
dfc4178252
@ -41,7 +41,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class MediaRepository {
|
||||
|
||||
private static final String TAG = Log.tag(MediaRepository.class);
|
||||
private static final String TAG = Log.tag(MediaRepository.class);
|
||||
private static final String CAMERA = "Camera";
|
||||
|
||||
/**
|
||||
* Retrieves a list of folders that contain media.
|
||||
@ -169,12 +170,12 @@ public class MediaRepository {
|
||||
String bucketId = cursor.getString(cursor.getColumnIndexOrThrow(projection[1]));
|
||||
String title = cursor.getString(cursor.getColumnIndexOrThrow(projection[2]));
|
||||
long timestamp = cursor.getLong(cursor.getColumnIndexOrThrow(projection[3]));
|
||||
FolderData folder = Util.getOrDefault(folders, bucketId, new FolderData(thumbnail, title, bucketId));
|
||||
FolderData folder = Util.getOrDefault(folders, bucketId, new FolderData(thumbnail, localizeTitle(context, title), bucketId));
|
||||
|
||||
folder.incrementCount();
|
||||
folders.put(bucketId, folder);
|
||||
|
||||
if (cameraBucketId == null && "Camera".equals(title)) {
|
||||
if (cameraBucketId == null && CAMERA.equals(title)) {
|
||||
cameraBucketId = bucketId;
|
||||
}
|
||||
|
||||
@ -188,6 +189,14 @@ public class MediaRepository {
|
||||
return new FolderResult(cameraBucketId, globalThumbnail, thumbnailTimestamp, folders);
|
||||
}
|
||||
|
||||
private @NonNull String localizeTitle(@NonNull Context context, @NonNull String title) {
|
||||
if (CAMERA.equals(title)) {
|
||||
return context.getString(R.string.MediaRepository__camera);
|
||||
} else {
|
||||
return title;
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private @NonNull List<Media> getMediaInBucket(@NonNull Context context, @NonNull String bucketId) {
|
||||
List<Media> images = getMediaInBucket(context, bucketId, Images.Media.EXTERNAL_CONTENT_URI, true);
|
||||
|
@ -930,6 +930,7 @@
|
||||
|
||||
<!-- MediaRepository -->
|
||||
<string name="MediaRepository_all_media">All media</string>
|
||||
<string name="MediaRepository__camera">Camera</string>
|
||||
|
||||
<!-- MessageRecord -->
|
||||
<string name="MessageRecord_unknown">Unknown</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user