mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-11 05:23:07 +02:00
Fix an issue that the weight value unit is wrong when show the weight edit dialog after changing unit.
This commit is contained in:
@@ -74,6 +74,7 @@ public class StatsSettingsActivity extends AbstractSettingsActivity {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
ListPreference listPreference = (ListPreference) findPreference(getString(R.string.stats_units_key));
|
ListPreference listPreference = (ListPreference) findPreference(getString(R.string.stats_units_key));
|
||||||
OnPreferenceChangeListener listener = new OnPreferenceChangeListener() {
|
OnPreferenceChangeListener listener = new OnPreferenceChangeListener() {
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference pref, Object newValue) {
|
public boolean onPreferenceChange(Preference pref, Object newValue) {
|
||||||
configRateListPreference(PreferencesUtils.STATS_UNITS_DEFAULT.equals((String) newValue));
|
configRateListPreference(PreferencesUtils.STATS_UNITS_DEFAULT.equals((String) newValue));
|
||||||
@@ -83,6 +84,10 @@ public class StatsSettingsActivity extends AbstractSettingsActivity {
|
|||||||
* activity.
|
* activity.
|
||||||
*/
|
*/
|
||||||
updateWeightSummary(PreferencesUtils.STATS_UNITS_DEFAULT.equals((String) newValue));
|
updateWeightSummary(PreferencesUtils.STATS_UNITS_DEFAULT.equals((String) newValue));
|
||||||
|
// Recreate weight value dialog.
|
||||||
|
removeDialog(WEIGHT_INPUT_DIALOG);
|
||||||
|
onCreateDialog(WEIGHT_INPUT_DIALOG);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -134,7 +139,8 @@ public class StatsSettingsActivity extends AbstractSettingsActivity {
|
|||||||
case WEIGHT_INPUT_DIALOG:
|
case WEIGHT_INPUT_DIALOG:
|
||||||
final EditText weightInput = new EditText(this);
|
final EditText weightInput = new EditText(this);
|
||||||
weightInput.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
weightInput.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
||||||
weightInput.setText(Integer.toString(PreferencesUtils.STATS_WEIGHT_DEFAULT));
|
weightInput.setText(Integer.toString(getWeightDisplayValue(PreferencesUtils
|
||||||
|
.isMetricUnits(getApplicationContext()))));
|
||||||
weightInput.setSelectAllOnFocus(true);
|
weightInput.setSelectAllOnFocus(true);
|
||||||
dialog = (new AlertDialog.Builder(this))
|
dialog = (new AlertDialog.Builder(this))
|
||||||
.setMessage(R.string.settings_stats_calorie_weight_description)
|
.setMessage(R.string.settings_stats_calorie_weight_description)
|
||||||
|
|||||||
Reference in New Issue
Block a user