Author: Adam Evyčędo <git@apiote.xyz>
localise last geocoding data update
%!v(PANIC=String method: strings: negative Repeat count)
diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/settings/ServerChooserActivity.kt b/app/src/main/java/xyz/apiote/bimba/czwek/settings/ServerChooserActivity.kt index 223dfeee4be34ef5e501c4760e382eb3342bdf24..88165f880c011dfc8b55b0e6d32ac1363d8b0f55 100644 --- a/app/src/main/java/xyz/apiote/bimba/czwek/settings/ServerChooserActivity.kt +++ b/app/src/main/java/xyz/apiote/bimba/czwek/settings/ServerChooserActivity.kt @@ -134,7 +134,7 @@ MaterialAlertDialogBuilder(this).setIcon(AppCompatResources.getDrawable(this, icon)) .setTitle(getString(title)).setMessage(getString(description)) .setNegativeButton(R.string.cancel) { _, _ -> }.apply { if (onPositive != null) { - setPositiveButton(R.string.cont) { _, _ -> + setPositiveButton(R.string.continue_) { _, _ -> onPositive() } } diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/settings/SettingsActivity.kt b/app/src/main/java/xyz/apiote/bimba/czwek/settings/SettingsActivity.kt index f19dc985278de5999659136c1a28c19a9a3999a5..4a76cd5ef120f9419ff479301845c81d8240ceae 100644 --- a/app/src/main/java/xyz/apiote/bimba/czwek/settings/SettingsActivity.kt +++ b/app/src/main/java/xyz/apiote/bimba/czwek/settings/SettingsActivity.kt @@ -2,6 +2,7 @@ package xyz.apiote.bimba.czwek.settings import android.content.Context import android.os.Bundle +import android.text.format.DateUtils import android.view.View import android.view.ViewGroup import androidx.activity.enableEdgeToEdge @@ -9,6 +10,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.core.view.ViewCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.updateLayoutParams +import androidx.core.view.updatePadding import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceManager @@ -19,10 +21,6 @@ import androidx.work.OutOfQuotaPolicy import androidx.work.WorkInfo import androidx.work.WorkManager import xyz.apiote.bimba.czwek.R -import java.time.Instant -import java.time.ZoneId -import java.time.ZonedDateTime -import java.time.format.DateTimeFormatter.RFC_1123_DATE_TIME import java.util.concurrent.ExecutionException @@ -44,9 +42,10 @@ val root = findViewById(R.id.settings) ViewCompat.setOnApplyWindowInsetsListener(root) { v, windowInsets -> val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) + v.updatePadding(left = windowInsets.displayCutout?.safeInsetLeft?.takeIf { it > 0 } ?: insets.left) + v.updatePadding(right = windowInsets.displayCutout?.safeInsetRight?.takeIf { it > 0 } ?: insets.right) v.updateLayoutParams<ViewGroup.MarginLayoutParams> { topMargin = insets.top - // TODO bottom, left, right, camera } windowInsets } @@ -73,12 +72,16 @@ val citiesLastUpdate = PreferenceManager.getDefaultSharedPreferences(requireContext()) .getLong("cities_last_update", -1) if (citiesLastUpdate > 0) { - // TODO localise - val lastUpdateTime = - ZonedDateTime.ofInstant(Instant.ofEpochSecond(citiesLastUpdate), ZoneId.systemDefault()) - .format(RFC_1123_DATE_TIME) + val lastUpdateTime = DateUtils.getRelativeDateTimeString( + context, + citiesLastUpdate * DateUtils.SECOND_IN_MILLIS, + DateUtils.DAY_IN_MILLIS, + DateUtils.WEEK_IN_MILLIS, + 0 + ) + findPreference<SwitchPreferenceCompat>("autoupdate_cities_list")?.summary = - "Last update $lastUpdateTime" + getString(R.string.last_update, lastUpdateTime) } } diff --git a/app/src/main/res/layout/activity_server_chooser.xml b/app/src/main/res/layout/activity_server_chooser.xml index dd8faff12d484f93ecc8905613b0fa90f86b2cf3..3fc4e19a1648219fa679015ac743c8fbd6b03030 100644 --- a/app/src/main/res/layout/activity_server_chooser.xml +++ b/app/src/main/res/layout/activity_server_chooser.xml @@ -55,7 +55,7 @@ android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" - android:text="@string/bimba_server_continue_button" + android:text="@string/continue_" app:layout_constraintEnd_toEndOf="@+id/token_field" app:layout_constraintStart_toStartOf="@+id/token_field" app:layout_constraintTop_toBottomOf="@+id/token_field" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c10a98efd6d9ee4670759780dc335da46334639f..f7aae6c11baa6db1be3e84813f705c4197e87004 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -14,7 +14,7 @@ Journey <string name="home_fab_description">GPS icon</string> <string name="search_placeholder">stops, lines, or plus codes</string> <string name="title_activity_results">Results</string> - <string name="cont">Continue</string> + <string name="continue_">Continue</string> <string name="save">Save</string> <string name="error_400">The application made a malformed request</string> <string name="error_401">A token is needed to use this server</string> @@ -144,7 +144,6 @@Stops nearby <string name="results_for">Results for ‘%1$s’</string> <string name="bimba_server_address_hint">Server</string> <string name="bimba_server_token_hint">Token</string> - <string name="bimba_server_continue_button">Continue</string> <string name="realtime_content_description">departure is realtime</string> <string name="wheelchair_content_description">vehicle is wheelchair accessible</string> <string name="air_condition_content_description">air conditioning</string> diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 94cbc875e7d3d23c03c9a58c20d9d32af4282982..be31173613a7f4bb64ba41f088267e736ee3d9bd 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -8,7 +8,7 @@Örtlichkeiten filtern <string name="title_map">Karte</string> <string name="home_fab_description">GPS-Symbol</string> <string name="title_activity_results">Ergebnisse</string> - <string name="cont">Fortsetzen</string> + <string name="continue_">Fortsetzen</string> <string name="vehicle_headsign">%1$s » %2$s</string> <string name="speed_in_km_per_h">%1$s km/h</string> <string name="congestion_unknown">unbekannt</string> diff --git a/app/src/main/res/values-en-rUS/strings.xml b/app/src/main/res/values-en-rUS/strings.xml index f00aeccfaea80621a1d6c99e5bc763279b250d00..bfe3e1a6a1f17a1efac5a46f6940fa81ae9299d9 100644 --- a/app/src/main/res/values-en-rUS/strings.xml +++ b/app/src/main/res/values-en-rUS/strings.xml @@ -12,7 +12,7 @@Journey <string name="home_fab_description">GPS icon</string> <string name="search_placeholder">stops, lines, or plus codes</string> <string name="title_activity_results">Results</string> - <string name="cont">Continue</string> + <string name="continue_">Continue</string> <string name="save">Save</string> <string name="error_400">The application made a malformed request</string> <string name="error_401">A token is needed to use this server</string> diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 76ae82dae9074ecb926e61f518f36d54cef017d4..a6187a37fcc0358cb0f9eaf91c63f567b7e0e68c 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -9,7 +9,7 @@Bimba <string name="title_home">Accueil</string> <string name="home_fab_description">Icône GPS</string> <string name="save">Enregistrer</string> - <string name="cont">Continuer</string> + <string name="continue_">Continuer</string> <string name="search_placeholder">Arrêts, lignes, ou Plus Codes</string> <string name="error_401">Un jeton est nécessaire pour utiliser ce serveur</string> <string name="error_403">Le jeton fourni est incorrect</string> diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index b82bcc3ef26310d03d67a6b5eab3bcf46aac22da..e264ad5f1b72d741d48315cc72109ee22604a614 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -11,7 +11,7 @@Viaggio <string name="home_fab_description">icona GPS</string> <string name="search_placeholder">fermate, linee o codici OLC</string> <string name="title_activity_results">Risultati</string> - <string name="cont">Continua</string> + <string name="continue_">Continua</string> <string name="save">Salva</string> <string name="error_400">L’app ha fatto una richiesta malformata</string> <string name="error_401">Un gettone è necessario per usare questo server</string> diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 0a7a5bad3e665dddd97dc286915c2260f548725a..31e3bd2fb28def64b944724728bf0d38bc27faa6 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -11,7 +11,7 @@Podróż <string name="home_fab_description">ikona lokalizacji</string> <string name="search_placeholder">przystanki, linie lub kody OLC</string> <string name="title_activity_results">Wyniki</string> - <string name="cont">Kontynuuj</string> + <string name="continue_">Kontynuuj</string> <string name="save">Zapisz</string> <string name="error_400">Aplikacja wykonała niepoprawne żądanie</string> <string name="error_401">Żeton jest wymagany, aby używać tego serwera</string>