mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-26 15:40:59 +01:00
Small improvements
This commit is contained in:
@@ -40,7 +40,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
|
||||
public class FragmentOptions extends FragmentEx {
|
||||
public class FragmentOptions extends FragmentEx implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private SwitchCompat swEnabled;
|
||||
private SwitchCompat swAvatars;
|
||||
private SwitchCompat swIdenticons;
|
||||
@@ -233,6 +233,20 @@ public class FragmentOptions extends FragmentEx {
|
||||
|
||||
swLight.setVisibility(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O ? View.VISIBLE : View.GONE);
|
||||
|
||||
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
||||
if ("enabled".equals(key))
|
||||
swEnabled.setChecked(prefs.getBoolean(key, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
PreferenceManager.getDefaultSharedPreferences(getContext()).unregisterOnSharedPreferenceChangeListener(this);
|
||||
super.onDestroyView();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user