diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2023-11-30 14:45:34 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2023-11-30 14:45:34 +0530 |
commit | 7475f2fb13f7f8b8e2bfbe48a58c2cca6b225392 (patch) | |
tree | 17e70d3313a8026a61d03b628482682155df2ea6 | |
parent | 14cc25af148e8506346644a1cf9a3dcc1b22b960 (diff) |
fix: replace `Enum.values()` with `Enum.entries`
5 files changed, 6 insertions, 6 deletions
diff --git a/app/src/main/java/app/passwordstore/util/autofill/AutofillPreferences.kt b/app/src/main/java/app/passwordstore/util/autofill/AutofillPreferences.kt index f1eb8835..b8490054 100644 --- a/app/src/main/java/app/passwordstore/util/autofill/AutofillPreferences.kt +++ b/app/src/main/java/app/passwordstore/util/autofill/AutofillPreferences.kt @@ -117,7 +117,7 @@ enum class DirectoryStructure(val value: String) { val DEFAULT = FileBased - private val reverseMap = values().associateBy { it.value } + private val reverseMap = entries.associateBy { it.value } fun fromValue(value: String?) = if (value != null) reverseMap[value] ?: DEFAULT else DEFAULT } diff --git a/app/src/main/java/app/passwordstore/util/git/sshj/SshKey.kt b/app/src/main/java/app/passwordstore/util/git/sshj/SshKey.kt index b72fc58b..1386bf97 100644 --- a/app/src/main/java/app/passwordstore/util/git/sshj/SshKey.kt +++ b/app/src/main/java/app/passwordstore/util/git/sshj/SshKey.kt @@ -140,7 +140,7 @@ object SshKey { companion object { - fun fromValue(value: String?): Type? = values().associateBy { it.value }[value] + fun fromValue(value: String?): Type? = entries.associateBy { it.value }[value] } } diff --git a/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/AutocryptPeerUpdate.kt b/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/AutocryptPeerUpdate.kt index 6690fe35..c6bd573d 100644 --- a/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/AutocryptPeerUpdate.kt +++ b/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/AutocryptPeerUpdate.kt @@ -29,7 +29,7 @@ public class AutocryptPeerUpdate() : Parcelable { private constructor(source: Parcel, version: Int) : this() { keyData = source.createByteArray() effectiveDate = if (source.readInt() != 0) Date(source.readLong()) else null - preferEncrypt = PreferEncrypt.values()[source.readInt()] + preferEncrypt = PreferEncrypt.entries[source.readInt()] } public fun createAutocryptPeerUpdate(keyData: ByteArray?, timestamp: Date?): AutocryptPeerUpdate { diff --git a/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.kt b/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.kt index a1a4a81b..f4af90ba 100644 --- a/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.kt +++ b/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.kt @@ -60,7 +60,7 @@ public class OpenPgpSignatureResult : Parcelable { // backward compatibility for this exact version if (version > 2) { senderStatusResult = - readEnumWithNullAndFallback(source, SenderStatusResult.values(), SenderStatusResult.UNKNOWN) + readEnumWithNullAndFallback(source, SenderStatusResult.entries, SenderStatusResult.UNKNOWN) confirmedUserIds = source.createStringArrayList() } else { senderStatusResult = SenderStatusResult.UNKNOWN @@ -74,7 +74,7 @@ public class OpenPgpSignatureResult : Parcelable { } autocryptPeerentityResult = if (version > 4) { - readEnumWithNullAndFallback(source, AutocryptPeerResult.values(), null) + readEnumWithNullAndFallback(source, AutocryptPeerResult.entries, null) } else { null } diff --git a/ssh/src/main/kotlin/app/passwordstore/ssh/SSHKeyType.kt b/ssh/src/main/kotlin/app/passwordstore/ssh/SSHKeyType.kt index 4a716ac8..b9318297 100644 --- a/ssh/src/main/kotlin/app/passwordstore/ssh/SSHKeyType.kt +++ b/ssh/src/main/kotlin/app/passwordstore/ssh/SSHKeyType.kt @@ -10,6 +10,6 @@ public enum class SSHKeyType(internal val value: String) { public companion object { - public fun fromValue(type: String?): SSHKeyType? = values().associateBy { it.value }[type] + public fun fromValue(type: String?): SSHKeyType? = entries.associateBy { it.value }[type] } } |