Fix warning 1.5: 'toUpperCase(Locale): String' and 'toLowerCase(Locale): String' are deprecated

This commit is contained in:
Benoit Marty 2021-05-14 12:47:53 +02:00
parent 7a28be941c
commit c70445a9a1
8 changed files with 9 additions and 9 deletions

View file

@ -132,7 +132,7 @@ sealed class MatrixItem(
dn.substring(startIndex, startIndex + length)
}
.toUpperCase(Locale.ROOT)
.uppercase(Locale.ROOT)
}
companion object {

View file

@ -345,7 +345,7 @@ internal abstract class SASDefaultVerificationTransaction(
}
protected fun hashUsingAgreedHashMethod(toHash: String): String? {
if ("sha256" == accepted?.hash?.toLowerCase(Locale.ROOT)) {
if ("sha256" == accepted?.hash?.lowercase(Locale.ROOT)) {
val olmUtil = OlmUtility()
val hashBytes = olmUtil.sha256(toHash)
olmUtil.releaseUtility()
@ -355,7 +355,7 @@ internal abstract class SASDefaultVerificationTransaction(
}
private fun macUsingAgreedMethod(message: String, info: String): String? {
return when (accepted?.messageAuthenticationCode?.toLowerCase(Locale.ROOT)) {
return when (accepted?.messageAuthenticationCode?.lowercase(Locale.ROOT)) {
SAS_MAC_SHA256_LONGKDF -> getSAS().calculateMacLongKdf(message, info)
SAS_MAC_SHA256 -> getSAS().calculateMac(message, info)
else -> null

View file

@ -117,7 +117,7 @@ internal class DefaultIdentityBulkLookupTask @Inject constructor(
return withOlmUtility { olmUtility ->
threePids.map { threePid ->
base64ToBase64Url(
olmUtility.sha256(threePid.value.toLowerCase(Locale.ROOT)
olmUtility.sha256(threePid.value.lowercase(Locale.ROOT)
+ " " + threePid.toMedium() + " " + pepper)
)
}

View file

@ -27,7 +27,7 @@ fun String.md5() = try {
digest.update(toByteArray())
digest.digest()
.joinToString("") { String.format("%02X", it) }
.toLowerCase(Locale.ROOT)
.lowercase(Locale.ROOT)
} catch (exc: Exception) {
// Should not happen, but just in case
hashCode().toString()

View file

@ -45,7 +45,7 @@ fun getMimeTypeFromUri(context: Context, uri: Uri): String? {
if (null != mimeType) {
// the mimetype is sometimes in uppercase.
mimeType = mimeType.toLowerCase(Locale.ROOT)
mimeType = mimeType.lowercase(Locale.ROOT)
}
} catch (e: Exception) {
Timber.e(e, "Failed to open resource input stream")

View file

@ -112,7 +112,7 @@ fun getFileExtension(fileUri: String): String? {
val ext = filename.substring(dotPos + 1)
if (ext.isNotBlank()) {
return ext.toLowerCase(Locale.ROOT)
return ext.lowercase(Locale.ROOT)
}
}
}

View file

@ -449,7 +449,7 @@ class RoomDetailViewModel @AssistedInject constructor(
widgetSessionId = widgetSessionId.substring(0, 7)
}
val roomId: String = room.roomId
val confId = roomId.substring(1, roomId.indexOf(":") - 1) + widgetSessionId.toLowerCase(VectorLocale.applicationLocale)
val confId = roomId.substring(1, roomId.indexOf(":") - 1) + widgetSessionId.lowercase(VectorLocale.applicationLocale)
val preferredJitsiDomain = tryOrNull {
rawService.getElementWellknown(session.myUserId)

View file

@ -181,7 +181,7 @@ object VectorLocale {
}
}
// sort by human display names
.sortedBy { localeToLocalisedString(it).toLowerCase(it) }
.sortedBy { localeToLocalisedString(it).lowercase(it) }
supportedLocales.clear()
supportedLocales.addAll(list)