Skip to content

fix: Cancel and Save as two equal halves in every window (2.27.3) - #295

Merged
compot-dev merged 1 commit into
v2from
fix/brass-buttons-294
Nov 20, 2026
Merged

compot-dev merged 1 commit into
v2from
fix/brass-buttons-294

Conversation

@compot-dev

Copy link
Copy Markdown
Collaborator

Closes #294. The brass rule for Cancel / Save now covers all windows (brand, 2026-11-20).

  • Brass.style() now lays out every dialog that has both a negative and a positive button as two equal halves: Cancel left, the other right, weight 1, 6dp margins. This covers the camera URL dialog and the Reset confirmation (Cancel / Clear settings), the same as Settings in 2.27.2 (Settings: 6dp after radio text; Cancel and Save as two equal halves (brass) #292).
  • Dialogs with only OK (Start on boot) keep their bar.
  • The button that had the focus keeps it, so Cancel is still first in Reset.
  • focus_ring.xml header is updated to brass 1.4.2 (comment only; the drawing is unchanged).
  • Version 2.27.3 (versionCode 66), CHANGELOG entry.

Checked:

  • Docker compot/android:2026.10: testDebugUnitTest lintDebug assembleDebug; lint 13 warnings, as in the baseline.
  • Android TV 16 emulator, screenshots: CAMERA 1 URL shows CANCEL | SAVE as equal halves. Reset opened with the D-pad shows CANCEL | CLEAR SETTINGS, with the focus on CANCEL.
  • tests/e2e.sh TRANSPORT=TCP: API 21 20/20, API 34 20/20.

The brass rule for Cancel / Save is now for all windows (#294): Brass.style() lays out any
dialog with both buttons as two equal halves, Cancel left, so the camera URL dialog and the
Reset confirmation follow Settings (#292); the focused button keeps the focus (Cancel in
Reset). focus_ring.xml header to brass 1.4.2 (comment only).

Closes #294
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Apply equal-width Cancel and action buttons to all brass dialogs

🐞 Bug fix 📝 Documentation ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Apply the two-half button layout to camera URL and Reset dialogs, not just Settings.
• Preserve the focused button during layout; leave single-button dialogs unchanged.
• Document the fix and bump the Android app to 2.27.3.
Merge Risk 🟡 Medium

Blast radius 🔴 High 💥 4 capabilities

  • 4 affected capabilities span independent functional scopes: android_release_distribution, configuration_dialog_integration.
  • The URL editor is one end-to-end configuration dialog whose user outcome is editing a camera URL and related playback options.
  • It shares the bounded Brass configuration-dialog integration with Network settings and reset confirmation; the differing dialog contents are separate operations, not independent deployment or functional domains.
  • This is a distinct configuration operation with the outcome of editing and saving network/tunnel settings, but it remains within the same bounded in-app configuration-dialog integration as the other affected dialogs.
  • The change is presentation and focus handling around the existing Save listener, not a change to tunnel persistence or connection logic.
  • This operation confirms clearing the application's saved settings.
  • It is a distinct user outcome from editing URLs or network settings, but all three are bounded application-configuration dialogs using the same Brass dialog integration and the same button-bar behavior.
  • This behavior concerns artifact identity and installation/update eligibility, which is independent of the in-app configuration-dialog integration: it affects how the packaged application is recognized by Android distribution and update mechanisms rather than how a user operates a dialog.
Sources

android/app/src/main/java/com/openipc/decoder/Brass.java[168-168]

        halves(dialog);

android/app/build.gradle[29-30]

        versionCode 66
        versionName "2.27.3"
Behavioral complexity 🟡 Medium 🧩 Interacting branches

  • Before, the halves helper was explicitly called only by NetworkPanel after showing its dialog.
  • After, Brass.style invokes it for every Brass dialog, and the helper now captures the current focused descendant, removes and reinserts both buttons with new weighted layout parameters, then requests focus again.
  • The new correctness condition is that each dialog with both action buttons must preserve the intended action ordering, button-bar structure, and pre-existing focus across that stateful view-tree mutation, while dialogs with only one action remain unaffected.
  • The Android-TV ordering behavior is extracted/unchanged rather than newly introduced; the changed interaction is the broader call site and focus preservation across multiple dialog shapes.
Sources

android/app/src/main/java/com/openipc/decoder/Brass.java[168-168]

        halves(dialog);

android/app/src/main/java/com/openipc/decoder/Brass.java[178-184]

    private static void halves(AlertDialog dialog) {
        Button cancel = dialog.getButton(AlertDialog.BUTTON_NEGATIVE);
        Button save = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
        if (cancel == null || save == null || cancel.getParent() != save.getParent()
                || !(save.getParent() instanceof LinearLayout)) return;
        LinearLayout bar = (LinearLayout) save.getParent();
        View focused = bar.findFocus();
Potential damage 🟡 Medium 🩹 Recoverable

  • A focus-restoration or ordering fault could make the destructive Clear settings action easier to activate unintentionally, or make Cancel difficult to reach with a remote.
  • Clearing settings would remove the user's locally stored camera and application configuration, but the application remains usable and the settings can be entered again; the inspected dialog does not alter the cameras themselves.
  • A mistaken reset requires manual re-entry of settings and any available backup restoration; reverting code does not restore already-cleared preferences.
  • The source shows an initial Cancel focus request and a post-rewrite focus request, but it does not provide an external backup or automatic settings-repair mechanism.
Sources

android/app/src/main/java/com/openipc/decoder/Brass.java[178-184]

    private static void halves(AlertDialog dialog) {
        Button cancel = dialog.getButton(AlertDialog.BUTTON_NEGATIVE);
        Button save = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
        if (cancel == null || save == null || cancel.getParent() != save.getParent()
                || !(save.getParent() instanceof LinearLayout)) return;
        LinearLayout bar = (LinearLayout) save.getParent();
        View focused = bar.findFocus();
Assessed commit e5fb4e1
Diagram

graph TD
  A["Dialog callers"] --> B["Brass.style"] --> C{"Eligible pair?"} --> D["Equal halves"] --> E["Restore focus"]
  C --> F["Keep button bar"]
Loading
High-Level Assessment

Centralizing the layout in Brass.style is preferable to adding a call at each dialog: it covers existing callers consistently while preserving the one-button case. Per-dialog changes would duplicate the rule and risk missing future dialogs.

Files changed (5) +29 / -14

Bug fix (1) +9 / -5
Brass.javaApply two-half button layout through shared dialog styling +9/-5

Apply two-half button layout through shared dialog styling

• Brass.style now applies the existing layout to eligible positive/negative button pairs across dialogs. The layout saves and restores the focused view after reordering the buttons; the helper becomes private.

android/app/src/main/java/com/openipc/decoder/Brass.java

Refactor (1) +0 / -1
NetworkPanel.javaRemove redundant Settings button-layout call +0/-1

Remove redundant Settings button-layout call

• Removes the explicit halves call because Brass.style now applies that layout.

android/app/src/main/java/com/openipc/decoder/NetworkPanel.java

Documentation (2) +18 / -6
CHANGELOG.mdDocument the 2.27.3 dialog-button fix +7/-0

Document the 2.27.3 dialog-button fix

• Adds a release entry describing equal-width button placement in camera URL and Reset dialogs and preserved Cancel focus in Reset.

CHANGELOG.md

focus_ring.xmlRefresh focus-ring header guidance +11/-6

Refresh focus-ring header guidance

• Updates the comment's brass version and theme-wiring examples. The drawable definition is unchanged.

android/app/src/main/res/drawable/focus_ring.xml

Other (1) +2 / -2
build.gradleBump Android app version to 2.27.3 +2/-2

Bump Android app version to 2.27.3

• Increments versionCode from 65 to 66 and versionName from 2.27.2 to 2.27.3.

android/app/build.gradle

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@compot-dev
compot-dev merged commit 6403ed8 into v2 Nov 20, 2026
7 checks passed
@compot-dev
compot-dev deleted the fix/brass-buttons-294 branch November 20, 2026 18:45
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.

Camera URL and Reset dialogs: Cancel and Save as two equal halves (brass, all windows)

1 participant