diff --git a/core/contact/build.gradle.kts b/core/contact/build.gradle.kts new file mode 100644 index 00000000000..1830b2fc56d --- /dev/null +++ b/core/contact/build.gradle.kts @@ -0,0 +1,11 @@ +plugins { + id(ThunderbirdPlugins.Library.android) +} + +android { + namespace = "net.thunderbird.core.contact" +} + +dependencies { + implementation(projects.mail.common) +} diff --git a/legacy/core/src/main/java/com/fsck/k9/contact/ContactIntentHelper.kt b/core/contact/src/main/java/net/thunderbird/core/contact/ContactIntentHelper.kt similarity index 97% rename from legacy/core/src/main/java/com/fsck/k9/contact/ContactIntentHelper.kt rename to core/contact/src/main/java/net/thunderbird/core/contact/ContactIntentHelper.kt index 54fc520fd3e..d3745e68ee5 100644 --- a/legacy/core/src/main/java/com/fsck/k9/contact/ContactIntentHelper.kt +++ b/core/contact/src/main/java/net/thunderbird/core/contact/ContactIntentHelper.kt @@ -1,4 +1,4 @@ -package com.fsck.k9.contact +package net.thunderbird.core.contact import android.content.Intent import android.net.Uri diff --git a/legacy/ui/legacy/build.gradle.kts b/legacy/ui/legacy/build.gradle.kts index 955e71ff9b1..47209b946b9 100644 --- a/legacy/ui/legacy/build.gradle.kts +++ b/legacy/ui/legacy/build.gradle.kts @@ -13,6 +13,7 @@ dependencies { implementation(projects.core.account) implementation(projects.mail.common) implementation(projects.uiUtils.toolbarBottomSheet) + implementation(projects.core.contact) implementation(projects.core.featureflags) implementation(projects.core.ui.theme.api) diff --git a/legacy/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java b/legacy/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java index 60014129ca8..4db5378b70a 100644 --- a/legacy/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java +++ b/legacy/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java @@ -70,8 +70,7 @@ import com.fsck.k9.activity.compose.ReplyToView; import com.fsck.k9.activity.compose.SaveMessageTask; import com.fsck.k9.activity.misc.Attachment; -import com.fsck.k9.autocrypt.AutocryptDraftStateHeaderParser; -import com.fsck.k9.contact.ContactIntentHelper; +import com.fsck.k9.autocrypt.AutocryptDraftStateHeaderParser;; import app.k9mail.legacy.message.controller.MessageReference; import com.fsck.k9.controller.MessagingController; import app.k9mail.legacy.message.controller.MessagingListener; @@ -115,6 +114,7 @@ import com.fsck.k9.ui.messagelist.DefaultFolderProvider; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.textview.MaterialTextView; +import net.thunderbird.core.contact.ContactIntentHelper; import net.thunderbird.core.ui.theme.manager.ThemeManager; import net.thunderbird.feature.search.LocalSearch; import org.openintents.openpgp.OpenPgpApiManager; diff --git a/legacy/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.kt b/legacy/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.kt index 00ccb272583..b7f17a92bd9 100644 --- a/legacy/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.kt +++ b/legacy/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.kt @@ -18,7 +18,6 @@ import com.fsck.k9.activity.compose.ComposeCryptoStatus.AttachErrorState import com.fsck.k9.activity.compose.ComposeCryptoStatus.SendErrorState import com.fsck.k9.autocrypt.AutocryptDraftStateHeader import com.fsck.k9.autocrypt.AutocryptDraftStateHeaderParser -import com.fsck.k9.contact.ContactIntentHelper import com.fsck.k9.helper.MailTo import com.fsck.k9.helper.ReplyToParser import com.fsck.k9.mail.Address @@ -33,6 +32,7 @@ import com.fsck.k9.message.MessageBuilder import com.fsck.k9.message.PgpMessageBuilder import com.fsck.k9.ui.R import com.fsck.k9.view.RecipientSelectView.Recipient +import net.thunderbird.core.contact.ContactIntentHelper import org.openintents.openpgp.OpenPgpApiManager import org.openintents.openpgp.OpenPgpApiManager.OpenPgpApiManagerCallback import org.openintents.openpgp.OpenPgpApiManager.OpenPgpProviderError @@ -633,7 +633,10 @@ class RecipientPresenter( private fun isContactPickerAvailable(): Boolean { val resolveInfoList = - context.packageManager.queryIntentActivities(ContactIntentHelper.getContactPickerIntent(), 0) + context.packageManager.queryIntentActivities( + ContactIntentHelper.getContactPickerIntent(), + 0, + ) return resolveInfoList.isNotEmpty() } diff --git a/legacy/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.kt b/legacy/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.kt index c1c377027f7..850703597c5 100644 --- a/legacy/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.kt +++ b/legacy/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.kt @@ -25,7 +25,6 @@ import android.widget.Toast import androidx.core.app.ShareCompat.IntentBuilder import androidx.core.view.isGone import androidx.core.view.isVisible -import com.fsck.k9.contact.ContactIntentHelper import com.fsck.k9.helper.ClipboardManager import com.fsck.k9.helper.Utility import com.fsck.k9.mail.Address @@ -38,6 +37,7 @@ import com.fsck.k9.view.MessageWebView import com.fsck.k9.view.MessageWebView.OnPageFinishedListener import com.fsck.k9.view.WebViewConfigProvider import com.google.android.material.textview.MaterialTextView +import net.thunderbird.core.contact.ContactIntentHelper import org.koin.core.component.KoinComponent import org.koin.core.component.inject import org.koin.core.qualifier.named @@ -329,7 +329,9 @@ class MessageContainerView(context: Context, attrs: AttributeSet?) : } MENU_ITEM_EMAIL_SAVE -> { - val intent = ContactIntentHelper.getAddEmailContactIntent(Address(email)) + val intent = ContactIntentHelper.getAddEmailContactIntent( + Address(email), + ) startActivityIfAvailable(context, intent) } diff --git a/settings.gradle.kts b/settings.gradle.kts index 2a5bbc90e8e..cceb7f27465 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -227,4 +227,5 @@ include(":feature:search") include(":core:account") include(":feature:notification") include(":core:ui:theme:manager") +include(":core:contact") include(":core:ui:account")