Skip to content

Conversation

@KidScripty
Copy link

@KidScripty KidScripty commented Jan 6, 2026

Type of change(s)

  • Bug fix
  • Feature / enhancement
  • Infrastructure / tooling (CI, build, deps, tests)
  • Documentation

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

  1. Added the string resource

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)

  1. Made the UI

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

  1. Updated the Alarm model

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

  1. Database changes

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!)

  1. Alarm logic updates

Made updateNonRecurringAlarmDay() skip specific date alarms since they shouldn't be updated
Changed getTimeOfNextAlarm() to handle specific dates before the normal logic

  1. Hooked up the date picker

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

  1. Fixed the alarm list display

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)

  1. Bug fixes along the way

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:

  1. Tested the alarm edit screen with small font size to ensure everything fits properly
  2. Tested with large font size to check for layout issues and text truncation
  3. Verified date selector row displays correctly with calendar icon, label, and clear button in both font sizes
  4. Confirmed date picker dialog works properly on different screen sizes

Functional Testing:

  1. Created new alarms with specific dates and verified they save correctly
  2. Tested that alarms show the right date labels ("Today", "Tomorrow", day names, formatted dates)
  3. Verified the clear button removes the specific date and reverts to standard behavior
  4. Tested that existing alarms without specific dates still work normally after database migration
  5. Confirmed alarm list screen displays dates correctly
  6. Tested that specific date alarms are set for the correct time using adb shell dumpsys alarm | grep -A 20 "org.fossify.clock"

Before & after preview

Dark Mode Screens

ignoreImageMinify ignoreImageMinify ignoreImageMinify ignoreImageMinify

Light Mode Screens

ignoreImageMinify ignoreImageMinify ignoreImageMinify ignoreImageMinify

Closes the following issue(s)

Checklist

  • I read the contribution guidelines.
  • I manually tested my changes on device/emulator (if applicable).
  • I updated the "Unreleased" section in CHANGELOG.md (if applicable).
  • I have self-reviewed my pull request (no typos, formatting errors, etc.).
  • All checks are passing.

AshBash added 12 commits January 6, 2026 20:51
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.
@KidScripty
Copy link
Author

KidScripty commented Jan 6, 2026

@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.

AshBash added 2 commits January 6, 2026 23:24
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Alarm for Specific Date

1 participant