Skip to content

Commit

Permalink
Merge pull request #993 from eren8204/pastReminderFix
Browse files Browse the repository at this point in the history
Past Reminder Fix
  • Loading branch information
federicoiosue authored Oct 7, 2024
2 parents a55d5e5 + 3a43348 commit b53e9bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
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

0 comments on commit b53e9bd

Please sign in to comment.