Update map settings to display the current value

in the summary text.
This commit is contained in:
Jimmy Shih
2012-09-25 13:06:40 -07:00
parent 40c5d14eb4
commit eb49ee7939
5 changed files with 36 additions and 35 deletions
+5 -5
View File
@@ -1690,8 +1690,8 @@ limitations under the License.
Recording
</string>
<string name="settings_recording_auto_resume_track_timeout_title"
translation_description="In the 'Recording' settings, the title to configure the maximum time
after which a previously recording track will not be resumed after reboot.
translation_description="In the 'Recording' settings, the title to configure resuming a
recording track after reboot.
Character limit: ~23 (1 line)">
Auto-resume
@@ -1699,7 +1699,7 @@ limitations under the License.
<string name="settings_recording_auto_resume_track_timeout_summary"
translation_description="In the 'Recording' settings, the summary for the 'Auto-resume'
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 name="settings_recording_default_activity_title"
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"
translation_description="In the 'Recording' settings, the summary for the 'Max distance'
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 name="settings_recording_min_recording_distance_title"
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"
translation_description="In the 'Recording' settings, the summary for the 'Min distance'
setting.">
GPS location is ignored if the distance since the last recorded location is less than this.
Minimum distance between recorded locations.
</string>
<string name="settings_recording_min_recording_interval_title"
translation_description="In the 'Recording' settings, the title to configure the time between
-3
View File
@@ -18,10 +18,7 @@ limitations under the License.
android:title="@string/track_detail_map_tab" >
<ListPreference
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:summary="@string/settings_map_track_color_mode_summary"
android:title="@string/settings_map_track_color_mode" />
<PreferenceCategory android:title="@string/settings_map_track_color_mode_fixed" >
<EditTextPreference
@@ -39,8 +39,8 @@ public class TrackPathPainterFactory {
* @param context the context
*/
public static TrackPathPainter getTrackPathPainter(Context context) {
String trackColorMode = PreferencesUtils.getString(context, R.string.track_color_mode_key,
context.getString(R.string.settings_map_track_color_mode_single_value));
String trackColorMode = PreferencesUtils.getString(
context, R.string.track_color_mode_key, PreferencesUtils.TRACK_COLOR_MODE_DEFAULT);
Log.i(TAG, "Creating track path painter of type: " + trackColorMode);
if (context.getString(R.string.settings_map_track_color_mode_dynamic_value)
@@ -51,34 +51,34 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
super.onCreate(bundle);
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(
getString(R.string.track_color_mode_key));
trackColorModeListPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
OnPreferenceChangeListener listener = new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
updateUiByTrackColorMode((String) newValue);
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);
mediumEditTextPreference = (EditTextPreference) findPreference(
getString(R.string.settings_map_medium_display_key));
configureSpeedEditTextPreference(R.string.track_color_mode_medium_key);
percentageEditTextPreference = (EditTextPreference) findPreference(
getString(R.string.settings_map_percentage_display_key));
configurePercentageEditTextPreference();
updatePercentageSummary();
configureImeActionDone(slowEditTextPreference);
configureImeActionDone(mediumEditTextPreference);
configureImeActionDone(percentageEditTextPreference);
updateUiByTrackColorMode(trackColorModeListPreference.getValue());
}
/**
@@ -105,6 +105,7 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
return true;
}
});
configureImeActionDone(editTextPreference);
}
/**
@@ -141,6 +142,7 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
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
* units.
* Gets the speed display value, in metric or imperial depending on the
* preferred units.
*
* @param keyId the key id
*/
@@ -256,18 +258,19 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
boolean metric = PreferencesUtils.getBoolean(
this, R.string.metric_units_key, PreferencesUtils.METRIC_UNITS_DEFAULT);
int displayValue = getSpeedDisplayValue(keyId);
editTextPreference.setSummary(getString(metric ? R.string.value_integer_kilometer_hour
: R.string.value_integer_mile_hour, displayValue));
editTextPreference.setSummary(getString(
metric ? R.string.value_integer_kilometer_hour : R.string.value_integer_mile_hour,
displayValue));
}
/**
* Updates the percentage summary.
*/
private void updatePercentageSummary() {
int value = PreferencesUtils.getInt(
MapSettingsActivity.this, R.string.track_color_mode_percentage_key,
int value = PreferencesUtils.getInt(MapSettingsActivity.this,
R.string.track_color_mode_percentage_key,
PreferencesUtils.TRACK_COLOR_MODE_PERCENTAGE_DEFAULT);
percentageEditTextPreference.setSummary(getString(R.string.settings_map_percentage_summary) + "\n"
+ getString(R.string.value_integer_percent, value));
percentageEditTextPreference.setSummary(getString(R.string.settings_map_percentage_summary)
+ "\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_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_PERCENTAGE_DEFAULT = 25;
public static final int TRACK_COLOR_MODE_SLOW_DEFAULT = 9;