Features
- Large day number display for easy reading
- Hijri month and year in clear text
- Gregorian date reference for context
- Day of week label
- Automatic updates at midnight
- Respects date adjustments configured in the app
Widget appearance
The widget displays dates in a vertically centered format:Display elements
- Gregorian day of week (top, small text)
- Hijri day (large, prominent number)
- Hijri month and year (medium text)
- Gregorian date (bottom, small text)
The widget automatically applies any Hijri date adjustments you’ve configured in the app, such as offset days for moon sighting variations.
Adding the widget
Implementation details
Widget class
The widget is implemented using Jetpack Glance:Widget state
The widget manages three states:Widget UI composition
The success state creates a centered, vertical layout:Update lifecycle
The widget updates automatically throughHijriDateWorker:
Periodic updates
The widget uses WorkManager for daily updates:- Update frequency: Checks for date changes periodically
- Midnight updates: Automatically refreshes when the day changes
- Battery efficient: Uses WorkManager’s optimized scheduling
- Respects doze mode: Updates when device wakes
Hijri date calculation
The widget displays Hijri dates calculated by the app using:- Astronomical calculations: Based on moon phases and position
- User adjustments: Any offset configured in app settings
- Local timezone: Converted to user’s local time
Date adjustments
Users can adjust the Hijri date in the app settings to match:- Local moon sighting declarations
- Religious authority announcements
- Regional calendar variations
Styling and typography
The widget uses a clear typographic hierarchy:Font sizes
- Day of week: 11sp, medium weight
- Hijri day: 42sp, bold (largest element)
- Month and year: 14sp, medium weight
- Gregorian date: 11sp, regular weight
Android manifest registration
Interaction
Tapping the widget opens the main app:- View the full Hijri calendar
- Adjust date offsets
- See prayer times for the day
- Access other app features
Islamic months
The widget displays the full month names:- Muharram
- Safar
- Rabi’ al-Awwal
- Rabi’ al-Thani
- Jumada al-Awwal
- Jumada al-Thani
- Rajab
- Sha’ban
- Ramadan
- Shawwal
- Dhu al-Qi’dah
- Dhu al-Hijjah
Special considerations
Ramadan display
During Ramadan, the widget helps users:- Track fasting days by displaying the current date
- Count down to Eid by showing the day number
- Stay aware of important dates like Laylat al-Qadr
Dhu al-Hijjah
During the month of Hajj:- Displays the current day for those tracking Hajj days
- Shows when the Days of Tashreeq occur
- Helps identify Eid al-Adha (10th of Dhu al-Hijjah)
Month transitions
The widget automatically updates when the month changes:- No manual refresh needed
- Updates typically occur at midnight
- Respects any date adjustments
Troubleshooting
Widget shows “Tap to refresh”
This error state indicates the date couldn’t be loaded. Solution:- Tap the widget to open the app
- Check that the app has calculated prayer times (date calculation is related)
- Verify your device date and time are correct
- Wait for the next automatic update
Date is one day off
Hijri date differences can occur due to:- Local moon sighting variations
- Different calculation methods
- Regional calendar differences
- Open the Nimaz app
- Go to Settings → Hijri Date
- Adjust the offset (+1 or -1 day) to match your local calendar
- Widget will update to show the corrected date
Not updating at midnight
If the widget doesn’t refresh when the day changes: Solution:- Check battery optimization settings for Nimaz
- Ensure the app isn’t restricted from background activity
- Tap the widget to force a refresh
- If issue persists, remove and re-add the widget
Wrong day of week
The day of week should match your device’s Gregorian calendar. Solution:- Verify your device’s date and time settings
- Check timezone is set correctly
- Restart the app
- Widget will correct on next update
Use cases
Daily awareness
Place the widget on your home screen to:- Stay connected with the Islamic calendar
- Know the current Hijri date at a glance
- Track important dates like the 15th (middle) of each month
Religious observances
Use the widget to track:- Ashura (10th of Muharram)
- Night of Bara’ah (15th of Sha’ban)
- Ramadan progress
- Days of Tashreeq (11th-13th of Dhu al-Hijjah)
Historical dates
Know the Hijri date for:- Recording important personal events
- Tracking Islamic historical dates
- Noting religious occasions
Accessibility
The widget follows accessibility best practices:- High contrast: Clear text against background
- Large type: 42sp day number is easily readable
- Logical reading order: Top to bottom, most important to least
- Respects system settings: Adapts to device text size preferences
Related widgets
- Prayer times widget - Shows prayer times with Hijri date
- Next prayer widget - Focus on upcoming prayer
- Prayer tracker widget - Track daily prayer completion