Skip to content

Commit

Permalink
Show value of configuration in preferences for coordinate pref
Browse files Browse the repository at this point in the history
  • Loading branch information
firebovine committed Feb 15, 2024
1 parent 221e46c commit 044c8cc
Show file tree
Hide file tree
Showing 20 changed files with 30 additions and 22 deletions.
33 changes: 30 additions & 3 deletions GPSTest/src/main/java/com/android/gpstest/ui/Preferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ->
Expand Down Expand Up @@ -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))
}

Expand All @@ -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)
}
}
}
}
Expand Down Expand Up @@ -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)
Expand All @@ -287,4 +314,4 @@ class Preferences : PreferenceActivity(), OnSharedPreferenceChangeListener {
}
}
}
}
}
1 change: 0 additions & 1 deletion GPSTest/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-cs-rCZ/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-de-rDE/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-eu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-fi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-ko-rKR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 044c8cc

Please sign in to comment.