fix: folders in recent files

This commit is contained in:
tehcneko 2023-01-07 10:58:13 +08:00 committed by xtaodada
parent d784214c4b
commit 5773a43da5
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -968,13 +968,18 @@ public class ChatAttachAlertDocumentLayout extends ChatAttachAlert.AttachAlertLa
ListItem item = new ListItem(); ListItem item = new ListItem();
item.title = file.getName(); item.title = file.getName();
item.file = file; item.file = file;
String fname = file.getName(); if (file.isDirectory()) {
String[] sp = fname.split("\\."); item.icon = R.drawable.files_folder;
item.ext = sp.length > 1 ? sp[sp.length - 1] : "?"; item.subtitle = LocaleController.getString("Folder", R.string.Folder);
item.subtitle = AndroidUtilities.formatFileSize(file.length()); } else {
fname = fname.toLowerCase(); String fname = file.getName();
if (fname.endsWith(".jpg") || fname.endsWith(".png") || fname.endsWith(".gif") || fname.endsWith(".jpeg")) { String[] sp = fname.split("\\.");
item.thumb = file.getAbsolutePath(); item.ext = sp.length > 1 ? sp[sp.length - 1] : "?";
item.subtitle = AndroidUtilities.formatFileSize(file.length());
fname = fname.toLowerCase();
if (fname.endsWith(".jpg") || fname.endsWith(".png") || fname.endsWith(".gif") || fname.endsWith(".jpeg")) {
item.thumb = file.getAbsolutePath();
}
} }
listAdapter.recentItems.add(item); listAdapter.recentItems.add(item);
} }