Skip to content

Feature/copying stuff - #54

Merged
stormpanda merged 6 commits into
mainfrom
feature/copying-stuff
Jun 14, 2026
Merged

Feature/copying stuff#54
stormpanda merged 6 commits into
mainfrom
feature/copying-stuff

Conversation

@stormpanda

Copy link
Copy Markdown
Owner

No description provided.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MacroPadState operations 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 :domain unit 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()) {
Comment thread app/src/main/java/com/stormpanda/megingiard/macropad/CopyDialogs.kt
…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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

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)
Comment thread docs/features/macropad/FEATURE.md Outdated
…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`.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

import com.stormpanda.megingiard.R
import com.stormpanda.megingiard.ui.LocalAppColors

private const val TAG = "CopyDialogs"
@stormpanda
stormpanda merged commit be39c44 into main Jun 14, 2026
1 check passed
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.

2 participants