Simplify FolderIconProvider

This commit is contained in:
cketti 2024-05-08 16:46:02 +02:00
parent e7c3bc0ddc
commit ff67cd45c5

View file

@ -4,23 +4,14 @@ import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons
import com.fsck.k9.mailstore.FolderType
class FolderIconProvider {
private val iconFolderInboxResId: Int = Icons.Outlined.Inbox
private val iconFolderOutboxResId: Int = Icons.Outlined.Outbox
private val iconFolderSentResId: Int = Icons.Outlined.Send
private val iconFolderTrashResId: Int = Icons.Outlined.Delete
private val iconFolderDraftsResId: Int = Icons.Outlined.Draft
private val iconFolderArchiveResId: Int = Icons.Outlined.Archive
private val iconFolderSpamResId: Int = Icons.Outlined.Report
var iconFolderResId: Int = Icons.Outlined.Folder
fun getFolderIcon(type: FolderType): Int = when (type) {
FolderType.INBOX -> iconFolderInboxResId
FolderType.OUTBOX -> iconFolderOutboxResId
FolderType.SENT -> iconFolderSentResId
FolderType.TRASH -> iconFolderTrashResId
FolderType.DRAFTS -> iconFolderDraftsResId
FolderType.ARCHIVE -> iconFolderArchiveResId
FolderType.SPAM -> iconFolderSpamResId
else -> iconFolderResId
FolderType.INBOX -> Icons.Outlined.Inbox
FolderType.OUTBOX -> Icons.Outlined.Outbox
FolderType.SENT -> Icons.Outlined.Send
FolderType.TRASH -> Icons.Outlined.Delete
FolderType.DRAFTS -> Icons.Outlined.Draft
FolderType.ARCHIVE -> Icons.Outlined.Archive
FolderType.SPAM -> Icons.Outlined.Report
FolderType.REGULAR -> Icons.Outlined.Folder
}
}