Merge pull request #7815 from thunderbird/add-legacy-designsystem-module

Add legacy design system module
This commit is contained in:
Wolf-Martell Montwé 2024-05-07 16:47:55 +00:00 committed by GitHub
commit 147ac0bc6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
109 changed files with 180 additions and 78 deletions

View file

@ -1,6 +1,7 @@
package com.fsck.k9.resources package com.fsck.k9.resources
import android.content.Context import android.content.Context
import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons
import com.fsck.k9.CoreResourceProvider import com.fsck.k9.CoreResourceProvider
import com.fsck.k9.notification.PushNotificationState import com.fsck.k9.notification.PushNotificationState
import com.fsck.k9.ui.R 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 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 { override fun pushNotificationText(notificationState: PushNotificationState): String {
val resId = when (notificationState) { val resId = when (notificationState) {

View file

@ -5,6 +5,8 @@ plugins {
dependencies { dependencies {
api(projects.app.ui.base) api(projects.app.ui.base)
api(projects.core.ui.legacy.designsystem)
implementation(projects.app.core) implementation(projects.app.core)
implementation(projects.mail.common) implementation(projects.mail.common)
implementation(projects.uiUtils.toolbarBottomSheet) implementation(projects.uiUtils.toolbarBottomSheet)

View file

@ -47,6 +47,7 @@ import androidx.annotation.StringRes;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.core.content.IntentCompat; import androidx.core.content.IntentCompat;
import androidx.core.os.BundleCompat; import androidx.core.os.BundleCompat;
import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.fsck.k9.Account; import com.fsck.k9.Account;
@ -1845,7 +1846,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
if (isLoadingComplete) { if (isLoadingComplete) {
if (attachment.isSupportedImage()) { if (attachment.isSupportedImage()) {
ImageView attachmentTypeView = view.findViewById(R.id.attachment_type); 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); ImageView preview = view.findViewById(R.id.attachment_preview);
preview.setVisibility(View.VISIBLE); preview.setVisibility(View.VISIBLE);

View file

@ -24,6 +24,7 @@ import androidx.fragment.app.commitNow
import app.k9mail.core.android.common.compat.BundleCompat import app.k9mail.core.android.common.compat.BundleCompat
import app.k9mail.core.android.common.contact.CachingRepository import app.k9mail.core.android.common.contact.CachingRepository
import app.k9mail.core.android.common.contact.ContactRepository 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 app.k9mail.feature.launcher.FeatureLauncherActivity
import com.fsck.k9.Account import com.fsck.k9.Account
import com.fsck.k9.K9 import com.fsck.k9.K9
@ -1268,12 +1269,12 @@ open class MessageList :
private fun lockDrawer() { private fun lockDrawer() {
drawer!!.lock() drawer!!.lock()
actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back) actionBar.setHomeAsUpIndicator(Icons.Outlined.ArrowBack)
} }
private fun unlockDrawer() { private fun unlockDrawer() {
drawer!!.unlock() drawer!!.unlock()
actionBar.setHomeAsUpIndicator(R.drawable.ic_menu) actionBar.setHomeAsUpIndicator(Icons.Outlined.Menu)
} }
private fun initializeFromLocalSearch(search: LocalSearch?) { private fun initializeFromLocalSearch(search: LocalSearch?) {

View file

@ -5,11 +5,11 @@ import android.graphics.Bitmap
import android.net.Uri import android.net.Uri
import android.widget.ImageView import android.widget.ImageView
import androidx.annotation.WorkerThread import androidx.annotation.WorkerThread
import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.request.FutureTarget import com.bumptech.glide.request.FutureTarget
import com.fsck.k9.mail.Address import com.fsck.k9.mail.Address
import com.fsck.k9.ui.R
import com.fsck.k9.view.RecipientSelectView.Recipient import com.fsck.k9.view.RecipientSelectView.Recipient
class ContactPictureLoader( class ContactPictureLoader(
@ -41,8 +41,8 @@ class ContactPictureLoader(
private fun setContactPicture(imageView: ImageView, contactPictureUri: Uri) { private fun setContactPicture(imageView: ImageView, contactPictureUri: Uri) {
Glide.with(imageView.context) Glide.with(imageView.context)
.load(contactPictureUri) .load(contactPictureUri)
.placeholder(R.drawable.ic_contact_picture) .placeholder(Icons.Filled.ContactPicture)
.error(R.drawable.ic_contact_picture) .error(Icons.Filled.ContactPicture)
.diskCacheStrategy(DiskCacheStrategy.NONE) .diskCacheStrategy(DiskCacheStrategy.NONE)
.dontAnimate() .dontAnimate()
.into(imageView) .into(imageView)
@ -72,7 +72,7 @@ class ContactPictureLoader(
return Glide.with(context) return Glide.with(context)
.asBitmap() .asBitmap()
.load(contactPictureUri) .load(contactPictureUri)
.error(R.drawable.ic_contact_picture) .error(Icons.Filled.ContactPicture)
.diskCacheStrategy(DiskCacheStrategy.NONE) .diskCacheStrategy(DiskCacheStrategy.NONE)
.dontAnimate() .dontAnimate()
.submit(pictureSizeInPx, pictureSizeInPx) .submit(pictureSizeInPx, pictureSizeInPx)

View file

@ -11,6 +11,7 @@ import android.widget.ImageView
import androidx.core.view.GravityCompat import androidx.core.view.GravityCompat
import androidx.drawerlayout.widget.DrawerLayout import androidx.drawerlayout.widget.DrawerLayout
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons
import com.fsck.k9.Account import com.fsck.k9.Account
import com.fsck.k9.K9 import com.fsck.k9.K9
import com.fsck.k9.activity.MessageList import com.fsck.k9.activity.MessageList
@ -287,7 +288,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K
sliderView.addStickyFooterItem( sliderView.addStickyFooterItem(
PrimaryDrawerItem().apply { PrimaryDrawerItem().apply {
nameRes = R.string.preferences_action nameRes = R.string.preferences_action
iconRes = R.drawable.ic_cog iconRes = Icons.Filled.Cog
identifier = DRAWER_ID_PREFERENCES identifier = DRAWER_ID_PREFERENCES
isSelectable = false isSelectable = false
}, },
@ -360,7 +361,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K
folderList.unifiedInbox?.let { unifiedInbox -> folderList.unifiedInbox?.let { unifiedInbox ->
val unifiedInboxItem = PrimaryDrawerItem().apply { val unifiedInboxItem = PrimaryDrawerItem().apply {
iconRes = R.drawable.ic_inbox_multiple iconRes = Icons.Filled.InboxMultiple
identifier = DRAWER_ID_UNIFIED_INBOX identifier = DRAWER_ID_UNIFIED_INBOX
nameRes = R.string.integrated_inbox_title nameRes = R.string.integrated_inbox_title
selectedColorInt = selectedBackgroundColor selectedColorInt = selectedBackgroundColor

View file

@ -8,6 +8,7 @@ import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.recyclerview.widget.RecyclerView 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
import com.fsck.k9.Account.FolderMode import com.fsck.k9.Account.FolderMode
import com.fsck.k9.Preferences import com.fsck.k9.Preferences
@ -96,7 +97,7 @@ class ChooseFolderActivity : K9Activity() {
private fun initializeActionBar() { private fun initializeActionBar() {
val actionBar = supportActionBar ?: error("Action bar missing") val actionBar = supportActionBar ?: error("Action bar missing")
actionBar.setDisplayHomeAsUpEnabled(true) actionBar.setDisplayHomeAsUpEnabled(true)
actionBar.setHomeAsUpIndicator(R.drawable.ic_close) actionBar.setHomeAsUpIndicator(Icons.Outlined.Close)
} }
private fun initializeFolderList() { private fun initializeFolderList() {
@ -161,7 +162,8 @@ class ChooseFolderActivity : K9Activity() {
val folderMenuItem = menu.findItem(R.id.filter_folders) val folderMenuItem = menu.findItem(R.id.filter_folders)
val folderSearchView = folderMenuItem.actionView as SearchView val folderSearchView = folderMenuItem.actionView as SearchView
folderSearchView.queryHint = getString(R.string.folder_list_filter_hint) folderSearchView.queryHint = getString(R.string.folder_list_filter_hint)
folderSearchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { folderSearchView.setOnQueryTextListener(
object : SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(query: String): Boolean { override fun onQueryTextSubmit(query: String): Boolean {
itemAdapter.filter(query) itemAdapter.filter(query)
return true return true
@ -171,7 +173,8 @@ class ChooseFolderActivity : K9Activity() {
itemAdapter.filter(newText) itemAdapter.filter(newText)
return true return true
} }
}) },
)
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {

View file

@ -1,17 +1,17 @@
package com.fsck.k9.ui.folders 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.mailstore.FolderType
import com.fsck.k9.ui.R
class FolderIconProvider { class FolderIconProvider {
private val iconFolderInboxResId: Int = R.drawable.ic_inbox private val iconFolderInboxResId: Int = Icons.Outlined.Inbox
private val iconFolderOutboxResId: Int = R.drawable.ic_outbox private val iconFolderOutboxResId: Int = Icons.Outlined.Outbox
private val iconFolderSentResId: Int = R.drawable.ic_send private val iconFolderSentResId: Int = Icons.Filled.Send
private val iconFolderTrashResId: Int = R.drawable.ic_trash_can private val iconFolderTrashResId: Int = Icons.Filled.Trash
private val iconFolderDraftsResId: Int = R.drawable.ic_drafts_folder private val iconFolderDraftsResId: Int = Icons.Filled.Drafts
private val iconFolderArchiveResId: Int = R.drawable.ic_archive private val iconFolderArchiveResId: Int = Icons.Filled.Archive
private val iconFolderSpamResId: Int = R.drawable.ic_alert_octagon private val iconFolderSpamResId: Int = Icons.Filled.Spam
var iconFolderResId: Int = R.drawable.ic_folder var iconFolderResId: Int = Icons.Filled.Folder
fun getFolderIcon(type: FolderType): Int = when (type) { fun getFolderIcon(type: FolderType): Int = when (type) {
FolderType.INBOX -> iconFolderInboxResId FolderType.INBOX -> iconFolderInboxResId

View file

@ -19,6 +19,7 @@ import androidx.core.view.isVisible
import androidx.fragment.app.setFragmentResult import androidx.fragment.app.setFragmentResult
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.OnScrollListener 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.ToolbarBottomSheetDialog
import app.k9mail.ui.utils.bottomsheet.ToolbarBottomSheetDialogFragment import app.k9mail.ui.utils.bottomsheet.ToolbarBottomSheetDialogFragment
import com.fsck.k9.activity.MessageCompose import com.fsck.k9.activity.MessageCompose
@ -81,7 +82,7 @@ class MessageDetailsFragment : ToolbarBottomSheetDialogFragment() {
val toolbar = checkNotNull(toolbar) val toolbar = checkNotNull(toolbar)
toolbar.apply { toolbar.apply {
title = getString(R.string.message_details_toolbar_title) title = getString(R.string.message_details_toolbar_title)
navigationIcon = ContextCompat.getDrawable(requireContext(), R.drawable.ic_close) navigationIcon = ContextCompat.getDrawable(requireContext(), Icons.Outlined.Close)
setNavigationOnClickListener { setNavigationOnClickListener {
dismissAllowingStateLoss() dismissAllowingStateLoss()
@ -109,11 +110,13 @@ class MessageDetailsFragment : ToolbarBottomSheetDialogFragment() {
errorView.isVisible = false errorView.isVisible = false
recyclerView.isVisible = false recyclerView.isVisible = false
} }
MessageDetailsState.Error -> { MessageDetailsState.Error -> {
progressBar.isVisible = false progressBar.isVisible = false
errorView.isVisible = true errorView.isVisible = true
recyclerView.isVisible = false recyclerView.isVisible = false
} }
is MessageDetailsState.DataLoaded -> { is MessageDetailsState.DataLoaded -> {
progressBar.isVisible = false progressBar.isVisible = false
errorView.isVisible = false errorView.isVisible = false

View file

@ -25,6 +25,7 @@ import androidx.core.view.isVisible
import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.NO_POSITION 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.FontSizes
import com.fsck.k9.UiDensity import com.fsck.k9.UiDensity
import com.fsck.k9.contacts.ContactPictureLoader import com.fsck.k9.contacts.ContactPictureLoader
@ -484,7 +485,7 @@ class MessageListAdapter internal constructor(
if (displayAddress != null) { if (displayAddress != null) {
contactsPictureLoader.setContactPicture(contactPictureView, displayAddress) contactsPictureLoader.setContactPicture(contactPictureView, displayAddress)
} else { } else {
contactPictureView.setImageResource(R.drawable.ic_contact_picture) contactPictureView.setImageResource(Icons.Filled.ContactPicture)
} }
} }

View file

@ -4,6 +4,7 @@ import android.content.res.Resources.Theme
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.core.content.res.ResourcesCompat 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.SwipeAction
import com.fsck.k9.ui.R import com.fsck.k9.ui.R
import com.fsck.k9.ui.resolveColorAttribute import com.fsck.k9.ui.resolveColorAttribute
@ -11,15 +12,15 @@ import com.fsck.k9.ui.resolveColorAttribute
class SwipeResourceProvider(val theme: Theme) { class SwipeResourceProvider(val theme: Theme) {
val iconTint = theme.resolveColorAttribute(R.attr.messageListSwipeIconTint) val iconTint = theme.resolveColorAttribute(R.attr.messageListSwipeIconTint)
private val selectIcon = theme.loadDrawable(R.drawable.ic_check_circle) private val selectIcon = theme.loadDrawable(Icons.Filled.CheckCircle)
private val markAsReadIcon = theme.loadDrawable(R.drawable.ic_opened_envelope) private val markAsReadIcon = theme.loadDrawable(Icons.Filled.OpenedEnvelope)
private val markAsUnreadIcon = theme.loadDrawable(R.drawable.ic_mark_new) private val markAsUnreadIcon = theme.loadDrawable(Icons.Filled.MarkNew)
private val addStarIcon = theme.loadDrawable(R.drawable.ic_star) private val addStarIcon = theme.loadDrawable(Icons.Filled.Star)
private val removeStarIcon = theme.loadDrawable(R.drawable.ic_star_outline) private val removeStarIcon = theme.loadDrawable(Icons.Outlined.Star)
private val archiveIcon = theme.loadDrawable(R.drawable.ic_archive) private val archiveIcon = theme.loadDrawable(Icons.Filled.Archive)
private val deleteIcon = theme.loadDrawable(R.drawable.ic_trash_can) private val deleteIcon = theme.loadDrawable(Icons.Filled.Trash)
private val spamIcon = theme.loadDrawable(R.drawable.ic_alert_octagon) private val spamIcon = theme.loadDrawable(Icons.Filled.Spam)
private val moveIcon = theme.loadDrawable(R.drawable.ic_move_to_folder) private val moveIcon = theme.loadDrawable(Icons.Filled.Move)
private val noActionColor = theme.resolveColorAttribute(R.attr.messageListSwipeDisabledBackgroundColor) private val noActionColor = theme.resolveColorAttribute(R.attr.messageListSwipeDisabledBackgroundColor)
private val selectColor = theme.resolveColorAttribute(R.attr.messageListSwipeSelectBackgroundColor) private val selectColor = theme.resolveColorAttribute(R.attr.messageListSwipeSelectBackgroundColor)

View file

@ -10,13 +10,14 @@ import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.fsck.k9.K9; import com.fsck.k9.K9;
import com.fsck.k9.mailstore.AttachmentViewInfo;
import com.fsck.k9.ui.R; import com.fsck.k9.ui.R;
import com.fsck.k9.ui.helper.ContextHelper; import com.fsck.k9.ui.helper.ContextHelper;
import com.fsck.k9.ui.helper.SizeFormatter; import com.fsck.k9.ui.helper.SizeFormatter;
import com.fsck.k9.mailstore.AttachmentViewInfo;
public class AttachmentView extends FrameLayout implements OnClickListener { public class AttachmentView extends FrameLayout implements OnClickListener {
@ -83,7 +84,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener {
setAttachmentSize(attachment.size); setAttachmentSize(attachment.size);
if (attachment.isSupportedImage()) { if (attachment.isSupportedImage()) {
attachmentType.setImageResource(R.drawable.ic_attachment_image); attachmentType.setImageResource(Icons.Filled.AttachmentImage);
if (attachment.isContentAvailable()) { if (attachment.isContentAvailable()) {
refreshThumbnail(); refreshThumbnail();
} }

View file

@ -22,6 +22,7 @@ import androidx.core.content.ContextCompat
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.setFragmentResultListener import androidx.fragment.app.setFragmentResultListener
import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons
import com.fsck.k9.Account import com.fsck.k9.Account
import com.fsck.k9.K9 import com.fsck.k9.K9
import com.fsck.k9.activity.MessageCompose import com.fsck.k9.activity.MessageCompose
@ -241,9 +242,9 @@ class MessageViewFragment :
} }
val drawableId = if (isMessageRead) { val drawableId = if (isMessageRead) {
R.drawable.ic_mark_new Icons.Filled.MarkNew
} else { } else {
R.drawable.ic_opened_envelope Icons.Filled.OpenedEnvelope
} }
val drawable = ContextCompat.getDrawable(requireContext(), drawableId) val drawable = ContextCompat.getDrawable(requireContext(), drawableId)

View file

@ -3,6 +3,7 @@ package com.fsck.k9.ui.push
import android.os.Bundle import android.os.Bundle
import android.view.MenuItem import android.view.MenuItem
import androidx.fragment.app.commit 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.R
import com.fsck.k9.ui.base.K9Activity import com.fsck.k9.ui.base.K9Activity
@ -12,7 +13,7 @@ class PushInfoActivity : K9Activity() {
setTitle(R.string.push_info_title) setTitle(R.string.push_info_title)
setLayout(R.layout.activity_push_info) setLayout(R.layout.activity_push_info)
supportActionBar!!.setDisplayHomeAsUpEnabled(true) supportActionBar!!.setDisplayHomeAsUpEnabled(true)
supportActionBar!!.setHomeAsUpIndicator(R.drawable.ic_close) supportActionBar!!.setHomeAsUpIndicator(Icons.Outlined.Close)
if (savedInstanceState == null) { if (savedInstanceState == null) {
supportFragmentManager.commit { supportFragmentManager.commit {

View file

@ -15,6 +15,7 @@ import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons
import app.k9mail.feature.launcher.FeatureLauncherActivity import app.k9mail.feature.launcher.FeatureLauncherActivity
import com.fsck.k9.Account import com.fsck.k9.Account
import com.fsck.k9.ui.R import com.fsck.k9.ui.R
@ -87,7 +88,7 @@ class SettingsListFragment : Fragment(), ItemTouchCallback {
addAction( addAction(
text = getString(R.string.general_settings_title), text = getString(R.string.general_settings_title),
navigationAction = R.id.action_settingsListScreen_to_generalSettingsScreen, navigationAction = R.id.action_settingsListScreen_to_generalSettingsScreen,
icon = R.drawable.ic_cog, icon = Icons.Filled.Cog,
) )
addSection(title = getString(R.string.accounts_title)) { addSection(title = getString(R.string.accounts_title)) {
@ -99,7 +100,7 @@ class SettingsListFragment : Fragment(), ItemTouchCallback {
addAction( addAction(
text = getString(R.string.add_account_action), text = getString(R.string.add_account_action),
navigationAction = R.id.action_settingsListScreen_to_addAccountScreen, 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( addAction(
text = getString(R.string.settings_export_title), text = getString(R.string.settings_export_title),
navigationAction = R.id.action_settingsListScreen_to_settingsExportScreen, navigationAction = R.id.action_settingsListScreen_to_settingsExportScreen,
icon = R.drawable.ic_export, icon = Icons.Outlined.Export,
) )
addAction( addAction(
text = getString(SettingsImportR.string.settings_import_title), text = getString(SettingsImportR.string.settings_import_title),
navigationAction = R.id.action_settingsListScreen_to_settingsImportScreen, 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( addAction(
text = getString(R.string.about_action), text = getString(R.string.about_action),
navigationAction = R.id.action_settingsListScreen_to_aboutScreen, navigationAction = R.id.action_settingsListScreen_to_aboutScreen,
icon = R.drawable.ic_info, icon = Icons.Outlined.Info,
) )
addUrlAction( addUrlAction(
text = getString(R.string.user_manual_title), text = getString(R.string.user_manual_title),
url = getString(R.string.user_manual_url), url = getString(R.string.user_manual_url),
icon = R.drawable.ic_open_book, icon = Icons.Filled.OpenBook,
) )
addUrlAction( addUrlAction(
text = getString(R.string.get_help_title), text = getString(R.string.get_help_title),
url = getString(R.string.user_forum_url), url = getString(R.string.user_forum_url),
icon = R.drawable.ic_help, icon = Icons.Outlined.Help,
) )
} }
} }

View file

@ -18,6 +18,7 @@ import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.widget.PopupMenu; import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.TooltipCompat; import androidx.appcompat.widget.TooltipCompat;
import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.DI; import com.fsck.k9.DI;
import com.fsck.k9.FontSizes; 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.contacts.ContactPictureLoader;
import com.fsck.k9.helper.ClipboardManager; import com.fsck.k9.helper.ClipboardManager;
import com.fsck.k9.helper.MessageHelper; import com.fsck.k9.helper.MessageHelper;
import com.fsck.k9.ui.messageview.MessageViewRecipientFormatter;
import com.fsck.k9.mail.Address; import com.fsck.k9.mail.Address;
import com.fsck.k9.mail.Flag; import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.Message; 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.DisplayRecipients;
import com.fsck.k9.ui.messageview.DisplayRecipientsExtractor; import com.fsck.k9.ui.messageview.DisplayRecipientsExtractor;
import com.fsck.k9.ui.messageview.MessageHeaderClickListener; import com.fsck.k9.ui.messageview.MessageHeaderClickListener;
import com.fsck.k9.ui.messageview.MessageViewRecipientFormatter;
import com.fsck.k9.ui.messageview.RecipientNamesView; import com.fsck.k9.ui.messageview.RecipientNamesView;
import com.google.android.material.chip.Chip; import com.google.android.material.chip.Chip;
@ -213,7 +214,7 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
ContactPictureLoader contactsPictureLoader = ContactPicture.getContactPictureLoader(); ContactPictureLoader contactsPictureLoader = ContactPicture.getContactPictureLoader();
contactsPictureLoader.setContactPicture(contactPictureView, fromAddress); contactsPictureLoader.setContactPicture(contactPictureView, fromAddress);
} else { } else {
contactPictureView.setImageResource(R.drawable.ic_contact_picture); contactPictureView.setImageResource(Icons.Filled.ContactPicture);
} }
} else { } else {
contactPictureView.setVisibility(View.GONE); contactPictureView.setVisibility(View.GONE);
@ -277,10 +278,10 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
private int getReplyImageResource(@NonNull ReplyAction replyAction) { private int getReplyImageResource(@NonNull ReplyAction replyAction) {
switch (replyAction) { switch (replyAction) {
case REPLY: { case REPLY: {
return R.drawable.ic_reply; return Icons.Filled.Reply;
} }
case REPLY_ALL: { case REPLY_ALL: {
return R.drawable.ic_reply_all; return Icons.Filled.ReplyAll;
} }
default: { default: {
throw new IllegalStateException("Unknown reply action: " + replyAction); throw new IllegalStateException("Unknown reply action: " + replyAction);

View file

@ -5,7 +5,6 @@
<attr name="textColorPrimaryRecipientDropdown" format="reference" /> <attr name="textColorPrimaryRecipientDropdown" format="reference" />
<attr name="textColorSecondaryRecipientDropdown" format="reference" /> <attr name="textColorSecondaryRecipientDropdown" format="reference" />
<attr name="backgroundColorChooseAccountHeader" format="color" /> <attr name="backgroundColorChooseAccountHeader" format="color" />
<attr name="messageListSelectedCheckMarkColor" format="reference|color"/>
<attr name="messageListSelectedBackgroundColor" format="reference|color"/> <attr name="messageListSelectedBackgroundColor" format="reference|color"/>
<attr name="messageListSelectedBackgroundAlphaFraction" format="fraction"/> <attr name="messageListSelectedBackgroundAlphaFraction" format="fraction"/>
<attr name="messageListSelectedBackgroundAlphaBackground" format="reference|color"/> <attr name="messageListSelectedBackgroundAlphaBackground" format="reference|color"/>
@ -30,7 +29,6 @@
<attr name="messageListSwipeDeleteBackgroundColor" format="reference|color"/> <attr name="messageListSwipeDeleteBackgroundColor" format="reference|color"/>
<attr name="messageListSwipeSpamBackgroundColor" format="reference|color"/> <attr name="messageListSwipeSpamBackgroundColor" format="reference|color"/>
<attr name="messageListSwipeMoveBackgroundColor" format="reference|color"/> <attr name="messageListSwipeMoveBackgroundColor" format="reference|color"/>
<attr name="messageStarColor" format="color"/>
<attr name="messageDetailsDividerColor" format="reference|color"/> <attr name="messageDetailsDividerColor" format="reference|color"/>
<attr name="composerBackgroundColor" format="color"/> <attr name="composerBackgroundColor" format="color"/>
<attr name="contactPictureFallbackDefaultBackgroundColor" format="reference|color"/> <attr name="contactPictureFallbackDefaultBackgroundColor" format="reference|color"/>

View file

@ -66,13 +66,11 @@
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
// TODO: Remove iconSettingsImportStatus as soon icons are migrated to icon module <item name="iconStarColor">#fbbc04</item>
<item name="iconSettingsImportStatus">@drawable/ic_import_status</item>
<item name="textColorPrimaryRecipientDropdown">@android:color/primary_text_light</item> <item name="textColorPrimaryRecipientDropdown">@android:color/primary_text_light</item>
<item name="textColorSecondaryRecipientDropdown">@android:color/secondary_text_light</item> <item name="textColorSecondaryRecipientDropdown">@android:color/secondary_text_light</item>
<item name="messageListSelectedCheckMarkColor">?attr/colorSecondary</item>
<item name="messageListSelectedBackgroundColor">?attr/colorSecondaryVariant</item> <item name="messageListSelectedBackgroundColor">?attr/colorSecondaryVariant</item>
<item name="messageListSelectedBackgroundAlphaFraction">33%</item> <item name="messageListSelectedBackgroundAlphaFraction">33%</item>
<item name="messageListSelectedBackgroundAlphaBackground">?attr/colorSurface</item> <item name="messageListSelectedBackgroundAlphaBackground">?attr/colorSurface</item>
@ -99,7 +97,6 @@
<item name="messageListSwipeSpamBackgroundColor">@color/material_red_700</item> <item name="messageListSwipeSpamBackgroundColor">@color/material_red_700</item>
<item name="messageListSwipeMoveBackgroundColor">@color/material_purple_500</item> <item name="messageListSwipeMoveBackgroundColor">@color/material_purple_500</item>
<item name="messageStarColor">#fbbc04</item>
<item name="messageDetailsDividerColor">#ffcccccc</item> <item name="messageDetailsDividerColor">#ffcccccc</item>
<item name="contactPictureFallbackDefaultBackgroundColor">#ffababab</item> <item name="contactPictureFallbackDefaultBackgroundColor">#ffababab</item>
<item name="contactPictureFallbackBackgroundColors">@array/contact_picture_fallback_background_colors_light</item> <item name="contactPictureFallbackBackgroundColors">@array/contact_picture_fallback_background_colors_light</item>
@ -188,12 +185,10 @@
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
// TODO: Remove iconSettingsImportStatus as soon icons are migrated to icon module <item name="iconStarColor">#fdd663</item>
<item name="iconSettingsImportStatus">@drawable/ic_import_status</item>
<item name="textColorPrimaryRecipientDropdown">@android:color/primary_text_dark</item> <item name="textColorPrimaryRecipientDropdown">@android:color/primary_text_dark</item>
<item name="textColorSecondaryRecipientDropdown">@android:color/secondary_text_dark</item> <item name="textColorSecondaryRecipientDropdown">@android:color/secondary_text_dark</item>
<item name="messageListSelectedCheckMarkColor">?attr/colorSecondary</item>
<item name="messageListSelectedBackgroundColor">?attr/colorSecondaryVariant</item> <item name="messageListSelectedBackgroundColor">?attr/colorSecondaryVariant</item>
<item name="messageListSelectedBackgroundAlphaFraction">25%</item> <item name="messageListSelectedBackgroundAlphaFraction">25%</item>
<item name="messageListSelectedBackgroundAlphaBackground">?attr/colorSurface</item> <item name="messageListSelectedBackgroundAlphaBackground">?attr/colorSurface</item>
@ -220,7 +215,6 @@
<item name="messageListSwipeSpamBackgroundColor">@color/material_red_800</item> <item name="messageListSwipeSpamBackgroundColor">@color/material_red_800</item>
<item name="messageListSwipeMoveBackgroundColor">@color/material_purple_600</item> <item name="messageListSwipeMoveBackgroundColor">@color/material_purple_600</item>
<item name="messageStarColor">#fdd663</item>
<item name="messageDetailsDividerColor">#ff555555</item> <item name="messageDetailsDividerColor">#ff555555</item>
<item name="contactTokenBackgroundColor">#313131</item> <item name="contactTokenBackgroundColor">#313131</item>
<item name="contactPictureFallbackDefaultBackgroundColor">#ff606060</item> <item name="contactPictureFallbackDefaultBackgroundColor">#ff606060</item>

11
core/ui/legacy/README.md Normal file
View file

@ -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.

View file

@ -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.

View file

@ -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)
}

View file

@ -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
}
}

View file

@ -6,7 +6,7 @@
<path <path
android:pathData="M20,20m-20,0a20,20 0,1 1,40 0a20,20 0,1 1,-40 0" android:pathData="M20,20m-20,0a20,20 0,1 1,40 0a20,20 0,1 1,-40 0"
android:strokeWidth="1" android:strokeWidth="1"
android:fillColor="?attr/messageListSelectedCheckMarkColor" android:fillColor="?attr/colorSecondary"
android:strokeColor="#00000000"/> android:strokeColor="#00000000"/>
<path <path
android:pathData="m16.795,23.875 l-4.17,-4.17 -1.42,1.41 5.59,5.59 12,-12 -1.41,-1.41z" android:pathData="m16.795,23.875 l-4.17,-4.17 -1.42,1.41 5.59,5.59 12,-12 -1.41,-1.41z"

View file

@ -1,7 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:tint="?attr/messageStarColor" android:tint="?attr/iconStarColor"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path

View file

@ -1,7 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp" android:width="20dp"
android:height="19dp" android:height="19dp"
android:tint="?attr/messageStarColor" android:tint="?attr/iconStarColor"
android:viewportWidth="20" android:viewportWidth="20"
android:viewportHeight="19"> android:viewportHeight="19">
<path <path

Some files were not shown because too many files have changed in this diff Show more