diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/SetOTPDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/SetOTPDialogFragment.kt index 77b18d107..26c769afb 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/SetOTPDialogFragment.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/SetOTPDialogFragment.kt @@ -309,7 +309,7 @@ class SetOTPDialogFragment : DatabaseDialogFragment() { override fun afterTextChanged(s: Editable?) { s?.toString()?.let { userString -> try { - mOtpElement.setBase32Secret(userString.toUpperCase(Locale.ENGLISH)) + mOtpElement.setBase32Secret(userString.uppercase(Locale.ENGLISH)) otpSecretContainer?.error = null } catch (exception: Exception) { otpSecretContainer?.error = getString(R.string.error_otp_secret_key) diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt index e10ebf9a3..760a09e92 100644 --- a/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt @@ -272,12 +272,12 @@ class StructureParser(private val structure: AssistStructure) { private fun parseNodeByHtmlAttributes(node: AssistStructure.ViewNode): Boolean { val autofillId = node.autofillId val nodHtml = node.htmlInfo - when (nodHtml?.tag?.toLowerCase(Locale.ENGLISH)) { + when (nodHtml?.tag?.lowercase(Locale.ENGLISH)) { "input" -> { nodHtml.attributes?.forEach { pairAttribute -> - when (pairAttribute.first.toLowerCase(Locale.ENGLISH)) { + when (pairAttribute.first.lowercase(Locale.ENGLISH)) { "type" -> { - when (pairAttribute.second.toLowerCase(Locale.ENGLISH)) { + when (pairAttribute.second.lowercase(Locale.ENGLISH)) { "tel", "email" -> { result?.usernameId = autofillId result?.usernameValue = node.autofillValue diff --git a/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursor.kt b/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursor.kt index 84c1eaffb..986802a02 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursor.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursor.kt @@ -68,7 +68,7 @@ abstract class EntryCursor> pwEntry.notes = getString(getColumnIndex(COLUMN_INDEX_NOTES)) pwEntry.expiryTime = DateInstant(getString(getColumnIndex(COLUMN_INDEX_EXPIRY_TIME))) pwEntry.expires = getString(getColumnIndex(COLUMN_INDEX_EXPIRES)) - .toLowerCase(Locale.ENGLISH) != "false" + .lowercase(Locale.ENGLISH) != "false" } companion object { diff --git a/app/src/main/java/com/kunzisoft/keepass/otp/OtpElement.kt b/app/src/main/java/com/kunzisoft/keepass/otp/OtpElement.kt index d07ace49f..eef173567 100644 --- a/app/src/main/java/com/kunzisoft/keepass/otp/OtpElement.kt +++ b/app/src/main/java/com/kunzisoft/keepass/otp/OtpElement.kt @@ -234,7 +234,7 @@ data class OtpElement(var otpModel: OtpModel = OtpModel()) { fun replaceBase32Chars(parameter: String): String { // Add padding '=' at end if not Base32 length - var parameterNewSize = parameter.toUpperCase(Locale.ENGLISH).removeSpaceChars() + var parameterNewSize = parameter.uppercase(Locale.ENGLISH).removeSpaceChars() while (parameterNewSize.length % 8 != 0) { parameterNewSize += '=' } @@ -264,7 +264,7 @@ enum class OtpTokenType { companion object { fun getFromString(tokenType: String): OtpTokenType { - return when (tokenType.toLowerCase(Locale.ENGLISH)) { + return when (tokenType.lowercase(Locale.ENGLISH)) { "s", "steam" -> STEAM "hotp" -> RFC4226 else -> RFC6238 diff --git a/app/src/main/java/com/kunzisoft/keepass/otp/OtpEntryFields.kt b/app/src/main/java/com/kunzisoft/keepass/otp/OtpEntryFields.kt index a4cd13279..ba8090cbd 100644 --- a/app/src/main/java/com/kunzisoft/keepass/otp/OtpEntryFields.kt +++ b/app/src/main/java/com/kunzisoft/keepass/otp/OtpEntryFields.kt @@ -143,7 +143,7 @@ object OtpEntryFields { if (otpPlainText != null && otpPlainText.isNotEmpty() && isOTPUri(otpPlainText)) { val uri = Uri.parse(otpPlainText.removeSpaceChars()) - if (uri.scheme == null || OTP_SCHEME != uri.scheme!!.toLowerCase(Locale.ENGLISH)) { + if (uri.scheme == null || OTP_SCHEME != uri.scheme!!.lowercase(Locale.ENGLISH)) { Log.e(TAG, "Invalid or missing scheme in uri") return false } @@ -309,7 +309,7 @@ object OtpEntryFields { } if (algorithmField != null) { otpElement.algorithm = - when (algorithmField.toUpperCase(Locale.ENGLISH)) { + when (algorithmField.uppercase(Locale.ENGLISH)) { TIMEOTP_ALGORITHM_SHA1_VALUE -> HashAlgorithm.SHA1 TIMEOTP_ALGORITHM_SHA256_VALUE -> HashAlgorithm.SHA256 TIMEOTP_ALGORITHM_SHA512_VALUE -> HashAlgorithm.SHA512 @@ -417,7 +417,7 @@ object OtpEntryFields { val output = HashMap() for (element in elements) { val pair = element.split("=".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() - output[pair[0].toLowerCase(Locale.ENGLISH)] = pair[1] + output[pair[0].lowercase(Locale.ENGLISH)] = pair[1] } return output } diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.kt b/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.kt index dada5bb1d..71e50ff3e 100644 --- a/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.kt +++ b/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.kt @@ -86,7 +86,7 @@ object UriUtil { private fun isFileScheme(fileUri: Uri): Boolean { val scheme = fileUri.scheme - if (scheme == null || scheme.isEmpty() || scheme.toLowerCase(Locale.ENGLISH) == "file") { + if (scheme == null || scheme.isEmpty() || scheme.lowercase(Locale.ENGLISH) == "file") { return true } return false @@ -94,7 +94,7 @@ object UriUtil { private fun isContentScheme(fileUri: Uri): Boolean { val scheme = fileUri.scheme - if (scheme != null && scheme.toLowerCase(Locale.ENGLISH) == "content") { + if (scheme != null && scheme.lowercase(Locale.ENGLISH) == "content") { return true } return false