diff --git a/app/src/main/java/de/westnordost/streetcomplete/data/elementfilter/StringWithCursor.kt b/app/src/main/java/de/westnordost/streetcomplete/data/elementfilter/StringWithCursor.kt index d4e5451c7c..7002de15c1 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/data/elementfilter/StringWithCursor.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/data/elementfilter/StringWithCursor.kt @@ -24,9 +24,9 @@ class StringWithCursor(private val string: String) { return true } - /** Advances the cursor if str or str.toUpperCase() is the next thing at the cursor + /** Advances the cursor if str or str.uppercase() is the next thing at the cursor * - * Returns whether the next string was the str or str.toUpperCase + * Returns whether the next string was the str or str.uppercase */ fun nextIsAndAdvanceIgnoreCase(str: String): Boolean { if (!nextIsIgnoreCase(str)) return false @@ -72,7 +72,7 @@ class StringWithCursor(private val string: String) { fun nextIs(c: Char): Boolean = c == char fun nextIs(str: String): Boolean = string.startsWith(str, cursorPos) fun nextIsIgnoreCase(str: String): Boolean = - nextIs(str.toLowerCase()) || nextIs(str.toUpperCase()) + nextIs(str.lowercase()) || nextIs(str.uppercase()) fun nextMatches(regex: Regex): MatchResult? { val match = regex.find(string, cursorPos) ?: return null diff --git a/app/src/main/java/de/westnordost/streetcomplete/data/quest/QuestController.kt b/app/src/main/java/de/westnordost/streetcomplete/data/quest/QuestController.kt index cf4f1907ba..e084bba59a 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/data/quest/QuestController.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/data/quest/QuestController.kt @@ -19,7 +19,6 @@ import de.westnordost.streetcomplete.data.osmnotes.notequests.OsmNoteQuestContro import de.westnordost.streetcomplete.quests.note_discussion.NoteAnswer import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext -import java.util.Locale import javax.inject.Inject import javax.inject.Singleton import kotlin.collections.ArrayList @@ -47,7 +46,7 @@ import kotlin.collections.ArrayList var fullText = "Unable to answer \"$questTitle\"" if (q is OsmQuest && q.elementId > 0) { - val lowercaseTypeName = q.elementType.name.toLowerCase(Locale.US) + val lowercaseTypeName = q.elementType.name.lowercase() val elementId = q.elementId fullText += " for https://osm.org/$lowercaseTypeName/$elementId" } diff --git a/app/src/main/java/de/westnordost/streetcomplete/map/tangram/KtMapController.kt b/app/src/main/java/de/westnordost/streetcomplete/map/tangram/KtMapController.kt index b52f45da30..b653a1ddf7 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/map/tangram/KtMapController.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/map/tangram/KtMapController.kt @@ -359,7 +359,7 @@ class KtMapController(private val c: MapController, contentResolver: ContentReso class LoadSceneException(message: String, val sceneUpdate: SceneUpdate) : RuntimeException(message) private fun SceneError.toException() = - LoadSceneException(error.name.toLowerCase(Locale.US).replace("_", " "), sceneUpdate) + LoadSceneException(error.name.lowercase().replace("_", " "), sceneUpdate) suspend fun MapView.initMap( diff --git a/app/src/main/java/de/westnordost/streetcomplete/user/CircularFlagView.kt b/app/src/main/java/de/westnordost/streetcomplete/user/CircularFlagView.kt index d8b46e8590..2e3305bd50 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/user/CircularFlagView.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/user/CircularFlagView.kt @@ -10,7 +10,6 @@ import android.view.View import android.view.ViewOutlineProvider import de.westnordost.streetcomplete.R import de.westnordost.streetcomplete.ktx.getYamlObject -import java.util.Locale import kotlin.math.min /** Show a flag of a country in a circle */ @@ -131,7 +130,7 @@ class CircularFlagView @JvmOverloads constructor( } private fun getFlagResId(countryCode: String): Int { - val lowerCaseCountryCode = countryCode.toLowerCase(Locale.US).replace('-', '_') + val lowerCaseCountryCode = countryCode.lowercase().replace('-', '_') return resources.getIdentifier("ic_flag_$lowerCaseCountryCode", "drawable", context.packageName) } @@ -152,7 +151,7 @@ class CircularFlagView @JvmOverloads constructor( private fun readFlagAlignments(resources: Resources): Map = resources.getYamlObject>(R.raw.flag_alignments).map { - it.key to FlagAlignment.valueOf(it.value.replace("-","_").toUpperCase(Locale.US)) + it.key to FlagAlignment.valueOf(it.value.replace("-","_").uppercase()) }.toMap() } diff --git a/app/src/main/java/de/westnordost/streetcomplete/user/CountryInfoFragment.kt b/app/src/main/java/de/westnordost/streetcomplete/user/CountryInfoFragment.kt index 3ef5861ff6..a33bf35cec 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/user/CountryInfoFragment.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/user/CountryInfoFragment.kt @@ -116,7 +116,7 @@ class CountryInfoFragment : AbstractInfoFakeDialogFragment(R.layout.fragment_cou } private fun getFlagResId(countryCode: String): Int { - val lowerCaseCountryCode = countryCode.toLowerCase(Locale.US).replace('-', '_') + val lowerCaseCountryCode = countryCode.lowercase().replace('-', '_') return resources.getIdentifier("ic_flag_$lowerCaseCountryCode", "drawable", requireContext().packageName) } diff --git a/app/src/main/java/de/westnordost/streetcomplete/view/AutoCorrectAbbreviationsEditText.kt b/app/src/main/java/de/westnordost/streetcomplete/view/AutoCorrectAbbreviationsEditText.kt index a54052a6c1..46d9c6bb6e 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/view/AutoCorrectAbbreviationsEditText.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/view/AutoCorrectAbbreviationsEditText.kt @@ -57,7 +57,7 @@ class AutoCorrectAbbreviationsEditText @JvmOverloads constructor( fixedReplace(s, wordStart, wordStart + lastWordBeforeCursor.length, replacement) } else if (lastWordBeforeCursor.length > 3) { val locale = abbrs.locale - val capital = lastWordBeforeCursor.substring(0, 1).toUpperCase(locale) + val capital = lastWordBeforeCursor.substring(0, 1).uppercase(locale) s.replace(wordStart, wordStart + 1, capital) } }