mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
Fix comment on 9399fc25c7ce.
Also define the default values in "do_not_translate.xml" so that can be consistent between the preferences.xml and the java files.
This commit is contained in:
@@ -22,6 +22,9 @@ limitations under the License.
|
||||
<string name="about_leif">Leif Wilden</string>
|
||||
<string name="about_rodrigo">Rodrigo Damazio</string>
|
||||
<string name="about_sandor">Sandor Dornbush</string>
|
||||
<string name="color_mode_dynamic_percentage_default">25</string>
|
||||
<string name="color_mode_fixed_medium_default">15</string>
|
||||
<string name="color_mode_fixed_slow_default">9</string>
|
||||
<string name="display_track_color_value_dynamic">DYNAMIC</string>
|
||||
<string name="display_track_color_value_fixed">FIXED</string>
|
||||
<string name="display_track_color_value_none">NONE</string>
|
||||
|
||||
@@ -32,7 +32,7 @@ limitations under the License.
|
||||
android:summaryOn="@string/settings_display_speed_summary_on"
|
||||
android:summaryOff="@string/settings_display_speed_summary_off"
|
||||
android:defaultValue="true" />
|
||||
|
||||
|
||||
<ListPreference android:key="@string/track_color_mode_key"
|
||||
android:title="@string/settings_display_track_color"
|
||||
android:summary="@string/settings_display_track_color_summary"
|
||||
@@ -40,46 +40,46 @@ limitations under the License.
|
||||
android:entryValues="@array/display_track_color_values"
|
||||
android:defaultValue="@string/display_track_color_value_none"/>
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_display_track_color_fixed"
|
||||
<PreferenceCategory android:title="@string/settings_display_track_color_fixed"
|
||||
android:key="@string/track_color_mode_fixed_speed_options_key">
|
||||
<EditTextPreference android:key="@string/track_color_mode_fixed_speed_slow_key"
|
||||
android:title="@string/settings_display_track_color_fixed_slow"
|
||||
android:summary="@string/settings_display_track_color_fixed_slow_summary"
|
||||
android:defaultValue="9"
|
||||
<EditTextPreference android:key="@string/track_color_mode_fixed_speed_slow_key"
|
||||
android:title="@string/settings_display_track_color_fixed_slow"
|
||||
android:summary="@string/settings_display_track_color_fixed_slow_summary"
|
||||
android:defaultValue="@string/color_mode_fixed_slow_default"
|
||||
android:inputType="number"
|
||||
android:maxLength="3">
|
||||
</EditTextPreference>
|
||||
|
||||
<EditTextPreference android:key="@string/track_color_mode_fixed_speed_slow_display_key"
|
||||
android:title="@string/settings_display_track_color_fixed_slow"
|
||||
android:summary="@string/settings_display_track_color_fixed_slow_summary"
|
||||
android:defaultValue="9"
|
||||
|
||||
<EditTextPreference android:key="@string/track_color_mode_fixed_speed_slow_display_key"
|
||||
android:title="@string/settings_display_track_color_fixed_slow"
|
||||
android:summary="@string/settings_display_track_color_fixed_slow_summary"
|
||||
android:defaultValue="@string/color_mode_fixed_slow_default"
|
||||
android:inputType="number"
|
||||
android:maxLength="3">
|
||||
</EditTextPreference>
|
||||
|
||||
<EditTextPreference android:key="@string/track_color_mode_fixed_speed_medium_key"
|
||||
android:title="@string/settings_display_track_color_fixed_medium"
|
||||
android:summary="@string/settings_display_track_color_fixed_medium_summary"
|
||||
android:defaultValue="15"
|
||||
|
||||
<EditTextPreference android:key="@string/track_color_mode_fixed_speed_medium_key"
|
||||
android:title="@string/settings_display_track_color_fixed_medium"
|
||||
android:summary="@string/settings_display_track_color_fixed_medium_summary"
|
||||
android:defaultValue="@string/color_mode_fixed_medium_default"
|
||||
android:inputType="number"
|
||||
android:maxLength="3">
|
||||
</EditTextPreference>
|
||||
|
||||
<EditTextPreference android:key="@string/track_color_mode_fixed_speed_medium_display_key"
|
||||
android:title="@string/settings_display_track_color_fixed_medium"
|
||||
android:summary="@string/settings_display_track_color_fixed_medium_summary"
|
||||
android:defaultValue="15"
|
||||
|
||||
<EditTextPreference android:key="@string/track_color_mode_fixed_speed_medium_display_key"
|
||||
android:title="@string/settings_display_track_color_fixed_medium"
|
||||
android:summary="@string/settings_display_track_color_fixed_medium_summary"
|
||||
android:defaultValue="@string/color_mode_fixed_medium_default"
|
||||
android:inputType="number"
|
||||
android:maxLength="3">
|
||||
</EditTextPreference>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_display_track_color_dynamic">
|
||||
<EditTextPreference android:key="@string/track_color_mode_dynamic_speed_variation_key"
|
||||
android:title="@string/settings_display_track_color_dynamic_medium"
|
||||
android:summary="@string/settings_display_track_color_dynamic_medium_summary"
|
||||
android:defaultValue="25"
|
||||
<EditTextPreference android:key="@string/track_color_mode_dynamic_speed_variation_key"
|
||||
android:title="@string/settings_display_track_color_dynamic_medium"
|
||||
android:summary="@string/settings_display_track_color_dynamic_medium_summary"
|
||||
android:defaultValue="@string/color_mode_dynamic_percentage_default"
|
||||
android:inputType="number"
|
||||
android:maxLength="2">
|
||||
</EditTextPreference>
|
||||
@@ -143,7 +143,7 @@ limitations under the License.
|
||||
android:summaryOn="@string/settings_recording_name_summary_on"
|
||||
android:summaryOff="@string/settings_recording_name_summary_off"
|
||||
android:defaultValue="true" />
|
||||
|
||||
|
||||
<com.google.android.apps.mytracks.AutoCompleteTextPreference
|
||||
android:key="@string/default_activity_key"
|
||||
android:title="@string/settings_recording_default_activity"
|
||||
|
||||
+11
-9
@@ -37,21 +37,22 @@ import android.util.Log;
|
||||
public class DynamicSpeedTrackPathDescriptor
|
||||
implements TrackPathDescriptor, OnSharedPreferenceChangeListener {
|
||||
|
||||
private static int DEFAULT_SPEED_MARGIN = 25;
|
||||
|
||||
private int slowSpeed;
|
||||
private int normalSpeed;
|
||||
private int speedMargin;
|
||||
private final int speedMarginDefault;
|
||||
private double averageMovingSpeed;
|
||||
private final Context context;
|
||||
|
||||
public DynamicSpeedTrackPathDescriptor(Context context){
|
||||
this.context = context;
|
||||
speedMarginDefault = Integer.parseInt(
|
||||
context.getString(R.string.color_mode_dynamic_percentage_default));
|
||||
SharedPreferences prefs = context.getSharedPreferences(
|
||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
|
||||
if (prefs == null) {
|
||||
speedMargin = DEFAULT_SPEED_MARGIN;
|
||||
speedMargin = speedMarginDefault;
|
||||
return;
|
||||
}
|
||||
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||
@@ -60,12 +61,13 @@ public class DynamicSpeedTrackPathDescriptor
|
||||
}
|
||||
|
||||
private int getSpeedMargin(SharedPreferences sharedPreferences) {
|
||||
String key = context.getString(R.string.track_color_mode_dynamic_speed_variation_key);
|
||||
String percentage = sharedPreferences.getString(key, DEFAULT_SPEED_MARGIN + "");
|
||||
if (percentage.isEmpty()) {
|
||||
return DEFAULT_SPEED_MARGIN;
|
||||
try {
|
||||
return Integer.parseInt(sharedPreferences.getString(
|
||||
context.getString(R.string.track_color_mode_dynamic_speed_variation_key),
|
||||
speedMarginDefault + ""));
|
||||
} catch (NumberFormatException e) {
|
||||
return speedMarginDefault;
|
||||
}
|
||||
return Integer.parseInt(percentage);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +101,7 @@ public class DynamicSpeedTrackPathDescriptor
|
||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
|
||||
if (prefs == null) {
|
||||
speedMargin = DEFAULT_SPEED_MARGIN;
|
||||
speedMargin = speedMarginDefault;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+17
-12
@@ -34,32 +34,37 @@ import android.util.Log;
|
||||
public class FixedSpeedTrackPathDescriptor implements TrackPathDescriptor, OnSharedPreferenceChangeListener {
|
||||
private int slowSpeed;
|
||||
private int normalSpeed;
|
||||
private final int slowDefault;
|
||||
private final int normalDefault;
|
||||
private final Context context;
|
||||
|
||||
public FixedSpeedTrackPathDescriptor(Context context) {
|
||||
|
||||
this.context = context;
|
||||
slowDefault = Integer.parseInt(context.getString(R.string.color_mode_fixed_slow_default));
|
||||
normalDefault = Integer.parseInt(context.getString(R.string.color_mode_fixed_medium_default));
|
||||
|
||||
SharedPreferences prefs = context.getSharedPreferences(
|
||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
if (prefs == null) {
|
||||
slowSpeed = 9;
|
||||
normalSpeed = 17;
|
||||
slowSpeed = slowDefault;
|
||||
normalSpeed = normalDefault;
|
||||
return;
|
||||
}
|
||||
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
try {
|
||||
slowSpeed = Integer.parseInt(prefs.getString(context.getString(
|
||||
R.string.track_color_mode_fixed_speed_slow_key), "9"));
|
||||
R.string.track_color_mode_fixed_speed_slow_key), slowDefault + ""));
|
||||
} catch (NumberFormatException e) {
|
||||
slowSpeed = 9;
|
||||
slowSpeed = slowDefault;
|
||||
}
|
||||
|
||||
try {
|
||||
normalSpeed = Integer.parseInt(prefs.getString(context.getString(
|
||||
R.string.track_color_mode_fixed_speed_medium_key), "17"));
|
||||
R.string.track_color_mode_fixed_speed_medium_key), normalDefault + ""));
|
||||
} catch (NumberFormatException e) {
|
||||
normalSpeed = 17;
|
||||
normalSpeed = normalDefault;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,22 +95,22 @@ public class FixedSpeedTrackPathDescriptor implements TrackPathDescriptor, OnSha
|
||||
SharedPreferences prefs = context.getSharedPreferences(
|
||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
if (prefs == null) {
|
||||
slowSpeed = 9;
|
||||
normalSpeed = 17;
|
||||
slowSpeed = slowDefault;
|
||||
normalSpeed = normalDefault;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
slowSpeed = Integer.parseInt(prefs.getString(context.getString(
|
||||
R.string.track_color_mode_fixed_speed_slow_key), "9"));
|
||||
R.string.track_color_mode_fixed_speed_slow_key), slowDefault + ""));
|
||||
} catch (NumberFormatException e) {
|
||||
slowSpeed = 9;
|
||||
slowSpeed = slowDefault;
|
||||
}
|
||||
try {
|
||||
normalSpeed = Integer.parseInt(prefs.getString(context.getString(
|
||||
R.string.track_color_mode_fixed_speed_medium_key), "17"));
|
||||
R.string.track_color_mode_fixed_speed_medium_key), normalDefault + ""));
|
||||
} catch (NumberFormatException e) {
|
||||
normalSpeed = 17;
|
||||
normalSpeed = normalDefault;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user