feat(pids): separate alert threshold editing from core PID configuration#181
Merged
Conversation
tzebrowski
commented
Jul 9, 2026
Owner
- Introduce distinct 'alert' and 'edit' modes for EditPidBottomSheet.
- Hide core PID fields (Description, Mode, PID Code, Formula) during 'alert' mode to prevent accidental modification of PID logic.
- Restrict the 'Add new PID' FAB to only appear in full 'edit' mode.
- Update save callback logic in the main dialog to conditionally update core fields versus alert thresholds based on the active mode.
- Introduce distinct 'alert' and 'edit' modes for EditPidBottomSheet. - Hide core PID fields (Description, Mode, PID Code, Formula) during 'alert' mode to prevent accidental modification of PID logic. - Restrict the 'Add new PID' FAB to only appear in full 'edit' mode. - Update save callback logic in the main dialog to conditionally update core fields versus alert thresholds based on the active mode.
- Extracted `isEdit`, `isAlert`, and `isInteractive` logic into a dedicated `PidExtensions.kt` file. - Removed redundant state fields (`isEditMode`, `isAlertMode`, etc.) from `PidDefinitionPreferenceDialogFragment` to simplify the class state. - Updated `EditPidBottomSheet` and dialog fragment to use the new extensions instead of inline string comparisons. - Improves code readability and centralizes mode-evaluation logic across the PID management UI.
…updates - Refactor PID dialog logic into PidDefinitionViewModel for StateFlow state management. - Fix UI state synchronization issue where edit and alert threshold updates were not immediately reflected in the RecyclerView. - Ensure state emissions occur on the main dispatcher and break object equality traps on state updates. - Ensure user-created PIDs are prioritized at the top of the PID list. - Fix custom PID deletion logic to filter by explicit ID and properly refresh the list state.
…before long description - Update PidViewAdapter to display the primary description first in bold. - Render the long description underneath in a secondary text style when available. - Hide the long description view when empty or identical to the primary description.
- Add `isUserCustom` extension property on `PidDefinition` and `PidDefinitionDetails` in Modules.kt.
- Replace hardcoded resource file string comparisons ("user_custom_pids.json") across PidViewAdapter and PidDefinitionViewModel with the extension property.
- Clean up custom PID checks for deletion UI actions and list sorting logic.
…t crash - Merged `DiagnosticRequestIDMapper` into `DiagnosticRequestIDManager` to serve as the single source of truth for CAN ID mapping logic. - Unified SharedPreferences key prefixes and consolidated configuration mapping methods (`getMapping()`, `updateSettings()`, `reset()`). - Standardized the mapping loop limit (`DRI_MAX_MAPPINGS_ALLOWED`) to 100 to prevent potential data loss. - Fixed an `IllegalArgumentException` (WordIterator invalid offset) during mapping creation by removing the conflicting `android:textAllCaps="true"` attribute from the `TextInputEditText` in `dialog_dri_edit.xml`. Capitalization remains safely handled in the bottom sheet logic.
- Created `CustomPidRepository` to handle saving and deleting user custom PIDs (`user_custom_pids.json`), separating this concern from the `Modules` configuration manager. - Wrapped Jackson ObjectMapper file I/O operations in `Dispatchers.IO` to ensure they do not block the main thread. - Updated `PidDefinitionViewModel` and `PidViewModelFactory` to use constructor injection for the new repository. - Cleaned up `PidDefinitionDialogFragment` by delegating custom PID save/delete operations directly to the ViewModel, removing the need to pass Android `Context` downward.
- Allowed negative inputs for Min/Max fields by explicitly setting `android:digits="0123456789.-"` in `dialog_pid_edit.xml`. - Fixed PID modification by constructing a new `PidDefinition` instance in `PidDefinitionDialogFragment` to bypass immutable fields. - Synced the global `DataLoggerRepository` registry during PID updates to prevent stale data from appearing upon reopening the form. - Preserved the correct `resourceFile` binding (e.g., `user_custom_pids.json`) by restoring it immediately after the registry forces it to `"memory"`. - Added a `lastUpdate` timestamp to `PidUiState` to reliably trigger `StateFlow` UI refreshes when list sizes remain identical.
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.