Repository navigation
Add Compose time and date pickers and keep dialogs open across rotation - #1908
Open
ThomasKiljanczykDev wants to merge 7 commits into
Open
ThomasKiljanczykDev wants to merge 7 commits into
ThomasKiljanczykDev wants to merge 7 commits into
Conversation
TagsFragment received its TagDataProvider from the caller, so the system could not rebuild it after rotation and the app crashed. The fragment now builds the provider itself from its arguments (a medicine ID, or none for the tag filter), so the dialog is restored with its state. The "Add tag" input is now a child DialogFragment that returns the name as a fragment result, so it also survives rotation with the typed text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ange OverviewRobot.selectDay pages back only one week, so the hardcoded 2025-07-30 became unreachable. Use the day before the frozen test date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MedTimerTimePickerDialog and MedTimerDatePickerDialog wrap the Material 3 pickers with the app's labels, the system 12/24-hour setting and a keyboard fallback when the dial does not fit. ComposePickers drives them in instrumented tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NewReminderStockDialog attached a ComposeView to the activity's decor view and took NewReminderViewModel from the activity, so rotation removed the dialog. It is now a composable that obtains the view model with hiltViewModel(), hosted inside StockSettingsFragment, which saves whether the dialog is open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Material sets the dial's hour and minute in displayLarge but the input fields in displayMedium, so switching modes changed the digit size. MedTimerTimePickerDialog now gives TimeInput displayLarge as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reschedule action hands the selected events to RescheduleViewModel; RescheduleDialog, which obtains it with hiltViewModel(), asks for the time with MedTimerTimePickerDialog, and Rescheduler applies it. Keeping the pending reschedule in the view model lets the picker survive configuration changes; the View-based MaterialTimePicker lost its OK handler on rotation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Log at another time" now opens MedTimerTimePickerDialog instead of the View-based MaterialTimePicker; the open picker is saveable state, so it survives configuration changes. ManualDoseDialog obtains its view model with hiltViewModel() and wires its steps itself, so OverviewFragment only opens it and handles the logged result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@Futsch1 these changes have been sitting on my laptop for a while.
I've refactored the code to move the medicine panels to Compose.
This PR replaces all element that will be in the panel replacement.
The next PR will get rid of the view based panels (it has some design decisions that will need approval).
I did go through changes in batches and tested each by hand to iron out some behavior details.
A highlight for this one is it makes the modified dialogs retain state on screen rotation.
Summary
ManualDoseTest#manualDoseUsesSelectedOverviewDateselect yesterday, inside the one-week range ofOverviewRobot.selectDay.RescheduleDialog,ManualDoseDialog, andNewReminderStockDialogget their view model from ahiltViewModel()default parameter.Where the hosting fragment starts a dialog, the fragment holds a
by viewModels()reference to the same instance.Evidence
Rotation with the tag dialog open crashes the app with
Fragment$InstantiationException: could not find Fragment constructor.Rotation closes the stock reminder dialog and the "Add tag" input.
The reschedule picker is a
MaterialTimePicker, which does not restore its OK listener after rotation.ManualDoseTest#manualDoseUsesSelectedOverviewDatefails with a timeout inOverviewRobot.selectDay.After:
After
activity.recreate(), each dialog stays open with its input.On the branch, based on
mainwith Compose BOM 2026.11.01, these checks pass:assembleDebug,testFullDebugUnitTest,testFossDebugUnitTest, andlint.On API 28, the instrumented tests above pass, together with
NotificationTest#scheduleReminderTestandMedicineStockTest#invalidReminderInputTest.On API 37, the same instrumented tests pass for each commit on the earlier base
5d148543b.Merge Danger
Door: two-way
The change contains UI code only.
It has no Room schema, migration, preference, or dependency version change.
feature/uiaddsandroidx.hilt:hilt-lifecycle-viewmodel-compose, which the version catalog andcore/uialready contain.Blast Radius: dialogs
Reminder editors, weekend mode, and advanced reminder settings use the View-based
TimePickerDialogFactoryandMaterialTimePicker.🤖 Generated with Claude Code