Feature/copying stuff - #54
Merged
Merged
Conversation
- Implement state mutations in MacroPadState (copyMacroToProfile, copyLayoutToProfile, copyButtonToLayout, duplicateButtonInLayout) - Create CopyDialogs.kt containing InlineProfileSelectionOverlay and InlineLayoutSelectionOverlay - Integrate copy and duplicate options into MacroListEditor, EditorInlineOverlays, and PadButtonEditDialog - Wire up overlays backstack in MacroPadEditor - Add new unit tests covering copying behaviors in MacroPadStateTest - Localize copy strings in English and German - Update MacroPad FEATURE.md documentation
…cation - Remove " (Copy)" suffix from copy operations in favor of standard collision numbering - Implement duplicateProfile and duplicateLayout deep-copy state mutations in MacroPadState - Merge individual edit/reorder buttons in profile and layout chips bars into unified "..." dropdown menus - Replace delete button in button list items with a "..." dropdown containing edit, duplicate, copy to layout, and delete options - Remove redundant copy/duplicate button actions from PadButtonEditDialog and InlineLayoutSettingsOverlay - Add localized string resources for profile/layout duplication in English and German - Update assertions and add new duplication test coverage in MacroPadStateTest - Update macropad FEATURE.md documentation to reflect the new UI and behavior specifications
…logic - Extract `cloneWithMacroMapping` extension function in `MacroPadState.kt` to deduplicate button cloning logic in profile duplication and layout copying. - Implement reusable `InlineDialogOverlay` container component in `EditorInlineOverlays.kt` to encapsulate scrim, blockPointerEvents, layout, header, and cancel behavior. - Refactor confirm delete, name input, profile settings, layout settings, profile selection, and layout selection overlays to consume `InlineDialogOverlay`, eliminating significant UI code duplication. - Clean up unused imports in `CopyDialogs.kt`. - Update `FEATURE.md` documentation to reflect the new overlay component structure and "..." context menus.
…ual menus - Add "Delete Profile" option to the profiles contextual dropdown menu and disable it if only one profile exists. - Add "Delete Layout" option to the layouts contextual dropdown menu and disable it if only one layout exists. - Remove onDelete, canDelete, and showDelete parameters and header delete icon buttons from InlineProfileSettingsOverlay and InlineLayoutSettingsOverlay dialogs. - Wire up onDeleteProfile and onDeleteLayout callbacks in MacroPadEditor.kt. - Update FEATURE.md to reflect that profile and layout deletion resides in contextual dropdowns.
There was a problem hiding this comment.
Pull request overview
This PR adds MacroPad entity duplication/copy workflows (profiles, layouts, buttons, macros) and wires them into the editor UI via contextual “…” menus and inline selection overlays, alongside updated tests, docs, and localized strings.
Changes:
- Added new
MacroPadStateoperations for duplicating profiles/layouts/buttons and copying macros/layouts/buttons across profiles/layouts with name-collision handling. - Updated MacroPad editor/list UI to use contextual menus and new inline profile/layout selection overlays for copy actions.
- Extended
:domainunit tests and updated MacroPad feature documentation + new localized string resources.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| domain/src/test/java/com/stormpanda/megingiard/macropad/MacroPadStateTest.kt | Adds unit tests covering new duplication/copy behaviors and ID/name collision handling. |
| domain/src/main/java/com/stormpanda/megingiard/macropad/MacroPadState.kt | Implements duplication/copy APIs, including macro ID remapping when copying across profiles. |
| docs/features/macropad/FEATURE.md | Documents FR-P16 duplication/copying requirements and overlay/menu behavior. |
| app/src/main/res/values/strings.xml | Adds English strings for copy/duplicate actions and selection overlay titles. |
| app/src/main/res/values-de/strings.xml | Adds German equivalents for the new copy/duplicate strings. |
| app/src/main/java/com/stormpanda/megingiard/macropad/PadButtonEditDialog.kt | Minor formatting-only change. |
| app/src/main/java/com/stormpanda/megingiard/macropad/MacroPadEditor.kt | Wires new duplicate/copy actions into the editor and adds selection overlays. |
| app/src/main/java/com/stormpanda/megingiard/macropad/MacroListEditor.kt | Adds “Copy to Profile…” option for macros and shows the profile selection overlay. |
| app/src/main/java/com/stormpanda/megingiard/macropad/EditorLayoutComponents.kt | Replaces individual action buttons with “…” contextual menus for profiles/layouts. |
| app/src/main/java/com/stormpanda/megingiard/macropad/EditorInlineOverlays.kt | Introduces InlineDialogOverlay wrapper and refactors existing inline overlays to use it. |
| app/src/main/java/com/stormpanda/megingiard/macropad/CopyDialogs.kt | New inline profile/layout selection overlays used by copy workflows. |
| app/src/main/java/com/stormpanda/megingiard/macropad/ButtonListItem.kt | Replaces per-row delete button with a “…” menu including edit/duplicate/copy/delete actions. |
Comment on lines
+35
to
+41
| if (filteredProfiles.isEmpty()) { | ||
| Text( | ||
| text = "No other profiles available.", | ||
| color = colors.onSurfaceSecondary, | ||
| style = MaterialTheme.typography.bodyMedium, | ||
| modifier = Modifier.padding(vertical = 16.dp) | ||
| ) |
Comment on lines
+78
to
+90
| InlineDialogOverlay( | ||
| title = title, | ||
| onDismiss = onDismiss, | ||
| ) { | ||
| LazyColumn( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .heightIn(max = 300.dp), | ||
| verticalArrangement = Arrangement.spacedBy(8.dp) | ||
| ) { | ||
| profiles.forEach { profile -> | ||
| val layouts = profile.layouts.filter { it.id != excludeLayoutId } | ||
| if (layouts.isNotEmpty()) { |
…n and layout empty states - Add `private const val TAG = "CopyDialogs"` constant to `CopyDialogs.kt` per AGENTS.md guidelines. - Localize empty-state text "No other profiles available." to `macropad_copy_no_profiles_available` in English and German. - Implement selectable layout checks and empty-state message `macropad_copy_no_layouts_available` in `InlineLayoutSelectionOverlay` to prevent blank broken-looking dialogs.
Comment on lines
+577
to
+578
| val newPosX = (button.posX + 0.05f).coerceIn(0f, 1f) | ||
| val newPosY = (button.posY + 0.05f).coerceIn(0f, 1f) |
| assertEquals(1, duplicated.buttons.size) | ||
| val dupBtn = duplicated.buttons.first() | ||
| assertEquals("B", dupBtn.label) | ||
| org.junit.Assert.assertNotEquals("btn-1", dupBtn.id) |
|
|
||
| val dupMacro = duplicatedProfile.macros.first() | ||
| assertEquals("Slash", dupMacro.name) | ||
| org.junit.Assert.assertNotEquals("macro-1", dupMacro.id) |
| assertEquals(1, dupLayout.buttons.size) | ||
|
|
||
| val dupBtn = dupLayout.buttons.first() | ||
| org.junit.Assert.assertNotEquals("btn-1", dupBtn.id) |
…test imports, and feature docs typo - Extract `duplicateButtonInLayout` magic number `0.05f` into the file-scoped constant `DUPLICATE_BUTTON_OFFSET` in `MacroPadState.kt`. - Clean up fully-qualified `Assert.assertNotEquals` usages in `MacroPadStateTest.kt` and add it as an explicit import. - Correct the "metadata/metadata settings editing" typo in `FEATURE.md`.
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.
No description provided.