Skip to content

Commit 402dcca

Browse files
committed
reformat
1 parent 730dc4f commit 402dcca

5 files changed

Lines changed: 12 additions & 18 deletions

File tree

app/src/main/kotlin/com/vrem/util/LocaleUtils.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,11 @@ fun findByCountryCode(countryCode: String): Locale =
7777

7878
fun allCountries(): List<Locale> = countriesLocales.values.toList()
7979

80-
fun supportedLanguages(): List<Locale> =
81-
(baseSupportedLocales + currentLocale).distinct()
80+
fun supportedLanguages(): List<Locale> = (baseSupportedLocales + currentLocale).distinct()
8281

83-
fun supportedLanguageTags(): List<String> =
84-
listOf("") + baseSupportedLocales.map { it.toLanguageTag() }
82+
fun supportedLanguageTags(): List<String> = listOf("") + baseSupportedLocales.map { it.toLanguageTag() }
8583

86-
private fun normalizeLanguageTag(languageTag: String): String =
87-
languageTag.replace('_', '-').trim()
84+
private fun normalizeLanguageTag(languageTag: String): String = languageTag.replace('_', '-').trim()
8885

8986
fun findByLanguageTag(languageTag: String): Locale {
9087
val normalizedLanguageTag = normalizeLanguageTag(languageTag)
@@ -106,5 +103,4 @@ fun currentLanguageTag(): String = currentLocale.toLanguageTag()
106103

107104
fun toLanguageTag(locale: Locale): String = locale.toLanguageTag()
108105

109-
fun Locale.toSupportedLocaleTag(): String =
110-
findByLanguageTag(this.toLanguageTag()).toLanguageTag()
106+
fun Locale.toSupportedLocaleTag(): String = findByLanguageTag(this.toLanguageTag()).toLanguageTag()

app/src/main/kotlin/com/vrem/util/StringUtils.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,4 @@ fun String.specialTrim(): String = this.trim { it <= ' ' }.replace(" +".toRegex(
2828

2929
fun String.toCapitalize(locale: Locale): String = this.replaceFirstChar { word -> word.uppercase(locale) }
3030

31-
fun String.titlecaseFirst(locale: Locale): String =
32-
replaceFirstChar { it.titlecase(locale) }
31+
fun String.titlecaseFirst(locale: Locale): String = replaceFirstChar { it.titlecase(locale) }

app/src/main/kotlin/com/vrem/wifianalyzer/MainActivity.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,11 @@ class MainActivity :
119119
val languageKey = getString(R.string.language_key)
120120
if (key == languageKey) {
121121
val languageTag = sharedPreferences.getString(languageKey, "")
122-
val locales = languageTag
123-
?.takeIf { it.isNotEmpty() }
124-
?.let(LocaleListCompat::forLanguageTags)
125-
?: LocaleListCompat.getEmptyLocaleList()
122+
val locales =
123+
languageTag
124+
?.takeIf { it.isNotEmpty() }
125+
?.let(LocaleListCompat::forLanguageTags)
126+
?: LocaleListCompat.getEmptyLocaleList()
126127

127128
AppCompatDelegate.setApplicationLocales(locales)
128129
}

app/src/main/kotlin/com/vrem/wifianalyzer/MainReload.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ class MainReload(
2929
var connectionViewType: ConnectionViewType
3030
private set
3131

32-
fun shouldReload(settings: Settings): Boolean =
33-
themeChanged(settings) || connectionViewTypeChanged(settings)
32+
fun shouldReload(settings: Settings): Boolean = themeChanged(settings) || connectionViewTypeChanged(settings)
3433

3534
private fun connectionViewTypeChanged(settings: Settings): Boolean {
3635
val currentConnectionViewType = settings.connectionViewType()

app/src/main/kotlin/com/vrem/wifianalyzer/settings/Settings.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ class Settings(
7070

7171
fun countryCode(): String = repository.string(R.string.country_code_key, currentCountryCode())
7272

73-
fun appLocale(): Locale =
74-
findByLanguageTag(AppCompatDelegate.getApplicationLocales().toLanguageTags())
73+
fun appLocale(): Locale = findByLanguageTag(AppCompatDelegate.getApplicationLocales().toLanguageTags())
7574

7675
fun syncLanguage() {
7776
val appLocaleTag = appLocale().toSupportedLocaleTag()

0 commit comments

Comments
 (0)