Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Past Reminder Fix #993

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
package it.feio.android.omninotes.utils.date;

import android.os.Bundle;

import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
import com.appeaser.sublimepickerlibrary.datepicker.SelectedDate;
import com.appeaser.sublimepickerlibrary.helpers.SublimeOptions;
import com.appeaser.sublimepickerlibrary.recurrencepicker.SublimeRecurrencePicker;
import com.google.android.material.snackbar.Snackbar;

import it.feio.android.omninotes.R;
import it.feio.android.omninotes.helpers.date.RecurrenceHelper;
import it.feio.android.omninotes.models.listeners.OnReminderPickedListener;
import java.util.Calendar;
Expand Down Expand Up @@ -62,11 +66,14 @@ public void onDateTimeRecurrenceSet(SelectedDate selectedDate, int hourOfDay, in
Calendar reminder = selectedDate.getFirstDate();
reminder.set(Calendar.HOUR_OF_DAY, hourOfDay);
reminder.set(Calendar.MINUTE, minute);
if (reminder.getTimeInMillis() < System.currentTimeMillis()) {
Snackbar.make(mActivity.findViewById(android.R.id.content),mActivity.getString(R.string.past_reminder_set), Snackbar.LENGTH_LONG).show();
return;
}

mOnReminderPickedListener.onReminderPicked(reminder.getTimeInMillis());
mOnReminderPickedListener.onRecurrenceReminderPicked(
RecurrenceHelper
.buildRecurrenceRuleByRecurrenceOptionAndRule(recurrenceOption, recurrenceRule));
RecurrenceHelper.buildRecurrenceRuleByRecurrenceOptionAndRule(recurrenceOption, recurrenceRule));
}
});

Expand All @@ -91,5 +98,4 @@ public void onDateTimeRecurrenceSet(SelectedDate selectedDate, int hourOfDay, in
pickerFrag.setStyle(DialogFragment.STYLE_NO_TITLE, 0);
pickerFrag.show(mActivity.getSupportFragmentManager(), "SUBLIME_PICKER");
}

}
1 change: 1 addition & 0 deletions omniNotes/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
<string name="nothing_selected">Nothing selected</string>
<string name="insecure_content_found">Some of the received content was dangerous, it has been ignored</string>
<string name="denied_notifications_permission">Denying notification permission reminders will not be shown</string>
<string name="past_reminder_set">Cannot set reminder in past</string>

<!-- Settings -->
<string name="dashclock_description">Displays some statistics and expiring reminders from Omni Notes</string>
Expand Down
Loading