Added option to leave new message notifications

pull/162/head
M66B 5 years ago
parent ddc282b675
commit e210b19c4a

@ -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));

@ -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();

@ -162,6 +162,31 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNotifyActionsHint" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNotifyRemove"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_notify_remove"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNotifyActionsPro"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvNotifyRemoveHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_notify_remove_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNotifyRemove" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swBiometricsNotify"
android:layout_width="0dp"
@ -170,7 +195,7 @@
android:text="@string/title_advanced_biometrics_notify"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNotifyActionsPro"
app:layout_constraintTop_toBottomOf="@id/tvNotifyRemoveHint"
app:switchPadding="12dp" />
<Button

@ -286,6 +286,7 @@
<string name="title_advanced_notify_action_reply_direct">Direct reply</string>
<string name="title_advanced_notify_action_flag">Star</string>
<string name="title_advanced_notify_action_seen">Read</string>
<string name="title_advanced_notify_remove">Remove new message notification on tapping on notification</string>
<string name="title_advanced_biometrics_notify">Show notification content when using biometric authentication</string>
<string name="title_advanced_light">Use notification light</string>
<string name="title_advanced_sound">Select notification sound</string>
@ -293,6 +294,7 @@
<string name="title_advanced_badge_hint">Only available on supported launchers</string>
<string name="title_advanced_notify_action_hint">At most three actions will be shown</string>
<string name="title_advanced_notify_remove_hint">New message notifications will always be removed on being swiped away and on marking messages read</string>
<string name="title_advanced_notify_manage_hint">Tap on the channel name \'Notifications\' to set the default notification sound, etc</string>
<string name="title_advanced_double_back">Double \'back\' to exit</string>

Loading…
Cancel
Save