Added option to leave new message notifications

This commit is contained in:
M66B
2019-09-17 12:07:14 +02:00
parent ddc282b675
commit e210b19c4a
4 changed files with 45 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private CheckBox cbNotifyActionFlag;
private CheckBox cbNotifyActionSeen;
private TextView tvNotifyActionsPro;
private SwitchCompat swNotifyRemove;
private SwitchCompat swBiometricsNotify;
private Button btnManage;
private TextView tvManageHint;
@@ -73,7 +74,8 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private final static String[] RESET_OPTIONS = new String[]{
"badge", "unseen_ignored",
"notify_preview", "notify_trash", "notify_archive", "notify_reply", "notify_reply_direct", "notify_flag", "notify_seen", "biometrics_notify",
"notify_preview", "notify_trash", "notify_archive", "notify_reply", "notify_reply_direct", "notify_flag", "notify_seen", "notify_remove",
"biometrics_notify",
"light", "sound", "alert_once"
};
@@ -97,6 +99,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
cbNotifyActionFlag = view.findViewById(R.id.cbNotifyActionFlag);
cbNotifyActionSeen = view.findViewById(R.id.cbNotifyActionSeen);
tvNotifyActionsPro = view.findViewById(R.id.tvNotifyActionsPro);
swNotifyRemove = view.findViewById(R.id.swNotifyRemove);
swBiometricsNotify = view.findViewById(R.id.swBiometricsNotify);
btnManage = view.findViewById(R.id.btnManage);
tvManageHint = view.findViewById(R.id.tvManageHint);
@@ -181,6 +184,13 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
Helper.linkPro(tvNotifyActionsPro);
swNotifyRemove.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("notify_remove", checked).apply();
}
});
swBiometricsNotify.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -306,6 +316,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
cbNotifyActionFlag.setEnabled(pro);
cbNotifyActionSeen.setEnabled(pro);
swNotifyRemove.setChecked(prefs.getBoolean("notify_remove", true));
swBiometricsNotify.setChecked(prefs.getBoolean("biometrics_notify", false));
swLight.setChecked(prefs.getBoolean("light", false));

View File

@@ -293,6 +293,11 @@ public class ServiceUI extends IntentService {
}
private void onIgnore(long id) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean notify_remove = prefs.getBoolean("notify_remove", true);
if (!notify_remove)
return;
DB db = DB.getInstance(this);
try {
db.beginTransaction();