Added mark read option to snooze rule

pull/167/head
M66B 6 years ago
parent 8e8b947b99
commit 0fd0aba645

@ -454,6 +454,7 @@ public class EntityRule {
private boolean onActionSnooze(Context context, EntityMessage message, JSONObject jargs) throws JSONException { private boolean onActionSnooze(Context context, EntityMessage message, JSONObject jargs) throws JSONException {
int duration = jargs.getInt("duration"); int duration = jargs.getInt("duration");
boolean schedule_end = jargs.optBoolean("schedule_end", false); boolean schedule_end = jargs.optBoolean("schedule_end", false);
boolean seen = jargs.optBoolean("seen", false);
long wakeup; long wakeup;
if (schedule_end) { if (schedule_end) {
@ -476,6 +477,9 @@ public class EntityRule {
message.ui_snoozed = wakeup; message.ui_snoozed = wakeup;
if (seen)
onActionSeen(context, message, true);
return true; return true;
} }

@ -112,6 +112,7 @@ public class FragmentRule extends FragmentBase {
private NumberPicker npDuration; private NumberPicker npDuration;
private CheckBox cbScheduleEnd; private CheckBox cbScheduleEnd;
private CheckBox cbSnoozeSeen;
private ViewButtonColor btnColor; private ViewButtonColor btnColor;
@ -218,6 +219,7 @@ public class FragmentRule extends FragmentBase {
npDuration = view.findViewById(R.id.npDuration); npDuration = view.findViewById(R.id.npDuration);
cbScheduleEnd = view.findViewById(R.id.cbScheduleEnd); cbScheduleEnd = view.findViewById(R.id.cbScheduleEnd);
cbSnoozeSeen = view.findViewById(R.id.cbSnoozeSeen);
btnColor = view.findViewById(R.id.btnColor); btnColor = view.findViewById(R.id.btnColor);
@ -676,6 +678,7 @@ public class FragmentRule extends FragmentBase {
case EntityRule.TYPE_SNOOZE: case EntityRule.TYPE_SNOOZE:
npDuration.setValue(jaction.optInt("duration", 0)); npDuration.setValue(jaction.optInt("duration", 0));
cbScheduleEnd.setChecked(jaction.optBoolean("schedule_end", false)); cbScheduleEnd.setChecked(jaction.optBoolean("schedule_end", false));
cbSnoozeSeen.setChecked(jaction.optBoolean("seen", false));
break; break;
case EntityRule.TYPE_FLAG: case EntityRule.TYPE_FLAG:
@ -969,6 +972,7 @@ public class FragmentRule extends FragmentBase {
case EntityRule.TYPE_SNOOZE: case EntityRule.TYPE_SNOOZE:
jaction.put("duration", npDuration.getValue()); jaction.put("duration", npDuration.getValue());
jaction.put("schedule_end", cbScheduleEnd.isChecked()); jaction.put("schedule_end", cbScheduleEnd.isChecked());
jaction.put("seen", cbSnoozeSeen.isChecked());
break; break;
case EntityRule.TYPE_FLAG: case EntityRule.TYPE_FLAG:

@ -514,6 +514,15 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/npDuration" /> app:layout_constraintTop_toBottomOf="@id/npDuration" />
<CheckBox
android:id="@+id/cbSnoozeSeen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_rule_seen"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbScheduleEnd" />
<TextView <TextView
android:id="@+id/tvColor" android:id="@+id/tvColor"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -522,7 +531,7 @@
android:text="@string/title_color" android:text="@string/title_color"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbScheduleEnd" /> app:layout_constraintTop_toBottomOf="@id/cbSnoozeSeen" />
<eu.faircode.email.ViewButtonColor <eu.faircode.email.ViewButtonColor
android:id="@+id/btnColor" android:id="@+id/btnColor"
@ -667,7 +676,7 @@
android:id="@+id/grpSnooze" android:id="@+id/grpSnooze"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
app:constraint_referenced_ids="tvHours,npDuration,cbScheduleEnd" /> app:constraint_referenced_ids="tvHours,npDuration,cbScheduleEnd,cbSnoozeSeen" />
<androidx.constraintlayout.widget.Group <androidx.constraintlayout.widget.Group
android:id="@+id/grpFlag" android:id="@+id/grpFlag"

Loading…
Cancel
Save