Skip to content

Prevents IllegalArgumentException in Card Browser#20934

Open
Galal-20 wants to merge 1 commit intoankidroid:mainfrom
Galal-20:Fix-cardBrowser-remove-unsafe-requirement
Open

Prevents IllegalArgumentException in Card Browser#20934
Galal-20 wants to merge 1 commit intoankidroid:mainfrom
Galal-20:Fix-cardBrowser-remove-unsafe-requirement

Conversation

@Galal-20
Copy link
Copy Markdown
Contributor

@Galal-20 Galal-20 commented May 3, 2026

Purpose / Description

Fixes a common Card Browser crash IllegalArgumentException that happens when the calculated ripple/focus color is the same as the backdrop color.

Fixes

Approach

I used a defensive fallback logic in place of a necessary requirement that might not work with extreme colors:

The code tries the typical transformation darkening for Light Mode, lightening for Night Mode.
I check to see if the new hue truly differs from the original.
The algorithm automatically applies the inverse.

This ensures the colors will always be different and users always get a visible response pressed state even when using extreme background colors.

How Has This Been Tested?

Tested manually on: Android Emulator (API 33, 34, 37) and Physical device.
Also i have added comprehensive Unit Tests to verify this logic.

UI:

c.mov

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the [Google Accessibility Scanner]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Card Browser: MultiColumnViewHolder.setColor: Failed requirement

1 participant