From 044c8cc136a111045d4499b54ec7513458f414c1 Mon Sep 17 00:00:00 2001 From: firebovine <firebovine@gmail.com> Date: Thu, 15 Feb 2024 17:18:56 -0500 Subject: [PATCH] Show value of configuration in preferences for coordinate pref --- .../com/android/gpstest/ui/Preferences.kt | 33 +++++++++++++++++-- GPSTest/src/main/res/xml/preferences.xml | 1 - .../src/main/res/values-cs-rCZ/strings.xml | 1 - library/src/main/res/values-da/strings.xml | 1 - .../src/main/res/values-de-rDE/strings.xml | 1 - library/src/main/res/values-el/strings.xml | 1 - library/src/main/res/values-es/strings.xml | 1 - library/src/main/res/values-eu/strings.xml | 1 - library/src/main/res/values-fa/strings.xml | 1 - library/src/main/res/values-fi/strings.xml | 1 - library/src/main/res/values-fr/strings.xml | 1 - library/src/main/res/values-in/strings.xml | 1 - library/src/main/res/values-it/strings.xml | 1 - .../src/main/res/values-ko-rKR/strings.xml | 1 - library/src/main/res/values-nl/strings.xml | 1 - library/src/main/res/values-pl/strings.xml | 1 - library/src/main/res/values-ru/strings.xml | 1 - library/src/main/res/values-uk/strings.xml | 1 - .../src/main/res/values-zh-rCN/strings.xml | 1 - library/src/main/res/values/strings.xml | 1 - 20 files changed, 30 insertions(+), 22 deletions(-) diff --git a/GPSTest/src/main/java/com/android/gpstest/ui/Preferences.kt b/GPSTest/src/main/java/com/android/gpstest/ui/Preferences.kt index 986322f4c..d05a82425 100644 --- a/GPSTest/src/main/java/com/android/gpstest/ui/Preferences.kt +++ b/GPSTest/src/main/java/com/android/gpstest/ui/Preferences.kt @@ -50,6 +50,8 @@ class Preferences : PreferenceActivity(), OnSharedPreferenceChangeListener { var preferredDistanceUnits: ListPreference? = null var preferredSpeedUnits: ListPreference? = null + var preferredCoordinateFormat: ListPreference? = null + var language: ListPreference? = null var chkLogFileNmea: CheckBoxPreference? = null @@ -131,6 +133,9 @@ class Preferences : PreferenceActivity(), OnSharedPreferenceChangeListener { preferredSpeedUnits = findPreference( getString(R.string.pref_key_preferred_speed_units_v2) ) as ListPreference + preferredCoordinateFormat = findPreference( + getString(R.string.pref_key_coordinate_format) + ) as ListPreference language = findPreference(getString(R.string.pref_key_language)) as ListPreference language?.onPreferenceChangeListener = OnPreferenceChangeListener { preference: Preference?, newValue: Any -> @@ -188,6 +193,7 @@ class Preferences : PreferenceActivity(), OnSharedPreferenceChangeListener { super.onResume() changePreferenceSummary(getString(R.string.pref_key_preferred_distance_units_v2)) changePreferenceSummary(getString(R.string.pref_key_preferred_speed_units_v2)) + changePreferenceSummary(getString(R.string.pref_key_coordinate_format)) changePreferenceSummary(getString(R.string.pref_key_language)) } @@ -208,9 +214,18 @@ class Preferences : PreferenceActivity(), OnSharedPreferenceChangeListener { // Change the preferred speed units description changePreferenceSummary(key) } else { - if (key.equals(getString(R.string.pref_key_language), ignoreCase = true)) { - // Change the preferred language description + if (key.equals( + getString(R.string.pref_key_coordinate_format), + ignoreCase = true + ) + ) { + // Change the preferred coordinate formats description changePreferenceSummary(key) + } else { + if (key.equals(getString(R.string.pref_key_language), ignoreCase = true)) { + // Change the preferred language description + changePreferenceSummary(key) + } } } } @@ -277,6 +292,18 @@ class Preferences : PreferenceActivity(), OnSharedPreferenceChangeListener { preferredSpeedUnits!!.summary = entries[i] } } + } else if (prefKey.equals( + getString(R.string.pref_key_coordinate_format), + ignoreCase = true + ) + ) { + val values = app.resources.getStringArray(R.array.preferred_coordinate_format_values) + val entries = app.resources.getStringArray(R.array.preferred_coordinate_format_entries) + for (i in values.indices) { + if (values[i] == preferredCoordinateFormat!!.value) { + preferredCoordinateFormat!!.summary = entries[i] + } + } } else if (prefKey.equals(getString(R.string.pref_key_language), ignoreCase = true)) { val values = app.resources.getStringArray(R.array.language_values) val entries = app.resources.getStringArray(R.array.language_entries) @@ -287,4 +314,4 @@ class Preferences : PreferenceActivity(), OnSharedPreferenceChangeListener { } } } -} \ No newline at end of file +} diff --git a/GPSTest/src/main/res/xml/preferences.xml b/GPSTest/src/main/res/xml/preferences.xml index 48fb33259..47f22a040 100644 --- a/GPSTest/src/main/res/xml/preferences.xml +++ b/GPSTest/src/main/res/xml/preferences.xml @@ -29,7 +29,6 @@ <ListPreference android:key="@string/pref_key_coordinate_format" android:title="@string/pref_coordinate_format_title" - android:summary="@string/pref_coordinate_format_summary" android:dialogTitle="@string/pref_coordinate_format_title" android:entries="@array/preferred_coordinate_format_entries" android:entryValues="@array/preferred_coordinate_format_values" diff --git a/library/src/main/res/values-cs-rCZ/strings.xml b/library/src/main/res/values-cs-rCZ/strings.xml index 0bd968e8f..9fe4f7e42 100644 --- a/library/src/main/res/values-cs-rCZ/strings.xml +++ b/library/src/main/res/values-cs-rCZ/strings.xml @@ -294,7 +294,6 @@ <string name="pref_dark_theme_summary">Nastavte tmavou barvu pozadí.</string> <string name="pref_coordinate_format_title">Formát souřadnic</string> - <string name="pref_coordinate_format_summary">Nastavte formát souřadnic.</string> <string name="preferences_coordinate_format_dd">Desetiny stupňů</string> <string name="preferences_coordinate_format_dms">Stupně, minuty, desetiny sekund</string> <string name="preferences_coordinate_format_ddm">Stupně, desetiny minut</string> diff --git a/library/src/main/res/values-da/strings.xml b/library/src/main/res/values-da/strings.xml index 010dd2948..461d544f7 100644 --- a/library/src/main/res/values-da/strings.xml +++ b/library/src/main/res/values-da/strings.xml @@ -308,7 +308,6 @@ </string> <string name="pref_coordinate_format_title">Koordinatformat</string> - <string name="pref_coordinate_format_summary">Vis i decimalgrader, DMS eller decimalgrader, minutter</string> <string name="preferences_coordinate_format_dd">Decimalgrader</string> <string name="preferences_coordinate_format_dms">Decimalgrader, minutter, sekunder</string> <string name="preferences_coordinate_format_ddm">Decimalgrader, minutter</string> diff --git a/library/src/main/res/values-de-rDE/strings.xml b/library/src/main/res/values-de-rDE/strings.xml index a756472b6..61765d64a 100644 --- a/library/src/main/res/values-de-rDE/strings.xml +++ b/library/src/main/res/values-de-rDE/strings.xml @@ -257,7 +257,6 @@ Studio (Android 7.0 und höher)</string> <string name="pref_dark_theme_summary">Stellt den Hintergrund in einer dunklen Farbe und den Text in einer hellen Farbe dar</string> <string name="pref_coordinate_format_title">Koordinatenformat</string> - <string name="pref_coordinate_format_summary">Anzeige in \"Dezimalgrad\" (DG) , \"Grad, Minuten, Sekunden\" (GMS) oder \"Grad, Dezimalminuten\" (GM)</string> <string name="preferences_coordinate_format_dd">Dezimalgrad</string> <string name="preferences_coordinate_format_dms">Grad, Minuten, Dezimalsekunden</string> <string name="preferences_coordinate_format_ddm">Grad, Dezimalminuten</string> diff --git a/library/src/main/res/values-el/strings.xml b/library/src/main/res/values-el/strings.xml index b47a3f964..33aaa4d21 100644 --- a/library/src/main/res/values-el/strings.xml +++ b/library/src/main/res/values-el/strings.xml @@ -259,7 +259,6 @@ <string name="pref_dark_theme_summary">Θέμα πιο σκοτεινό με φωτεινά γράμματα</string> <string name="pref_coordinate_format_title">Μορφή συντεταγμένων</string> - <string name="pref_coordinate_format_summary">Εμφάνιση σε δεκαδικές μοίρες, DMS, </string> <string name="preferences_coordinate_format_dd">Δεκαδικές Μοίρες</string> <string name="preferences_coordinate_format_dms">Μοίρες, Λεπτά, Δεκαδικά Δευτερόλεπτα</string> <string name="preferences_coordinate_format_ddm">Μοίρες, Δεκαδικά Λεπτά</string> diff --git a/library/src/main/res/values-es/strings.xml b/library/src/main/res/values-es/strings.xml index 31b58aab3..1c0680fe2 100644 --- a/library/src/main/res/values-es/strings.xml +++ b/library/src/main/res/values-es/strings.xml @@ -263,7 +263,6 @@ esté sujetando el dispositivo</string> <string name="pref_dark_theme_summary">Dar al fondo un color oscuro y al texto un color claro</string> <string name="pref_coordinate_format_title">Formato de coordenadas</string> - <string name="pref_coordinate_format_summary">Mostrar en grados decimales, DMS, o grados decimal minutos</string> <string name="preferences_coordinate_format_dd">Grados decimales</string> <string name="preferences_coordinate_format_dms">Grados, minutos, segundos decimales</string> <string name="preferences_coordinate_format_ddm">Grados, minutos decimales</string> diff --git a/library/src/main/res/values-eu/strings.xml b/library/src/main/res/values-eu/strings.xml index 975708446..a1ae404fe 100644 --- a/library/src/main/res/values-eu/strings.xml +++ b/library/src/main/res/values-eu/strings.xml @@ -282,7 +282,6 @@ GPSStatus klasikoa erabiliko du.</string> <string name="pref_dark_theme_summary">Eman atzeko planoari kolore iluna eta testuari kolore argia</string> <string name="pref_coordinate_format_title">Koordenatuen formatua</string> - <string name="pref_coordinate_format_summary">Bistarazi gradu hamartarretan, DMSan edo gradu hamartarren minutuetan</string> <string name="preferences_coordinate_format_dd">Gradu hamartarrak</string> <string name="preferences_coordinate_format_dms">Graduak, minutuak, segundo hamartarrak</string> <string name="preferences_coordinate_format_ddm">Graduak, minutu hamartarrak</string> diff --git a/library/src/main/res/values-fa/strings.xml b/library/src/main/res/values-fa/strings.xml index 34720e77f..03943a90b 100644 --- a/library/src/main/res/values-fa/strings.xml +++ b/library/src/main/res/values-fa/strings.xml @@ -254,7 +254,6 @@ <string name="pref_dark_theme_summary">رنگ زمینه را تیره و رنگ متن را روشن میکند</string> <string name="pref_coordinate_format_title">قالب مختصات</string> - <string name="pref_coordinate_format_summary">نمایش در قالب درجهٔ اعشاری، DMS یا درجه دقیقه اعشاری</string> <string name="preferences_coordinate_format_dd">درجهٔ اعشاری</string> <string name="preferences_coordinate_format_dms">درجه، دقیقه، ثانیهٔ اعشاری (DMS)</string> <string name="preferences_coordinate_format_ddm">درجه، دقیقهٔ اعشاری</string> diff --git a/library/src/main/res/values-fi/strings.xml b/library/src/main/res/values-fi/strings.xml index b8352a209..0287aac3f 100644 --- a/library/src/main/res/values-fi/strings.xml +++ b/library/src/main/res/values-fi/strings.xml @@ -298,7 +298,6 @@ Studioon (Android 7.0 ja uudemmat)</string> <string name="pref_dark_theme_summary">Anna taustalle tumma väri ja tekstille vaalea väri</string> <string name="pref_coordinate_format_title">Koordinaattien muoto</string> - <string name="pref_coordinate_format_summary">Näyttö desimaaliasteina, DMS tai aste desimaaliminuutteina</string> <string name="preferences_coordinate_format_dd">Desimaaliasteet</string> <string name="preferences_coordinate_format_dms">Asteet, minuutit, desimaalisekunnit</string> <string name="preferences_coordinate_format_ddm">Asteet, desimaaliminuuttit</string> diff --git a/library/src/main/res/values-fr/strings.xml b/library/src/main/res/values-fr/strings.xml index ac5e5a12b..2fd123a9f 100644 --- a/library/src/main/res/values-fr/strings.xml +++ b/library/src/main/res/values-fr/strings.xml @@ -262,7 +262,6 @@ Le GPSStatus.Listener par défaut sera utilisé</string> <string name="pref_dark_theme_summary">Donne à l\'arrière plan une couleur sombre et au texte une couleur claire</string> <string name="pref_coordinate_format_title">Format des coordonnées</string> - <string name="pref_coordinate_format_summary">Affichage en degrés décimaux, DMS ou degrés décimal et minutes</string> <string name="preferences_coordinate_format_dd">Degrés décimaux</string> <string name="preferences_coordinate_format_dms">Degrés, Minutes, Secondes Décimales </string> <string name="preferences_coordinate_format_ddm">Degrés, Minutes Décimales</string> diff --git a/library/src/main/res/values-in/strings.xml b/library/src/main/res/values-in/strings.xml index 7e90e5eb1..5658d1528 100644 --- a/library/src/main/res/values-in/strings.xml +++ b/library/src/main/res/values-in/strings.xml @@ -302,7 +302,6 @@ </string> <string name="pref_coordinate_format_title">Format koordinat</string> - <string name="pref_coordinate_format_summary">Tampilkan dalam derajat desimal, DMS, atau derajat desimal menit</string> <string name="preferences_coordinate_format_dd">Derajat desimal</string> <string name="preferences_coordinate_format_dms">Derajat, menit, desimal detik</string> <string name="preferences_coordinate_format_ddm">Derajat, desimal menit</string> diff --git a/library/src/main/res/values-it/strings.xml b/library/src/main/res/values-it/strings.xml index 1f351d345..5e1fff027 100644 --- a/library/src/main/res/values-it/strings.xml +++ b/library/src/main/res/values-it/strings.xml @@ -307,7 +307,6 @@ Crea il tuo QR Code qui: https://zxing.appspot.com/generator/.</string> <string name="pref_dark_theme_summary">Rende lo sfondo scuro con testo a contrasto</string> <string name="pref_coordinate_format_title">Formato delle coordinate</string> - <string name="pref_coordinate_format_summary">Mostra in DD (gradi decimali), DMS (gradi minuti secondi), o DM (gradi minuti decimali)</string> <string name="preferences_coordinate_format_dd">DD (gradi decimali)</string> <string name="preferences_coordinate_format_dms">DMS (gradi minuti secondi)</string> <string name="preferences_coordinate_format_ddm">DM (gradi minuti decimali)</string> diff --git a/library/src/main/res/values-ko-rKR/strings.xml b/library/src/main/res/values-ko-rKR/strings.xml index 6f696cdaf..cc78dc936 100644 --- a/library/src/main/res/values-ko-rKR/strings.xml +++ b/library/src/main/res/values-ko-rKR/strings.xml @@ -268,7 +268,6 @@ legacy GPSStatus.Listener를 사용합니다.</string> </string> <string name="pref_coordinate_format_title">좌표 형식</string> - <string name="pref_coordinate_format_summary">십진수 도(DD), 도, 분 및 초(DMS) 혹은 십진수 분(DMM) 표기</string> <string name="preferences_coordinate_format_dd">십진수 도</string> <string name="preferences_coordinate_format_dms">도, 분 및 초</string> <string name="preferences_coordinate_format_ddm">도 및 십진수 분</string> diff --git a/library/src/main/res/values-nl/strings.xml b/library/src/main/res/values-nl/strings.xml index 796e8b545..37c768e64 100644 --- a/library/src/main/res/values-nl/strings.xml +++ b/library/src/main/res/values-nl/strings.xml @@ -270,7 +270,6 @@ </string> <string name="pref_coordinate_format_title">Coördinaat-formaat</string> - <string name="pref_coordinate_format_summary">Geef weer als decimale graden, graden minuten seconden of graden decimale minuten</string> <string name="preferences_coordinate_format_dd">Decimale graden</string> <string name="preferences_coordinate_format_dms">Graden, minuten, decimale seconden</string> <string name="preferences_coordinate_format_ddm">Graden, decimale minuten</string> diff --git a/library/src/main/res/values-pl/strings.xml b/library/src/main/res/values-pl/strings.xml index 8c68acd38..702527c33 100644 --- a/library/src/main/res/values-pl/strings.xml +++ b/library/src/main/res/values-pl/strings.xml @@ -294,7 +294,6 @@ Rejestruje szczegóły anteny GNSS w pliku JSON. Dostępne tylko na obsługiwany <string name="pref_dark_theme_summary">Zmień kolor tła na ciemny, a kolor tekstu na jasny</string> <string name="pref_coordinate_format_title">Format współrzędnych</string> - <string name="pref_coordinate_format_summary">Wyświetlaj w stopniach dziesiętnych, DMS lub stopniach minut dziesiętnych</string> <string name="preferences_coordinate_format_dd">Stopnie dziesiętne</string> <string name="preferences_coordinate_format_dms">Stopnie, Minuty, Sekundy dziesiętne</string> <string name="preferences_coordinate_format_ddm">Stopnie, Minuty dziesiętne</string> diff --git a/library/src/main/res/values-ru/strings.xml b/library/src/main/res/values-ru/strings.xml index d09d856e2..dc8e12f5e 100644 --- a/library/src/main/res/values-ru/strings.xml +++ b/library/src/main/res/values-ru/strings.xml @@ -309,7 +309,6 @@ </string> <string name="pref_coordinate_format_title">Формат координат</string> - <string name="pref_coordinate_format_summary">Отображать в десятичных градусах, градусах, минутах, секундах или в градусах и десятичных минутах</string> <string name="preferences_coordinate_format_dd">Десятичные градусы</string> <string name="preferences_coordinate_format_dms">Градусы, минуты, десятичные секунды</string> <string name="preferences_coordinate_format_ddm">Градусы, десятичные минуты</string> diff --git a/library/src/main/res/values-uk/strings.xml b/library/src/main/res/values-uk/strings.xml index 82921523a..73a18fae9 100644 --- a/library/src/main/res/values-uk/strings.xml +++ b/library/src/main/res/values-uk/strings.xml @@ -258,7 +258,6 @@ <string name="pref_dark_theme_summary">Надає фону темний колір, а тексту - світлий колір</string> <string name="pref_coordinate_format_title">Формат координат</string> - <string name="pref_coordinate_format_summary">Відобразити в десяткових градусах, DMS або кутових десяткових мінутах</string> <string name="preferences_coordinate_format_dd">Десяткові Градуси</string> <string name="preferences_coordinate_format_dms">Градуси, мінути, десяткові секунди</string> <string name="preferences_coordinate_format_ddm">Градуси, Десяткові мінути</string> diff --git a/library/src/main/res/values-zh-rCN/strings.xml b/library/src/main/res/values-zh-rCN/strings.xml index 1cd23d9a2..29944d8c8 100644 --- a/library/src/main/res/values-zh-rCN/strings.xml +++ b/library/src/main/res/values-zh-rCN/strings.xml @@ -286,7 +286,6 @@ <string name="pref_dark_theme_summary">为背景铺上暗色而文字显示为亮色</string> <string name="pref_coordinate_format_title">坐标格式</string> - <string name="pref_coordinate_format_summary">度分秒等坐标显示格式</string> <string name="preferences_coordinate_format_dd">度</string> <string name="preferences_coordinate_format_dms">度分秒</string> <string name="preferences_coordinate_format_ddm">度分</string> diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml index d76001eca..b975926b6 100644 --- a/library/src/main/res/values/strings.xml +++ b/library/src/main/res/values/strings.xml @@ -377,7 +377,6 @@ </string> <string name="pref_coordinate_format_title">Coordinate format</string> - <string name="pref_coordinate_format_summary">Display in decimal degrees, DMS, or degrees decimal minutes</string> <string name="preferences_coordinate_format_dd">Decimal Degrees</string> <string name="preferences_coordinate_format_dms">Degrees, Minutes, Decimal Seconds</string> <string name="preferences_coordinate_format_ddm">Degrees, Decimal Minutes</string>