Addes swipe snooze action

This commit is contained in:
M66B
2019-10-06 21:01:01 +02:00
parent 619c54cc15
commit 7221131d78
9 changed files with 109 additions and 60 deletions

View File

@@ -28,8 +28,6 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -39,7 +37,6 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
@@ -67,7 +64,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private CheckBox cbNotifyActionFlag;
private CheckBox cbNotifyActionSeen;
private CheckBox cbNotifyActionSnooze;
private EditText etNotifyActionSnooze;
private TextView tvNotifyActionsPro;
private SwitchCompat swBiometricsNotify;
private Button btnManage;
@@ -85,7 +81,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
"badge", "unseen_ignored",
"notify_summary", "notify_remove", "notify_preview",
"notify_trash", "notify_junk", "notify_archive", "notify_reply", "notify_reply_direct",
"notify_flag", "notify_seen", "notify_snooze", "notify_snooze_duration",
"notify_flag", "notify_seen", "notify_snooze",
"biometrics_notify",
"light", "sound", "alert_once"
};
@@ -113,7 +109,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
cbNotifyActionFlag = view.findViewById(R.id.cbNotifyActionFlag);
cbNotifyActionSeen = view.findViewById(R.id.cbNotifyActionSeen);
cbNotifyActionSnooze = view.findViewById(R.id.cbNotifyActionSnooze);
etNotifyActionSnooze = view.findViewById(R.id.etNotifyActionSnooze);
tvNotifyActionsPro = view.findViewById(R.id.tvNotifyActionsPro);
swBiometricsNotify = view.findViewById(R.id.swBiometricsNotify);
btnManage = view.findViewById(R.id.btnManage);
@@ -228,25 +223,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
}
});
etNotifyActionSnooze.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable editable) {
try {
int minutes = Integer.parseInt(editable.toString());
prefs.edit().putInt("notify_snooze_duration", minutes).apply();
} catch (NumberFormatException ex) {
}
}
});
Helper.linkPro(tvNotifyActionsPro);
swBiometricsNotify.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@@ -376,7 +352,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
cbNotifyActionFlag.setChecked(prefs.getBoolean("notify_flag", false) && pro);
cbNotifyActionSeen.setChecked(prefs.getBoolean("notify_seen", true) || !pro);
cbNotifyActionSnooze.setChecked(prefs.getBoolean("notify_snooze", false) || !pro);
etNotifyActionSnooze.setText(Integer.toString(prefs.getInt("notify_snooze_duration", 60)));
swNotifyRemove.setChecked(prefs.getBoolean("notify_remove", true));
swBiometricsNotify.setChecked(prefs.getBoolean("biometrics_notify", false));
@@ -400,7 +375,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
cbNotifyActionFlag.setEnabled(pro && !checked);
cbNotifyActionSeen.setEnabled(pro && !checked);
cbNotifyActionSnooze.setEnabled(pro && !checked);
etNotifyActionSnooze.setEnabled(pro && !checked);
swBiometricsNotify.setEnabled(!checked);
}