1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-29 19:20:36 +02:00

Merge pull request #200 from erijo/unregister

Add missing listener unregister
This commit is contained in:
OliE
2018-02-22 21:13:20 +01:00
committed by GitHub

View File

@@ -213,12 +213,18 @@ public class MeasurementPreferences extends PreferenceFragment implements Shared
getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
} }
@Override
public void onPause() {
getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
super.onPause();
}
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
updatePrefSummary(findPreference(key)); updatePrefSummary(findPreference(key));
if (!key.equals(MeasurementView.PREF_MEASUREMENT_ORDER)) { if (!key.equals(MeasurementView.PREF_MEASUREMENT_ORDER)) {
measurementOrderCategory.removeAll(); measurementOrderCategory.removeAll();
updateMeasurementOrderScreen(getContext(), measurementOrderCategory); updateMeasurementOrderScreen(getActivity().getApplicationContext(), measurementOrderCategory);
} }
} }