forked from upstream-mirrors/OpenTracks
Update map settings to display the current value
in the summary text.
This commit is contained in:
@@ -1690,8 +1690,8 @@ limitations under the License.
|
|||||||
Recording
|
Recording
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_auto_resume_track_timeout_title"
|
<string name="settings_recording_auto_resume_track_timeout_title"
|
||||||
translation_description="In the 'Recording' settings, the title to configure the maximum time
|
translation_description="In the 'Recording' settings, the title to configure resuming a
|
||||||
after which a previously recording track will not be resumed after reboot.
|
recording track after reboot.
|
||||||
|
|
||||||
Character limit: ~23 (1 line)">
|
Character limit: ~23 (1 line)">
|
||||||
Auto-resume
|
Auto-resume
|
||||||
@@ -1699,7 +1699,7 @@ limitations under the License.
|
|||||||
<string name="settings_recording_auto_resume_track_timeout_summary"
|
<string name="settings_recording_auto_resume_track_timeout_summary"
|
||||||
translation_description="In the 'Recording' settings, the summary for the 'Auto-resume'
|
translation_description="In the 'Recording' settings, the summary for the 'Auto-resume'
|
||||||
setting.">
|
setting.">
|
||||||
Maximum time after which a previously recording track will not be resumed after reboot.
|
Track is resumed after reboot if the last recording time is within this.
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_default_activity_title"
|
<string name="settings_recording_default_activity_title"
|
||||||
translation_description="In the 'Recording' settings, the title to configure the default
|
translation_description="In the 'Recording' settings, the title to configure the default
|
||||||
@@ -1723,7 +1723,7 @@ limitations under the License.
|
|||||||
<string name="settings_recording_max_recording_distance_summary"
|
<string name="settings_recording_max_recording_distance_summary"
|
||||||
translation_description="In the 'Recording' settings, the summary for the 'Max distance'
|
translation_description="In the 'Recording' settings, the summary for the 'Max distance'
|
||||||
setting.">
|
setting.">
|
||||||
New segment is created if the distance since the last recorded location is greater than this.
|
Maximum distance between locations in the same segment.
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_min_recording_distance_title"
|
<string name="settings_recording_min_recording_distance_title"
|
||||||
translation_description="In the 'Recording' settings, the title to configure the minimum
|
translation_description="In the 'Recording' settings, the title to configure the minimum
|
||||||
@@ -1735,7 +1735,7 @@ limitations under the License.
|
|||||||
<string name="settings_recording_min_recording_distance_summary"
|
<string name="settings_recording_min_recording_distance_summary"
|
||||||
translation_description="In the 'Recording' settings, the summary for the 'Min distance'
|
translation_description="In the 'Recording' settings, the summary for the 'Min distance'
|
||||||
setting.">
|
setting.">
|
||||||
GPS location is ignored if the distance since the last recorded location is less than this.
|
Minimum distance between recorded locations.
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_min_recording_interval_title"
|
<string name="settings_recording_min_recording_interval_title"
|
||||||
translation_description="In the 'Recording' settings, the title to configure the time between
|
translation_description="In the 'Recording' settings, the title to configure the time between
|
||||||
|
|||||||
@@ -18,10 +18,7 @@ limitations under the License.
|
|||||||
android:title="@string/track_detail_map_tab" >
|
android:title="@string/track_detail_map_tab" >
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="@string/settings_map_track_color_mode_single_value"
|
android:defaultValue="@string/settings_map_track_color_mode_single_value"
|
||||||
android:entries="@array/track_color_mode_options"
|
|
||||||
android:entryValues="@array/track_color_mode_values"
|
|
||||||
android:key="@string/track_color_mode_key"
|
android:key="@string/track_color_mode_key"
|
||||||
android:summary="@string/settings_map_track_color_mode_summary"
|
|
||||||
android:title="@string/settings_map_track_color_mode" />
|
android:title="@string/settings_map_track_color_mode" />
|
||||||
<PreferenceCategory android:title="@string/settings_map_track_color_mode_fixed" >
|
<PreferenceCategory android:title="@string/settings_map_track_color_mode_fixed" >
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ public class TrackPathPainterFactory {
|
|||||||
* @param context the context
|
* @param context the context
|
||||||
*/
|
*/
|
||||||
public static TrackPathPainter getTrackPathPainter(Context context) {
|
public static TrackPathPainter getTrackPathPainter(Context context) {
|
||||||
String trackColorMode = PreferencesUtils.getString(context, R.string.track_color_mode_key,
|
String trackColorMode = PreferencesUtils.getString(
|
||||||
context.getString(R.string.settings_map_track_color_mode_single_value));
|
context, R.string.track_color_mode_key, PreferencesUtils.TRACK_COLOR_MODE_DEFAULT);
|
||||||
Log.i(TAG, "Creating track path painter of type: " + trackColorMode);
|
Log.i(TAG, "Creating track path painter of type: " + trackColorMode);
|
||||||
|
|
||||||
if (context.getString(R.string.settings_map_track_color_mode_dynamic_value)
|
if (context.getString(R.string.settings_map_track_color_mode_dynamic_value)
|
||||||
|
|||||||
@@ -51,34 +51,34 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
|
|||||||
super.onCreate(bundle);
|
super.onCreate(bundle);
|
||||||
addPreferencesFromResource(R.xml.map_settings);
|
addPreferencesFromResource(R.xml.map_settings);
|
||||||
|
|
||||||
|
slowEditTextPreference = (EditTextPreference) findPreference(
|
||||||
|
getString(R.string.settings_map_slow_display_key));
|
||||||
|
mediumEditTextPreference = (EditTextPreference) findPreference(
|
||||||
|
getString(R.string.settings_map_medium_display_key));
|
||||||
|
percentageEditTextPreference = (EditTextPreference) findPreference(
|
||||||
|
getString(R.string.settings_map_percentage_display_key));
|
||||||
|
|
||||||
ListPreference trackColorModeListPreference = (ListPreference) findPreference(
|
ListPreference trackColorModeListPreference = (ListPreference) findPreference(
|
||||||
getString(R.string.track_color_mode_key));
|
getString(R.string.track_color_mode_key));
|
||||||
trackColorModeListPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
OnPreferenceChangeListener listener = new OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
updateUiByTrackColorMode((String) newValue);
|
updateUiByTrackColorMode((String) newValue);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
String trackColorModeValue = PreferencesUtils.getString(
|
||||||
|
this, R.string.track_color_mode_key, PreferencesUtils.TRACK_COLOR_MODE_DEFAULT);
|
||||||
|
configurePreference(trackColorModeListPreference,
|
||||||
|
getResources().getStringArray(R.array.track_color_mode_options),
|
||||||
|
getResources().getStringArray(R.array.track_color_mode_values),
|
||||||
|
R.string.settings_map_track_color_mode_summary, trackColorModeValue, listener);
|
||||||
|
|
||||||
slowEditTextPreference = (EditTextPreference) findPreference(
|
|
||||||
getString(R.string.settings_map_slow_display_key));
|
|
||||||
configureSpeedEditTextPreference(R.string.track_color_mode_slow_key);
|
configureSpeedEditTextPreference(R.string.track_color_mode_slow_key);
|
||||||
|
|
||||||
mediumEditTextPreference = (EditTextPreference) findPreference(
|
|
||||||
getString(R.string.settings_map_medium_display_key));
|
|
||||||
configureSpeedEditTextPreference(R.string.track_color_mode_medium_key);
|
configureSpeedEditTextPreference(R.string.track_color_mode_medium_key);
|
||||||
|
|
||||||
percentageEditTextPreference = (EditTextPreference) findPreference(
|
|
||||||
getString(R.string.settings_map_percentage_display_key));
|
|
||||||
configurePercentageEditTextPreference();
|
configurePercentageEditTextPreference();
|
||||||
|
|
||||||
updatePercentageSummary();
|
updatePercentageSummary();
|
||||||
|
|
||||||
configureImeActionDone(slowEditTextPreference);
|
|
||||||
configureImeActionDone(mediumEditTextPreference);
|
|
||||||
configureImeActionDone(percentageEditTextPreference);
|
|
||||||
|
|
||||||
updateUiByTrackColorMode(trackColorModeListPreference.getValue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -105,6 +105,7 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
configureImeActionDone(editTextPreference);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,6 +142,7 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
configureImeActionDone(percentageEditTextPreference);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -229,8 +231,8 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the speed display value, in metric or imperial depending on the preferred
|
* Gets the speed display value, in metric or imperial depending on the
|
||||||
* units.
|
* preferred units.
|
||||||
*
|
*
|
||||||
* @param keyId the key id
|
* @param keyId the key id
|
||||||
*/
|
*/
|
||||||
@@ -256,18 +258,19 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
|
|||||||
boolean metric = PreferencesUtils.getBoolean(
|
boolean metric = PreferencesUtils.getBoolean(
|
||||||
this, R.string.metric_units_key, PreferencesUtils.METRIC_UNITS_DEFAULT);
|
this, R.string.metric_units_key, PreferencesUtils.METRIC_UNITS_DEFAULT);
|
||||||
int displayValue = getSpeedDisplayValue(keyId);
|
int displayValue = getSpeedDisplayValue(keyId);
|
||||||
editTextPreference.setSummary(getString(metric ? R.string.value_integer_kilometer_hour
|
editTextPreference.setSummary(getString(
|
||||||
: R.string.value_integer_mile_hour, displayValue));
|
metric ? R.string.value_integer_kilometer_hour : R.string.value_integer_mile_hour,
|
||||||
|
displayValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the percentage summary.
|
* Updates the percentage summary.
|
||||||
*/
|
*/
|
||||||
private void updatePercentageSummary() {
|
private void updatePercentageSummary() {
|
||||||
int value = PreferencesUtils.getInt(
|
int value = PreferencesUtils.getInt(MapSettingsActivity.this,
|
||||||
MapSettingsActivity.this, R.string.track_color_mode_percentage_key,
|
R.string.track_color_mode_percentage_key,
|
||||||
PreferencesUtils.TRACK_COLOR_MODE_PERCENTAGE_DEFAULT);
|
PreferencesUtils.TRACK_COLOR_MODE_PERCENTAGE_DEFAULT);
|
||||||
percentageEditTextPreference.setSummary(getString(R.string.settings_map_percentage_summary) + "\n"
|
percentageEditTextPreference.setSummary(getString(R.string.settings_map_percentage_summary)
|
||||||
+ getString(R.string.value_integer_percent, value));
|
+ "\n" + getString(R.string.value_integer_percent, value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ public class PreferencesUtils {
|
|||||||
public static final boolean STATS_SHOW_GRADE_DEFAULT = false;
|
public static final boolean STATS_SHOW_GRADE_DEFAULT = false;
|
||||||
public static final boolean STATS_SHOW_MOVING_TIME_DEFAULT = false;
|
public static final boolean STATS_SHOW_MOVING_TIME_DEFAULT = false;
|
||||||
|
|
||||||
|
public static final String TRACK_COLOR_MODE_DEFAULT = "SINGLE";
|
||||||
public static final int TRACK_COLOR_MODE_MEDIUM_DEFAULT = 15;
|
public static final int TRACK_COLOR_MODE_MEDIUM_DEFAULT = 15;
|
||||||
public static final int TRACK_COLOR_MODE_PERCENTAGE_DEFAULT = 25;
|
public static final int TRACK_COLOR_MODE_PERCENTAGE_DEFAULT = 25;
|
||||||
public static final int TRACK_COLOR_MODE_SLOW_DEFAULT = 9;
|
public static final int TRACK_COLOR_MODE_SLOW_DEFAULT = 9;
|
||||||
|
|||||||
Reference in New Issue
Block a user