-
-
Notifications
You must be signed in to change notification settings - Fork 36
Feature/alarm for specific date #367
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
base: main
Are you sure you want to change the base?
Feature/alarm for specific date #367
Conversation
Moved alarm days holder below new component Referenced newly added string select_specific_date to layout
…ckward compatibility updated isRecurring, isToday and isTomorrow to factor in specific dates being set added a function to get date labels so even if the alarm is set for a specific date, e.g. if that date happens to be tomorrow, it will show as tomorrow. added date formatting functions to show the data if it's set for longer than a week away (more intuitive to show the day when the alarm is set for the same week). added functions to handle checking if specific calendar dates are today or tomorrow (also added edge cases handling for difference in years
Added specific date column Updated DB_Version since the data structure is changing Added COL_SPECIFIC_DATA element to ALARM TABLE respecting code line width restrictions (Added on new line) Added secondary DB upgrade for adding in specific dates if missing when users upgrade to new version Filling date inside alarm content values Added retrieval of specific date (if present else null) in getAlarms DB query and populated Alarm object
Added check to updateNonRecurringAlarm, as specific date alarms should not be updated. Added handling of specific data alarms to getTimeOfNextAlarm so it's handled before existing standard alarm logic
Applying color Filters to layouts for Calendar Icon, Clear Date Buotton and Date Selector Panel Call update function to ensure alarm dates are correctly updated when dialogue is initialised Specific Date alarms are "dayless" so added check in function, updating label text accordingly using utility function. Added date picker function that opens a DatePickerDialog from android package.
… activity as context to extract translations. Ensuring utility function getDateLabel handles today, tomorrow, specific dates and recurring alarms. If none of those criteria are met then an error should be thrown. This is not a valid state.
…ve translated text
|
@naveensingh @tswistak Just wanted to clarify - issue #42 is unassigned and already triaged. It's been open since March 2024 with multiple users requesting this feature. This is a complete implementation (not a draft) with no AI-generated comment spam, just straightforward code following existing patterns. I followed the contribution guidelines including updating the CHANGELOG, following code formatting style, and vector naming conventions (ic_calendar_vector with proper prefix). Tested on multiple font sizes, verified database migration works, confirmed alarms persist and trigger correctly (checked with adb shell dumpsys alarm to verify system-level scheduling), and included screenshots for both dark/light modes. Caught and fixed a few bugs during testing like the missing DB column in the query and some compilation errors. I see some minor linting errors in the build pipeline. I will try to correct these ASAP. Update: Fixed Happy to make changes if there are specific concerns with the implementation. |
Created DB_VERSION constants to represent versions and avoid using magic numbers Created companion object associated with Alarm model to store numbers used in Data calculations
Type of change(s)
What changed and why
What I Built:
Added ability to set alarms for specific dates instead of just recurring weekdays. This was requested in issue #42 - users wanted to set an alarm for like "March 15th" without having to set it for every Tuesday until then or remember to manually create it the night before.
Main stuff added:
Date picker to choose a specific date from a calendar
Shows "Today", "Tomorrow", or the actual date depending on when it is
Clear button to remove the date if you change your mind
Saves the date to database properly
Works with all the existing translations
How I Built It
Put select_specific_date in strings.xml so it can be translated
Note: This new string will need to be translated to all the supported languages (only added English version for now)
Added calendar icon (had to follow the naming rules - ic_calendar_vector)
Created the date selector row in the alarm edit screen with icon, label, and clear button
Put it right below where the alarm time shows
Added specificDate: Long? field to store the timestamp
Changed isRecurring() so alarms with specific dates aren't considerd recurring
Updated isToday() and isTomorrow() to check timestamps too
Made getDateLabel(context) to show the right text - handles Today, Tomorrow, day names, or full dates
Added some helper functions for date formatting
Added COL_SPECIFIC_DATE column in DBHelper
Bumped DB version to 3
Added migration for users upgrading from older versions
Updated the code that saves alarms to include the date
Fixed the query to actually retreive the specific date (missed this at first!)
Made updateNonRecurringAlarmDay() skip specific date alarms since they shouldn't be updated
Changed getTimeOfNextAlarm() to handle specific dates before the normal logic
Used Android's DatePickerDialog in EditAlarmDialog
Applied the right colors to match the theme
Made the clear button work
Updated the "dayless alarm" check to include specific dates
Made sure the UI updates when you pick or clear a date
Changed AlarmsAdapter to use getDateLabel(context) instead of just always saying "tomorrow"
Made sure it uses the proper translation strings from commons
Added error throw for invalid states (shouldnt happen but better than showing wrong info)
Forgot to include COL_SPECIFIC_DATE in the query columns - dates werent persisting!
Had an extra } bracket in DBHelper that broke compilation
Had to update everywhere getDateLabel() was called to pass the context
Tests performed
UI Testing on Multiple Font Sizes:
Functional Testing:
adb shell dumpsys alarm | grep -A 20 "org.fossify.clock"Before & after preview
Dark Mode Screens
Light Mode Screens
Closes the following issue(s)
Checklist
CHANGELOG.md(if applicable).