Skip to content

Commit

Permalink
Allow custom logging time to be in seconds, validate input too
Browse files Browse the repository at this point in the history
  • Loading branch information
rcgroot committed Jan 23, 2016
1 parent e282d4c commit 3b5919b
Show file tree
Hide file tree
Showing 31 changed files with 52 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,12 @@ public class SettingsFragment extends PreferenceFragmentCompat {
public void onCreatePreferences(Bundle bundle, String s) {
addPreferencesFromResource(R.xml.settings);


ListPreference precision = (ListPreference) findPreference(Helper.PRECISION_PREFERENCE);
time = (EditTextPreference) findPreference(Helper.CUSTOMPRECISIONTIME_PREFERENCE);
distance = (EditTextPreference) findPreference(Helper.CUSTOMPRECISIONDISTANCE_PREFERENCE);
streambroadcast_distance = (EditTextPreference) findPreference(Helper.BROADCAST_STREAM_DISTANCE_METER);
streambroadcast_time = (EditTextPreference) findPreference(Helper.BROADCAST_STREAM_TIME);
custumupload_backlog = (EditTextPreference) findPreference(Helper.CUSTOM_UPLOAD_BACKLOG);

setEnabledCustomValues(precision.getValue());
precision.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
Expand All @@ -67,27 +65,33 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
return true;
}
});
streambroadcast_distance.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
Preference.OnPreferenceChangeListener fiveDigits = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String fpExpr = "\\d{1,5}";
return Pattern.matches(fpExpr, newValue.toString());
}
});
streambroadcast_time.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
};
Preference.OnPreferenceChangeListener twentyOneDigits = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String fpExpr = "\\d{1,21}";
return Pattern.matches(fpExpr, newValue.toString());
}
});
custumupload_backlog.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
};
Preference.OnPreferenceChangeListener threeDigits = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String fpExpr = "\\d{1,3}";
return Pattern.matches(fpExpr, newValue.toString());
}
});
};

time.setOnPreferenceChangeListener(fiveDigits);
distance.setOnPreferenceChangeListener(fiveDigits);
streambroadcast_distance.setOnPreferenceChangeListener(fiveDigits);
streambroadcast_time.setOnPreferenceChangeListener(twentyOneDigits);
custumupload_backlog.setOnPreferenceChangeListener(threeDigits);
}

private void setEnabledCustomValues(Object newValue) {
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-cs-rCZ/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Search tracks</string>
<string name="preference_sharing">Sharing settings</string>
<string name="preference_logging">Logging and GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Search tracks</string>
<string name="preference_sharing">Sharing settings</string>
<string name="preference_logging">Logging and GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Ich hoffe, sie haben Spaß an dieser Anwendung und würde mich freuen davon zu h
<string name="search_hint">Suche Tracks</string>
<string name="preference_sharing">Sharing-Einstellungen</string>
<string name="preference_logging">Logging and GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ http://code.google.com/p/open-gpstracker/issues/entry
<string name="search_hint">Αναζήτηση διαδρομών</string>
<string name="preference_sharing">Ρυθμίσεις δημοσίευσης</string>
<string name="preference_logging">Καταγραφή και GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">Ο χρόνος μεταξύ μετρήσεων GPS</string>
<string name="customprecisiondistance_title">Απόσταση μεταξύ μετρήσεων, σε μέτρα</string>
<string name="customprecisiondistance_summary">Η επιθυμητή διανυθείσα απόσταση μεταξύ μετρήσεων.</string>
Expand Down
4 changes: 4 additions & 0 deletions studio/app/src/main/res/values-en-rUS/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="customprecisiontime_title"></string>
</resources>
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Buscar tracks</string>
<string name="preference_sharing">Ajustes de compartición</string>
<string name="preference_logging">Ajustes de registro y uso de GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-et-rEE/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Search tracks</string>
<string name="preference_sharing">Sharing settings</string>
<string name="preference_logging">Logging and GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-fi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Search tracks</string>
<string name="preference_sharing">Sharing settings</string>
<string name="preference_logging">Logging and GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Rechercher parcours</string>
<string name="preference_sharing">Paramètres de partage</string>
<string name="preference_logging">Localisation et GPS</string>
<string name="customprecisiontime_title">Intervalle de temps en minutes du point de parcours cible</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">Le temps en veille du récepteur GPS entre les points de parcours.</string>
<string name="customprecisiondistance_title">Distance du point de parcours cible en mètres</string>
<string name="customprecisiondistance_summary">La distance qui devraient être couverte entre les points de parcours</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Search tracks</string>
<string name="preference_sharing">Sharing settings</string>
<string name="preference_logging">Logging and GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-hu-rHU/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Search tracks</string>
<string name="preference_sharing">Sharing settings</string>
<string name="preference_logging">Logging and GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Ricerca tracce</string>
<string name="preference_sharing">Parametri condivisione</string>
<string name="preference_logging">Localizzazione ed GPS</string>
<string name="customprecisiontime_title">Intervallo in minuti punto targa</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">Intervallo pausa del GPS entro punti.</string>
<string name="customprecisiondistance_title">Distanza in metri punto targa</string>
<string name="customprecisiondistance_summary">Distanza da coprire entro punti.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-iw/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Search tracks</string>
<string name="preference_sharing">Sharing settings</string>
<string name="preference_logging">Logging and GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-jp-rJP/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Search tracks</string>
<string name="preference_sharing">Sharing settings</string>
<string name="preference_logging">Logging and GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Search tracks</string>
<string name="preference_sharing">Sharing settings</string>
<string name="preference_logging">Logging and GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ or PayPal donation are appreciated at [email protected]
<string name="search_hint">Zoek routes</string>
<string name="preference_sharing">Delen instellingen</string>
<string name="preference_logging">Loggen en GPS</string>
<string name="customprecisiontime_title">Doel tijdsinterval in minuten</string>
<string name="customprecisiontime_title">Doel tijdsinterval in seconden</string>
<string name="customprecisiontime_summary">De tijd die de GPS ontvangen kan slapen tussen opname punten.</string>
<string name="customprecisiondistance_title">Doel afstandsinterval in meters</string>
<string name="customprecisiondistance_summary">De afstand die tussen opname punten past.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Szukaj ścieżek</string>
<string name="preference_sharing">Ustawienia udostępniania</string>
<string name="preference_logging">Ustawienia zapisywania i wykorzystania GPS</string>
<string name="customprecisiontime_title">Przedział czasu (w minutach) pomiędzy punktami orientacyjnymi</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">Czas, który powinien upłynąć pomiędzy kolejnymi punktami orientacyjnymi.</string>
<string name="customprecisiondistance_title">Odległość (w metrach) pomiędzy punktami orientacyjnymi</string>
<string name="customprecisiondistance_summary">Odległość, którą należy przebyć pomiędzy kolejnymi punktami orientacyjnymi.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Search tracks</string>
<string name="preference_sharing">Sharing settings</string>
<string name="preference_logging">Logging and GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ http://code.google.com/p/open-gpstracker/issues/entry
<string name="search_hint">Поиск треков</string>
<string name="preference_sharing">Публикация</string>
<string name="preference_logging">Запись и GPS</string>
<string name="customprecisiontime_title">Интервал между точками, минуты</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">Интервал времени между точками трека.</string>
<string name="customprecisiondistance_title">Расстояние между точками, метры</string>
<string name="customprecisiondistance_summary">Расстояние между точками трека.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-sv/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Sök spår</string>
<string name="preference_sharing">Delningsinställningar</string>
<string name="preference_logging">Loggning och GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-tr-rTR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Search tracks</string>
<string name="preference_sharing">Sharing settings</string>
<string name="preference_logging">Logging and GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-vi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<string name="search_hint">Search tracks</string>
<string name="preference_sharing">Sharing settings</string>
<string name="preference_logging">Logging and GPS</string>
<string name="customprecisiontime_title">Target waypoint time interval in minutes</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">The time the GPS receiver should sleep between waypoints.</string>
<string name="customprecisiondistance_title">Target waypoint distance in meters</string>
<string name="customprecisiondistance_summary">The distance that should be covered between waypoints.</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
<string name="search_hint">搜索路线</string>
<string name="preference_sharing">分享设置</string>
<string name="preference_logging">日志和 GPS 使用设置</string>
<string name="customprecisiontime_title">目标陆点的时间间隔,以分钟计</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">在路点之间,GPS 接收器应该休眠的时间。</string>
<string name="customprecisiondistance_title">目标路点的距离,以米计</string>
<string name="customprecisiondistance_summary">路点之间应该覆盖的距离。</string>
Expand Down
2 changes: 1 addition & 1 deletion studio/app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
<string name="search_hint">搜索路線</string>
<string name="preference_sharing">分享設定</string>
<string name="preference_logging">日誌和 GPS 使用設定</string>
<string name="customprecisiontime_title">目標陸點的時間間隔,以分鐘計</string>
<string name="customprecisiontime_title">Target waypoint time interval in seconds</string>
<string name="customprecisiontime_summary">在路點之間,GPS 接收器應該休眠的時間。</string>
<string name="customprecisiondistance_title">目標路點的距離,以米計</string>
<string name="customprecisiondistance_summary">路點之間應該覆寫的距離。</string>
Expand Down
Loading

0 comments on commit 3b5919b

Please sign in to comment.