1package eu.siacs.conversations.ui.fragment.settings;
2
3import android.os.Bundle;
4
5import androidx.annotation.NonNull;
6import androidx.annotation.Nullable;
7
8import eu.siacs.conversations.AppSettings;
9import eu.siacs.conversations.R;
10
11public class PrivacySettingsFragment extends XmppPreferenceFragment {
12
13 @Override
14 public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) {
15 setPreferencesFromResource(R.xml.preferences_privacy, rootKey);
16 }
17
18 @Override
19 protected void onSharedPreferenceChanged(@NonNull String key) {
20 super.onSharedPreferenceChanged(key);
21 switch (key) {
22 case AppSettings.AWAY_WHEN_SCREEN_IS_OFF, AppSettings.MANUALLY_CHANGE_PRESENCE -> {
23 requireService().toggleScreenEventReceiver();
24 requireService().refreshAllPresences();
25 }
26 case AppSettings.CONFIRM_MESSAGES,
27 AppSettings.BROADCAST_LAST_ACTIVITY,
28 AppSettings.ALLOW_MESSAGE_CORRECTION,
29 AppSettings.DND_ON_SILENT_MODE,
30 AppSettings.TREAT_VIBRATE_AS_SILENT -> {
31 requireService().refreshAllPresences();
32 }
33 }
34 }
35
36 @Override
37 public void onStart() {
38 super.onStart();
39 requireActivity().setTitle(R.string.pref_privacy);
40 }
41}