forked from upstream-mirrors/OpenTracks
Fix hack to update summary of statsRate if statsUnit change.
This commit is contained in:
@@ -189,9 +189,11 @@ public class SettingsActivity extends AppCompatActivity implements ChooseActivit
|
|||||||
final ListPreference statsRatePreferences = findPreference(getString(R.string.stats_rate_key));
|
final ListPreference statsRatePreferences = findPreference(getString(R.string.stats_rate_key));
|
||||||
String[] options = getResources().getStringArray(metricUnits ? R.array.stats_rate_metric_options : R.array.stats_rate_imperial_options);
|
String[] options = getResources().getStringArray(metricUnits ? R.array.stats_rate_metric_options : R.array.stats_rate_imperial_options);
|
||||||
statsRatePreferences.setEntries(options);
|
statsRatePreferences.setEntries(options);
|
||||||
//TODO This is a hack!!! Need to manually updated the summary as otherwise it will only be updated after scrolling down and up again (bring the object out of view).
|
|
||||||
//Check if this is still needed after upgraded PreferenceFragment.
|
//TODO This is a hack!!! (Alternative bring the object out of view).
|
||||||
statsRatePreferences.setSummary(statsRatePreferences.getEntry());
|
//Need to trigger androidx.preference.preferences.notifyChanged() to trigger a redraw, but method is protected.
|
||||||
|
statsRatePreferences.setEnabled(false);
|
||||||
|
statsRatePreferences.setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user