From 4c295e2f1b24794b7a0567f66d4ba01a2aea5185 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Wed, 28 Nov 2018 22:05:49 +0100 Subject: [PATCH] use @JvmStatic instead of Companion reference, code style --- .../k9/autocrypt/AutocryptDraftStateHeader.kt | 1 + .../fsck/k9/message/PgpMessageBuilder.java | 2 +- .../activity/compose/ComposeCryptoStatus.kt | 24 ++++++++++--------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/core/src/main/java/com/fsck/k9/autocrypt/AutocryptDraftStateHeader.kt b/app/core/src/main/java/com/fsck/k9/autocrypt/AutocryptDraftStateHeader.kt index 5f09d71c8..8c0f1de57 100644 --- a/app/core/src/main/java/com/fsck/k9/autocrypt/AutocryptDraftStateHeader.kt +++ b/app/core/src/main/java/com/fsck/k9/autocrypt/AutocryptDraftStateHeader.kt @@ -44,6 +44,7 @@ data class AutocryptDraftStateHeader(val isEncrypt: Boolean, const val VALUE_YES = "yes"; + @JvmStatic fun fromCryptoStatus(cryptoStatus: CryptoStatus): AutocryptDraftStateHeader { if (cryptoStatus.isSignOnly) { return AutocryptDraftStateHeader(false, true, cryptoStatus.isReplyToEncrypted, diff --git a/app/core/src/main/java/com/fsck/k9/message/PgpMessageBuilder.java b/app/core/src/main/java/com/fsck/k9/message/PgpMessageBuilder.java index 9ecebfa6d..7e2b124d7 100644 --- a/app/core/src/main/java/com/fsck/k9/message/PgpMessageBuilder.java +++ b/app/core/src/main/java/com/fsck/k9/message/PgpMessageBuilder.java @@ -129,7 +129,7 @@ public class PgpMessageBuilder extends MessageBuilder { private void addDraftStateHeader() { AutocryptDraftStateHeader autocryptDraftStateHeader = - AutocryptDraftStateHeader.Companion.fromCryptoStatus(cryptoStatus); + AutocryptDraftStateHeader.fromCryptoStatus(cryptoStatus); currentProcessedMimeMessage.setHeader(AutocryptDraftStateHeader.AUTOCRYPT_DRAFT_STATE_HEADER, autocryptDraftStateHeader.toHeaderValue()); } diff --git a/app/ui/src/main/java/com/fsck/k9/activity/compose/ComposeCryptoStatus.kt b/app/ui/src/main/java/com/fsck/k9/activity/compose/ComposeCryptoStatus.kt index 7662ba15b..a5483916a 100644 --- a/app/ui/src/main/java/com/fsck/k9/activity/compose/ComposeCryptoStatus.kt +++ b/app/ui/src/main/java/com/fsck/k9/activity/compose/ComposeCryptoStatus.kt @@ -15,16 +15,18 @@ import org.openintents.openpgp.OpenPgpApiManager.OpenPgpProviderState * during email composition to apply cryptographic operations before sending * or saving as draft. */ -data class ComposeCryptoStatus(private val openPgpProviderState: OpenPgpProviderState, - override val openPgpKeyId: Long?, - val recipientAddresses: List, - override val isPgpInlineModeEnabled: Boolean, - override val isSenderPreferEncryptMutual: Boolean, - override val isReplyToEncrypted: Boolean, - override val isEncryptAllDrafts: Boolean, - override val isEncryptSubject: Boolean, - private val cryptoMode: CryptoMode, - private val recipientAutocryptStatus: RecipientAutocryptStatus? = null) : CryptoStatus { +data class ComposeCryptoStatus( + private val openPgpProviderState: OpenPgpProviderState, + override val openPgpKeyId: Long?, + val recipientAddresses: List, + override val isPgpInlineModeEnabled: Boolean, + override val isSenderPreferEncryptMutual: Boolean, + override val isReplyToEncrypted: Boolean, + override val isEncryptAllDrafts: Boolean, + override val isEncryptSubject: Boolean, + private val cryptoMode: CryptoMode, + private val recipientAutocryptStatus: RecipientAutocryptStatus? = null +) : CryptoStatus { constructor(openPgpProviderState: OpenPgpProviderState, openPgpKeyId: Long?, @@ -143,7 +145,7 @@ data class ComposeCryptoStatus(private val openPgpProviderState: OpenPgpProvider isPgpInlineModeEnabled = isPgpInlineModeEnabled, isSenderPreferEncryptMutual = isSenderPreferEncryptMutual, isReplyToEncrypted = isReplyToEncrypted, - isEncryptAllDrafts= isEncryptAllDrafts, + isEncryptAllDrafts = isEncryptAllDrafts, isEncryptSubject = isEncryptSubject, recipientAddresses = recipientAddresses, recipientAutocryptStatus = recipientAutocryptStatusType