diff --git a/app/common/src/main/java/com/fsck/k9/resources/K9CoreResourceProvider.kt b/app/common/src/main/java/com/fsck/k9/resources/K9CoreResourceProvider.kt index 33e7bb838..9d2f833fb 100644 --- a/app/common/src/main/java/com/fsck/k9/resources/K9CoreResourceProvider.kt +++ b/app/common/src/main/java/com/fsck/k9/resources/K9CoreResourceProvider.kt @@ -1,6 +1,7 @@ package com.fsck.k9.resources import android.content.Context +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons import com.fsck.k9.CoreResourceProvider import com.fsck.k9.notification.PushNotificationState import com.fsck.k9.ui.R @@ -36,7 +37,7 @@ class K9CoreResourceProvider(private val context: Context) : CoreResourceProvide override fun outboxFolderName(): String = context.getString(R.string.special_mailbox_name_outbox) - override val iconPushNotification: Int = R.drawable.ic_push_notification + override val iconPushNotification: Int = Icons.Outlined.PushNotification override fun pushNotificationText(notificationState: PushNotificationState): String { val resId = when (notificationState) { diff --git a/app/ui/legacy/build.gradle.kts b/app/ui/legacy/build.gradle.kts index 691e81b7c..293c4e3cc 100644 --- a/app/ui/legacy/build.gradle.kts +++ b/app/ui/legacy/build.gradle.kts @@ -5,6 +5,8 @@ plugins { dependencies { api(projects.app.ui.base) + api(projects.core.ui.legacy.designsystem) + implementation(projects.app.core) implementation(projects.mail.common) implementation(projects.uiUtils.toolbarBottomSheet) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java index 442b02661..19c0b8425 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java @@ -47,6 +47,7 @@ import androidx.annotation.StringRes; import androidx.appcompat.app.ActionBar; import androidx.core.content.IntentCompat; import androidx.core.os.BundleCompat; +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.fsck.k9.Account; @@ -1845,7 +1846,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, if (isLoadingComplete) { if (attachment.isSupportedImage()) { ImageView attachmentTypeView = view.findViewById(R.id.attachment_type); - attachmentTypeView.setImageResource(R.drawable.ic_attachment_image); + attachmentTypeView.setImageResource(Icons.Filled.AttachmentImage); ImageView preview = view.findViewById(R.id.attachment_preview); preview.setVisibility(View.VISIBLE); diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index f8458796d..a478f8f6d 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -24,6 +24,7 @@ import androidx.fragment.app.commitNow import app.k9mail.core.android.common.compat.BundleCompat import app.k9mail.core.android.common.contact.CachingRepository import app.k9mail.core.android.common.contact.ContactRepository +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons import app.k9mail.feature.launcher.FeatureLauncherActivity import com.fsck.k9.Account import com.fsck.k9.K9 @@ -1268,12 +1269,12 @@ open class MessageList : private fun lockDrawer() { drawer!!.lock() - actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back) + actionBar.setHomeAsUpIndicator(Icons.Outlined.ArrowBack) } private fun unlockDrawer() { drawer!!.unlock() - actionBar.setHomeAsUpIndicator(R.drawable.ic_menu) + actionBar.setHomeAsUpIndicator(Icons.Outlined.Menu) } private fun initializeFromLocalSearch(search: LocalSearch?) { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/contacts/ContactPictureLoader.kt b/app/ui/legacy/src/main/java/com/fsck/k9/contacts/ContactPictureLoader.kt index 250f58481..4857388c9 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/contacts/ContactPictureLoader.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/contacts/ContactPictureLoader.kt @@ -5,11 +5,11 @@ import android.graphics.Bitmap import android.net.Uri import android.widget.ImageView import androidx.annotation.WorkerThread +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons import com.bumptech.glide.Glide import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.request.FutureTarget import com.fsck.k9.mail.Address -import com.fsck.k9.ui.R import com.fsck.k9.view.RecipientSelectView.Recipient class ContactPictureLoader( @@ -41,8 +41,8 @@ class ContactPictureLoader( private fun setContactPicture(imageView: ImageView, contactPictureUri: Uri) { Glide.with(imageView.context) .load(contactPictureUri) - .placeholder(R.drawable.ic_contact_picture) - .error(R.drawable.ic_contact_picture) + .placeholder(Icons.Filled.ContactPicture) + .error(Icons.Filled.ContactPicture) .diskCacheStrategy(DiskCacheStrategy.NONE) .dontAnimate() .into(imageView) @@ -72,7 +72,7 @@ class ContactPictureLoader( return Glide.with(context) .asBitmap() .load(contactPictureUri) - .error(R.drawable.ic_contact_picture) + .error(Icons.Filled.ContactPicture) .diskCacheStrategy(DiskCacheStrategy.NONE) .dontAnimate() .submit(pictureSizeInPx, pictureSizeInPx) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt index 6bffaddb8..6ae803327 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt @@ -11,6 +11,7 @@ import android.widget.ImageView import androidx.core.view.GravityCompat import androidx.drawerlayout.widget.DrawerLayout import androidx.swiperefreshlayout.widget.SwipeRefreshLayout +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons import com.fsck.k9.Account import com.fsck.k9.K9 import com.fsck.k9.activity.MessageList @@ -287,7 +288,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K sliderView.addStickyFooterItem( PrimaryDrawerItem().apply { nameRes = R.string.preferences_action - iconRes = R.drawable.ic_cog + iconRes = Icons.Filled.Cog identifier = DRAWER_ID_PREFERENCES isSelectable = false }, @@ -360,7 +361,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K folderList.unifiedInbox?.let { unifiedInbox -> val unifiedInboxItem = PrimaryDrawerItem().apply { - iconRes = R.drawable.ic_inbox_multiple + iconRes = Icons.Filled.InboxMultiple identifier = DRAWER_ID_UNIFIED_INBOX nameRes = R.string.integrated_inbox_title selectedColorInt = selectedBackgroundColor diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/choosefolder/ChooseFolderActivity.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/choosefolder/ChooseFolderActivity.kt index b55ef97e0..a9681428e 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/choosefolder/ChooseFolderActivity.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/choosefolder/ChooseFolderActivity.kt @@ -8,6 +8,7 @@ import android.view.Menu import android.view.MenuItem import androidx.appcompat.widget.SearchView import androidx.recyclerview.widget.RecyclerView +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons import com.fsck.k9.Account import com.fsck.k9.Account.FolderMode import com.fsck.k9.Preferences @@ -96,7 +97,7 @@ class ChooseFolderActivity : K9Activity() { private fun initializeActionBar() { val actionBar = supportActionBar ?: error("Action bar missing") actionBar.setDisplayHomeAsUpEnabled(true) - actionBar.setHomeAsUpIndicator(R.drawable.ic_close) + actionBar.setHomeAsUpIndicator(Icons.Outlined.Close) } private fun initializeFolderList() { @@ -161,17 +162,19 @@ class ChooseFolderActivity : K9Activity() { val folderMenuItem = menu.findItem(R.id.filter_folders) val folderSearchView = folderMenuItem.actionView as SearchView folderSearchView.queryHint = getString(R.string.folder_list_filter_hint) - folderSearchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { - override fun onQueryTextSubmit(query: String): Boolean { - itemAdapter.filter(query) - return true - } + folderSearchView.setOnQueryTextListener( + object : SearchView.OnQueryTextListener { + override fun onQueryTextSubmit(query: String): Boolean { + itemAdapter.filter(query) + return true + } - override fun onQueryTextChange(newText: String): Boolean { - itemAdapter.filter(newText) - return true - } - }) + override fun onQueryTextChange(newText: String): Boolean { + itemAdapter.filter(newText) + return true + } + }, + ) } override fun onOptionsItemSelected(item: MenuItem): Boolean { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/folders/FolderIconProvider.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/folders/FolderIconProvider.kt index 15076dbe0..602809ac4 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/folders/FolderIconProvider.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/folders/FolderIconProvider.kt @@ -1,17 +1,17 @@ package com.fsck.k9.ui.folders +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons import com.fsck.k9.mailstore.FolderType -import com.fsck.k9.ui.R class FolderIconProvider { - private val iconFolderInboxResId: Int = R.drawable.ic_inbox - private val iconFolderOutboxResId: Int = R.drawable.ic_outbox - private val iconFolderSentResId: Int = R.drawable.ic_send - private val iconFolderTrashResId: Int = R.drawable.ic_trash_can - private val iconFolderDraftsResId: Int = R.drawable.ic_drafts_folder - private val iconFolderArchiveResId: Int = R.drawable.ic_archive - private val iconFolderSpamResId: Int = R.drawable.ic_alert_octagon - var iconFolderResId: Int = R.drawable.ic_folder + private val iconFolderInboxResId: Int = Icons.Outlined.Inbox + private val iconFolderOutboxResId: Int = Icons.Outlined.Outbox + private val iconFolderSentResId: Int = Icons.Filled.Send + private val iconFolderTrashResId: Int = Icons.Filled.Trash + private val iconFolderDraftsResId: Int = Icons.Filled.Drafts + private val iconFolderArchiveResId: Int = Icons.Filled.Archive + private val iconFolderSpamResId: Int = Icons.Filled.Spam + var iconFolderResId: Int = Icons.Filled.Folder fun getFolderIcon(type: FolderType): Int = when (type) { FolderType.INBOX -> iconFolderInboxResId diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/MessageDetailsFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/MessageDetailsFragment.kt index 23dc2fd27..bea215dca 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/MessageDetailsFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/MessageDetailsFragment.kt @@ -19,6 +19,7 @@ import androidx.core.view.isVisible import androidx.fragment.app.setFragmentResult import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView.OnScrollListener +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons import app.k9mail.ui.utils.bottomsheet.ToolbarBottomSheetDialog import app.k9mail.ui.utils.bottomsheet.ToolbarBottomSheetDialogFragment import com.fsck.k9.activity.MessageCompose @@ -81,7 +82,7 @@ class MessageDetailsFragment : ToolbarBottomSheetDialogFragment() { val toolbar = checkNotNull(toolbar) toolbar.apply { title = getString(R.string.message_details_toolbar_title) - navigationIcon = ContextCompat.getDrawable(requireContext(), R.drawable.ic_close) + navigationIcon = ContextCompat.getDrawable(requireContext(), Icons.Outlined.Close) setNavigationOnClickListener { dismissAllowingStateLoss() @@ -109,11 +110,13 @@ class MessageDetailsFragment : ToolbarBottomSheetDialogFragment() { errorView.isVisible = false recyclerView.isVisible = false } + MessageDetailsState.Error -> { progressBar.isVisible = false errorView.isVisible = true recyclerView.isVisible = false } + is MessageDetailsState.DataLoaded -> { progressBar.isVisible = false errorView.isVisible = false diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt index 8ae2d0b53..591e20641 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt @@ -25,6 +25,7 @@ import androidx.core.view.isVisible import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView.NO_POSITION +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons import com.fsck.k9.FontSizes import com.fsck.k9.UiDensity import com.fsck.k9.contacts.ContactPictureLoader @@ -484,7 +485,7 @@ class MessageListAdapter internal constructor( if (displayAddress != null) { contactsPictureLoader.setContactPicture(contactPictureView, displayAddress) } else { - contactPictureView.setImageResource(R.drawable.ic_contact_picture) + contactPictureView.setImageResource(Icons.Filled.ContactPicture) } } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/SwipeResourceProvider.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/SwipeResourceProvider.kt index c98305661..2383ed970 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/SwipeResourceProvider.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/SwipeResourceProvider.kt @@ -4,6 +4,7 @@ import android.content.res.Resources.Theme import android.graphics.drawable.Drawable import androidx.annotation.DrawableRes import androidx.core.content.res.ResourcesCompat +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons import com.fsck.k9.SwipeAction import com.fsck.k9.ui.R import com.fsck.k9.ui.resolveColorAttribute @@ -11,15 +12,15 @@ import com.fsck.k9.ui.resolveColorAttribute class SwipeResourceProvider(val theme: Theme) { val iconTint = theme.resolveColorAttribute(R.attr.messageListSwipeIconTint) - private val selectIcon = theme.loadDrawable(R.drawable.ic_check_circle) - private val markAsReadIcon = theme.loadDrawable(R.drawable.ic_opened_envelope) - private val markAsUnreadIcon = theme.loadDrawable(R.drawable.ic_mark_new) - private val addStarIcon = theme.loadDrawable(R.drawable.ic_star) - private val removeStarIcon = theme.loadDrawable(R.drawable.ic_star_outline) - private val archiveIcon = theme.loadDrawable(R.drawable.ic_archive) - private val deleteIcon = theme.loadDrawable(R.drawable.ic_trash_can) - private val spamIcon = theme.loadDrawable(R.drawable.ic_alert_octagon) - private val moveIcon = theme.loadDrawable(R.drawable.ic_move_to_folder) + private val selectIcon = theme.loadDrawable(Icons.Filled.CheckCircle) + private val markAsReadIcon = theme.loadDrawable(Icons.Filled.OpenedEnvelope) + private val markAsUnreadIcon = theme.loadDrawable(Icons.Filled.MarkNew) + private val addStarIcon = theme.loadDrawable(Icons.Filled.Star) + private val removeStarIcon = theme.loadDrawable(Icons.Outlined.Star) + private val archiveIcon = theme.loadDrawable(Icons.Filled.Archive) + private val deleteIcon = theme.loadDrawable(Icons.Filled.Trash) + private val spamIcon = theme.loadDrawable(Icons.Filled.Spam) + private val moveIcon = theme.loadDrawable(Icons.Filled.Move) private val noActionColor = theme.resolveColorAttribute(R.attr.messageListSwipeDisabledBackgroundColor) private val selectColor = theme.resolveColorAttribute(R.attr.messageListSwipeSelectBackgroundColor) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java index 400a29dc7..04596fcb3 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java @@ -10,13 +10,14 @@ import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.fsck.k9.K9; +import com.fsck.k9.mailstore.AttachmentViewInfo; import com.fsck.k9.ui.R; import com.fsck.k9.ui.helper.ContextHelper; import com.fsck.k9.ui.helper.SizeFormatter; -import com.fsck.k9.mailstore.AttachmentViewInfo; public class AttachmentView extends FrameLayout implements OnClickListener { @@ -83,7 +84,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener { setAttachmentSize(attachment.size); if (attachment.isSupportedImage()) { - attachmentType.setImageResource(R.drawable.ic_attachment_image); + attachmentType.setImageResource(Icons.Filled.AttachmentImage); if (attachment.isContentAvailable()) { refreshThumbnail(); } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.kt index ea8f7d852..b5671e4b1 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.kt @@ -22,6 +22,7 @@ import androidx.core.content.ContextCompat import androidx.fragment.app.DialogFragment import androidx.fragment.app.Fragment import androidx.fragment.app.setFragmentResultListener +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons import com.fsck.k9.Account import com.fsck.k9.K9 import com.fsck.k9.activity.MessageCompose @@ -241,9 +242,9 @@ class MessageViewFragment : } val drawableId = if (isMessageRead) { - R.drawable.ic_mark_new + Icons.Filled.MarkNew } else { - R.drawable.ic_opened_envelope + Icons.Filled.OpenedEnvelope } val drawable = ContextCompat.getDrawable(requireContext(), drawableId) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/push/PushInfoActivity.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/push/PushInfoActivity.kt index 91b50a705..68fb3f2d1 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/push/PushInfoActivity.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/push/PushInfoActivity.kt @@ -3,6 +3,7 @@ package com.fsck.k9.ui.push import android.os.Bundle import android.view.MenuItem import androidx.fragment.app.commit +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons import com.fsck.k9.ui.R import com.fsck.k9.ui.base.K9Activity @@ -12,7 +13,7 @@ class PushInfoActivity : K9Activity() { setTitle(R.string.push_info_title) setLayout(R.layout.activity_push_info) supportActionBar!!.setDisplayHomeAsUpEnabled(true) - supportActionBar!!.setHomeAsUpIndicator(R.drawable.ic_close) + supportActionBar!!.setHomeAsUpIndicator(Icons.Outlined.Close) if (savedInstanceState == null) { supportFragmentManager.commit { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/SettingsListFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/SettingsListFragment.kt index bc6ca12f7..c94fea166 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/SettingsListFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/SettingsListFragment.kt @@ -15,6 +15,7 @@ import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons import app.k9mail.feature.launcher.FeatureLauncherActivity import com.fsck.k9.Account import com.fsck.k9.ui.R @@ -87,7 +88,7 @@ class SettingsListFragment : Fragment(), ItemTouchCallback { addAction( text = getString(R.string.general_settings_title), navigationAction = R.id.action_settingsListScreen_to_generalSettingsScreen, - icon = R.drawable.ic_cog, + icon = Icons.Filled.Cog, ) addSection(title = getString(R.string.accounts_title)) { @@ -99,7 +100,7 @@ class SettingsListFragment : Fragment(), ItemTouchCallback { addAction( text = getString(R.string.add_account_action), navigationAction = R.id.action_settingsListScreen_to_addAccountScreen, - icon = R.drawable.ic_account_plus, + icon = Icons.Outlined.AccountPlus, ) } @@ -107,13 +108,13 @@ class SettingsListFragment : Fragment(), ItemTouchCallback { addAction( text = getString(R.string.settings_export_title), navigationAction = R.id.action_settingsListScreen_to_settingsExportScreen, - icon = R.drawable.ic_export, + icon = Icons.Outlined.Export, ) addAction( text = getString(SettingsImportR.string.settings_import_title), navigationAction = R.id.action_settingsListScreen_to_settingsImportScreen, - icon = R.drawable.ic_import, + icon = Icons.Outlined.Import, ) } @@ -121,19 +122,19 @@ class SettingsListFragment : Fragment(), ItemTouchCallback { addAction( text = getString(R.string.about_action), navigationAction = R.id.action_settingsListScreen_to_aboutScreen, - icon = R.drawable.ic_info, + icon = Icons.Outlined.Info, ) addUrlAction( text = getString(R.string.user_manual_title), url = getString(R.string.user_manual_url), - icon = R.drawable.ic_open_book, + icon = Icons.Filled.OpenBook, ) addUrlAction( text = getString(R.string.get_help_title), url = getString(R.string.user_forum_url), - icon = R.drawable.ic_help, + icon = Icons.Outlined.Help, ) } } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageHeader.java b/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageHeader.java index f4feabb68..7e5dbba2e 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageHeader.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageHeader.java @@ -18,6 +18,7 @@ import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; import androidx.appcompat.widget.PopupMenu; import androidx.appcompat.widget.TooltipCompat; +import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons; import com.fsck.k9.Account; import com.fsck.k9.DI; import com.fsck.k9.FontSizes; @@ -26,7 +27,6 @@ import com.fsck.k9.activity.misc.ContactPicture; import com.fsck.k9.contacts.ContactPictureLoader; import com.fsck.k9.helper.ClipboardManager; import com.fsck.k9.helper.MessageHelper; -import com.fsck.k9.ui.messageview.MessageViewRecipientFormatter; import com.fsck.k9.mail.Address; import com.fsck.k9.mail.Flag; import com.fsck.k9.mail.Message; @@ -38,6 +38,7 @@ import com.fsck.k9.ui.helper.RelativeDateTimeFormatter; import com.fsck.k9.ui.messageview.DisplayRecipients; import com.fsck.k9.ui.messageview.DisplayRecipientsExtractor; import com.fsck.k9.ui.messageview.MessageHeaderClickListener; +import com.fsck.k9.ui.messageview.MessageViewRecipientFormatter; import com.fsck.k9.ui.messageview.RecipientNamesView; import com.google.android.material.chip.Chip; @@ -213,7 +214,7 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo ContactPictureLoader contactsPictureLoader = ContactPicture.getContactPictureLoader(); contactsPictureLoader.setContactPicture(contactPictureView, fromAddress); } else { - contactPictureView.setImageResource(R.drawable.ic_contact_picture); + contactPictureView.setImageResource(Icons.Filled.ContactPicture); } } else { contactPictureView.setVisibility(View.GONE); @@ -277,10 +278,10 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo private int getReplyImageResource(@NonNull ReplyAction replyAction) { switch (replyAction) { case REPLY: { - return R.drawable.ic_reply; + return Icons.Filled.Reply; } case REPLY_ALL: { - return R.drawable.ic_reply_all; + return Icons.Filled.ReplyAll; } default: { throw new IllegalStateException("Unknown reply action: " + replyAction); diff --git a/app/ui/legacy/src/main/res/values/attrs.xml b/app/ui/legacy/src/main/res/values/attrs.xml index ce664228c..09df2a516 100644 --- a/app/ui/legacy/src/main/res/values/attrs.xml +++ b/app/ui/legacy/src/main/res/values/attrs.xml @@ -5,7 +5,6 @@ - @@ -30,7 +29,6 @@ - diff --git a/app/ui/legacy/src/main/res/values/themes.xml b/app/ui/legacy/src/main/res/values/themes.xml index 2b216d577..314824a04 100644 --- a/app/ui/legacy/src/main/res/values/themes.xml +++ b/app/ui/legacy/src/main/res/values/themes.xml @@ -66,13 +66,11 @@ @style/PreferenceThemeOverlay - // TODO: Remove iconSettingsImportStatus as soon icons are migrated to icon module - @drawable/ic_import_status + #fbbc04 @android:color/primary_text_light @android:color/secondary_text_light - ?attr/colorSecondary ?attr/colorSecondaryVariant 33% ?attr/colorSurface @@ -99,7 +97,6 @@ @color/material_red_700 @color/material_purple_500 - #fbbc04 #ffcccccc #ffababab @array/contact_picture_fallback_background_colors_light @@ -188,12 +185,10 @@ @style/PreferenceThemeOverlay - // TODO: Remove iconSettingsImportStatus as soon icons are migrated to icon module - @drawable/ic_import_status + #fdd663 @android:color/primary_text_dark @android:color/secondary_text_dark - ?attr/colorSecondary ?attr/colorSecondaryVariant 25% ?attr/colorSurface @@ -220,7 +215,6 @@ @color/material_red_800 @color/material_purple_600 - #fdd663 #ff555555 #313131 #ff606060 diff --git a/core/ui/legacy/README.md b/core/ui/legacy/README.md new file mode 100644 index 000000000..369d59308 --- /dev/null +++ b/core/ui/legacy/README.md @@ -0,0 +1,11 @@ +## Core - UI - Legacy + +The modules in this section are dedicated to the legacy UI implementation based on XML-based layouts for Android. + +> [!WARNING] +> It's not suggested to use the contained modules for new features! +> +> This is only maintained for the purpose of supporting the existing implementation. + +> [!IMPORTANT] +> Use the Composable UI along our [theme 2](../compose/theme2) and [design system](../compose/designsystem) design system instead. diff --git a/core/ui/legacy/designsystem/README.md b/core/ui/legacy/designsystem/README.md new file mode 100644 index 000000000..e9b7a7ef7 --- /dev/null +++ b/core/ui/legacy/designsystem/README.md @@ -0,0 +1,11 @@ +## Core - UI - Legacy - Design System + +This is the design system dedicated to the legacy UI implementation based on XML-based layouts for Android. + +> [!WARNING] +> It's not suggested to use this design system for new features! +> +> This is only maintained for the purpose of supporting the existing implementation. + +> [!IMPORTANT] +> Use the Composable UI along our [theme 2](../compose/theme2) and [design system](../compose/designsystem) design system instead. diff --git a/core/ui/legacy/designsystem/build.gradle.kts b/core/ui/legacy/designsystem/build.gradle.kts new file mode 100644 index 000000000..5e6599511 --- /dev/null +++ b/core/ui/legacy/designsystem/build.gradle.kts @@ -0,0 +1,12 @@ +plugins { + id(ThunderbirdPlugins.Library.android) +} + +android { + namespace = "app.k9mail.core.ui.legacy.designsystem" +} + +dependencies { + // TODO Remove this dependency once the legacy theme is available + api(libs.android.material) +} diff --git a/core/ui/legacy/designsystem/src/main/kotlin/app/k9mail/core/ui/legacy/designsystem/atom/icon/Icons.kt b/core/ui/legacy/designsystem/src/main/kotlin/app/k9mail/core/ui/legacy/designsystem/atom/icon/Icons.kt new file mode 100644 index 000000000..1bf6f4c4a --- /dev/null +++ b/core/ui/legacy/designsystem/src/main/kotlin/app/k9mail/core/ui/legacy/designsystem/atom/icon/Icons.kt @@ -0,0 +1,55 @@ +package app.k9mail.core.ui.legacy.designsystem.atom.icon + +import app.k9mail.core.ui.legacy.designsystem.R + +/** + * Icons used in the legacy design system. + * + * The icons are organized in two types: `Filled` and `Outlined`. Each object contains the icons as drawableRes. + */ +object Icons { + object Filled { + val Archive = R.drawable.ic_archive + + @JvmField + val AttachmentImage = R.drawable.ic_attachment_image + val CheckCircle = R.drawable.ic_check_circle + + @JvmField + val ContactPicture = R.drawable.ic_contact_picture + val Cog = R.drawable.ic_cog + val Drafts = R.drawable.ic_drafts_folder + val Folder = R.drawable.ic_folder + val InboxMultiple = R.drawable.ic_inbox_multiple + val MarkNew = R.drawable.ic_mark_new + val Move = R.drawable.ic_move_to_folder + val OpenedEnvelope = R.drawable.ic_opened_envelope + val OpenBook = R.drawable.ic_open_book + + @JvmField + val Reply = R.drawable.ic_reply + + @JvmField + val ReplyAll = R.drawable.ic_reply_all + + val Send = R.drawable.ic_send + val Star = R.drawable.ic_star + val Spam = R.drawable.ic_alert_octagon + val Trash = R.drawable.ic_trash_can + } + + object Outlined { + val AccountPlus = R.drawable.ic_account_plus + val ArrowBack = R.drawable.ic_arrow_back + val Close = R.drawable.ic_close + val Export = R.drawable.ic_export + val Help = R.drawable.ic_help + val Import = R.drawable.ic_import + val Info = R.drawable.ic_info + val Inbox = R.drawable.ic_inbox + val Menu = R.drawable.ic_menu + val Outbox = R.drawable.ic_outbox + val PushNotification = R.drawable.ic_push_notification + val Star = R.drawable.ic_star_outline + } +} diff --git a/app/ui/legacy/src/main/res/drawable/ic_account.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_account.xml similarity index 100% rename from app/ui/legacy/src/main/res/drawable/ic_account.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_account.xml diff --git a/app/ui/legacy/src/main/res/drawable/ic_account_color.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_account_color.xml similarity index 100% rename from app/ui/legacy/src/main/res/drawable/ic_account_color.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_account_color.xml diff --git a/app/ui/legacy/src/main/res/drawable/ic_account_plus.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_account_plus.xml similarity index 100% rename from app/ui/legacy/src/main/res/drawable/ic_account_plus.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_account_plus.xml diff --git a/app/ui/legacy/src/main/res/drawable/ic_alert_octagon.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_alert_octagon.xml similarity index 100% rename from app/ui/legacy/src/main/res/drawable/ic_alert_octagon.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_alert_octagon.xml diff --git a/app/ui/legacy/src/main/res/drawable/ic_archive.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_archive.xml similarity index 100% rename from app/ui/legacy/src/main/res/drawable/ic_archive.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_archive.xml diff --git a/app/ui/legacy/src/main/res/drawable/ic_arrow_back.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_arrow_back.xml similarity index 100% rename from app/ui/legacy/src/main/res/drawable/ic_arrow_back.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_arrow_back.xml diff --git a/app/ui/legacy/src/main/res/drawable/ic_arrow_up_down.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_arrow_up_down.xml similarity index 100% rename from app/ui/legacy/src/main/res/drawable/ic_arrow_up_down.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_arrow_up_down.xml diff --git a/app/ui/legacy/src/main/res/drawable/ic_attachment.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_attachment.xml similarity index 100% rename from app/ui/legacy/src/main/res/drawable/ic_attachment.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_attachment.xml diff --git a/app/ui/legacy/src/main/res/drawable/ic_attachment_generic.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_attachment_generic.xml similarity index 100% rename from app/ui/legacy/src/main/res/drawable/ic_attachment_generic.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_attachment_generic.xml diff --git a/app/ui/legacy/src/main/res/drawable/ic_attachment_image.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_attachment_image.xml similarity index 100% rename from app/ui/legacy/src/main/res/drawable/ic_attachment_image.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_attachment_image.xml diff --git a/app/ui/legacy/src/main/res/drawable/ic_bug.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_bug.xml similarity index 100% rename from app/ui/legacy/src/main/res/drawable/ic_bug.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_bug.xml diff --git a/app/ui/legacy/src/main/res/drawable/ic_check_black_24dp.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_check_black_24dp.xml similarity index 100% rename from app/ui/legacy/src/main/res/drawable/ic_check_black_24dp.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_check_black_24dp.xml diff --git a/app/ui/legacy/src/main/res/drawable/ic_check_circle.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_check_circle.xml similarity index 100% rename from app/ui/legacy/src/main/res/drawable/ic_check_circle.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_check_circle.xml diff --git a/app/ui/legacy/src/main/res/drawable/ic_check_circle_large.xml b/core/ui/legacy/designsystem/src/main/res/drawable/ic_check_circle_large.xml similarity index 88% rename from app/ui/legacy/src/main/res/drawable/ic_check_circle_large.xml rename to core/ui/legacy/designsystem/src/main/res/drawable/ic_check_circle_large.xml index 52c9bcc0d..e50d62594 100644 --- a/app/ui/legacy/src/main/res/drawable/ic_check_circle_large.xml +++ b/core/ui/legacy/designsystem/src/main/res/drawable/ic_check_circle_large.xml @@ -6,7 +6,7 @@ + + + + + diff --git a/feature/settings/import/build.gradle.kts b/feature/settings/import/build.gradle.kts index 971893596..c47a3957b 100644 --- a/feature/settings/import/build.gradle.kts +++ b/feature/settings/import/build.gradle.kts @@ -26,6 +26,7 @@ dependencies { implementation(projects.app.core) implementation(projects.app.ui.base) implementation(projects.core.ui.compose.designsystem) + implementation(projects.core.ui.legacy.designsystem) implementation(projects.feature.account.oauth) implementation(libs.appauth) diff --git a/feature/settings/import/src/main/res/layout/settings_import_account_list_item.xml b/feature/settings/import/src/main/res/layout/settings_import_account_list_item.xml index 75fc5e6f7..e1fab012c 100644 --- a/feature/settings/import/src/main/res/layout/settings_import_account_list_item.xml +++ b/feature/settings/import/src/main/res/layout/settings_import_account_list_item.xml @@ -27,7 +27,7 @@ android:layout_marginStart="16dp" android:contentDescription="@null" android:focusable="false" - app:srcCompat="?attr/iconSettingsImportStatus" + app:srcCompat="@drawable/ic_import_status" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/feature/settings/import/src/main/res/layout/settings_import_general_list_item.xml b/feature/settings/import/src/main/res/layout/settings_import_general_list_item.xml index ddb99ec73..721e253fa 100644 --- a/feature/settings/import/src/main/res/layout/settings_import_general_list_item.xml +++ b/feature/settings/import/src/main/res/layout/settings_import_general_list_item.xml @@ -25,7 +25,7 @@ android:layout_marginStart="16dp" android:contentDescription="@null" android:focusable="false" - app:srcCompat="?attr/iconSettingsImportStatus" + app:srcCompat="@drawable/ic_import_status" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/feature/settings/import/src/main/res/values/attrs.xml b/feature/settings/import/src/main/res/values/attrs.xml deleted file mode 100644 index 32f3244b5..000000000 --- a/feature/settings/import/src/main/res/values/attrs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/settings.gradle.kts b/settings.gradle.kts index 678e7a8cf..c4be8191a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -80,6 +80,7 @@ include( ":core:ui:compose:theme2:k9mail", ":core:ui:compose:theme2:thunderbird", ":core:ui:compose:testing", + ":core:ui:legacy:designsystem", ) include(