Fix locale deprecation

This commit is contained in:
Mygod
2023-02-11 15:03:38 -05:00
parent 15c3c5a6d7
commit 494d501ec9
5 changed files with 5 additions and 5 deletions

View File

@@ -87,7 +87,7 @@ class ClientsFragment : Fragment() {
override fun AlertDialog.Builder.prepare(listener: DialogInterface.OnClickListener) {
val context = context
val resources = resources
val locale = resources.configuration.locale
val locale = resources.configuration.locales[0]
setTitle(getText(R.string.clients_stats_title).format(locale, arg.title))
val format = NumberFormat.getIntegerInstance(locale)
setMessage("%s\n%s\n%s".format(

View File

@@ -1,6 +1,6 @@
package be.mygod.vpnhotspot.client
import android.content.Context
import android.content.Context
import android.net.MacAddress
import androidx.annotation.MainThread
import be.mygod.vpnhotspot.App.Companion.app

View File

@@ -231,7 +231,7 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
app.resources.getQuantityText(R.plurals.tethering_manage_wifi_clients, numClients).format(locale,
numClients)
}
override val text get() = parent.resources.configuration.locale.let { locale ->
override val text get() = parent.resources.configuration.locales[0].let { locale ->
listOfNotNull(failureReason?.let { WifiApManager.failureReasonLookup(it) }, baseError, info.run {
if (isEmpty()) null else joinToSpanned("\n") @TargetApi(30) { parcel ->
val info = SoftApInfo(parcel)

View File

@@ -97,7 +97,7 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
override fun toString() = app.getString(R.string.wifi_ap_choose_disabled)
}
override fun toString() = if (channel == 0) {
val format = DecimalFormat("#.#", DecimalFormatSymbols.getInstance(app.resources.configuration.locale))
val format = DecimalFormat("#.#", DecimalFormatSymbols.getInstance(app.resources.configuration.locales[0]))
app.getString(R.string.wifi_ap_choose_G, arrayOf(
SoftApConfigurationCompat.BAND_2GHZ to 2.4,
SoftApConfigurationCompat.BAND_5GHZ to 5,

View File

@@ -69,6 +69,6 @@ class UpstreamsPreference(context: Context, attrs: AttributeSet) : Preference(co
private fun onUpdate() = (context as LifecycleOwner).lifecycleScope.launchWhenStarted {
summary = context.getText(R.string.settings_service_upstream_monitor_summary).format(
context.resources.configuration.locale, primary.charSequence, fallback.charSequence)
context.resources.configuration.locales[0], primary.charSequence, fallback.charSequence)
}
}