Skip to content

android: fix noise control widget cropping and Off button stuck visible#567

Open
thisisAcidic wants to merge 4 commits intokavishdevar:mainfrom
thisisAcidic:fix-noise-control-widget-cropping
Open

android: fix noise control widget cropping and Off button stuck visible#567
thisisAcidic wants to merge 4 commits intokavishdevar:mainfrom
thisisAcidic:fix-noise-control-widget-cropping

Conversation

@thisisAcidic
Copy link
Copy Markdown
Contributor

Two related issues with the noise control widget.

  1. Icons were cropped on smaller widget sizes because each used a fixed `52dp x 52dp` ImageView with hard-coded vertical margins, so the content overflowed the cell at sizes near the declared `minHeight=40dp`. Switched the icons to `0dp + weight + scaleType=fitCenter + adjustViewBounds=true` so they scale with the available cell height. Reduced vertical margin to 6dp.

  2. After enabling Off Listening Mode and disabling it again, the Off button stayed visible in the widget no matter how often the toggle was flipped. Two things were stacking:

    • `AACPManager.setControlCommandStatusValue` only removed the existing status entry when its value happened to equal the new one, so on any actual value change the old entry stayed in the list and a new one was appended. `controlCommandStatusList.find { ... }` then kept returning the stale entry. Changed to always replace.
    • `AirPodsService` SharedPreferenceChangeListener did not react to `off_listening_mode`, so even after the value in memory was correct the widget itself was not refreshed. Added the missing case.
  3. (Bonus while in there) Widget labels now share a uniform text size, computed at update time from the current widget width and the system font scale, so all four button labels are the same size instead of each shrinking independently. The ANC button label was abbreviated to "ANC" because "Noise Cancellation" can never reasonably fit at small widget sizes alongside the other labels.

Closes #566 and addresses the cropped widget reported in Discord.

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.

Noise control widget keeps showing Off button after toggling Off Listening Mode

1 participant