Skip to content

Update polls to the new design#6155

Merged
gpunto merged 3 commits intov7from
redesign/poll
Feb 16, 2026
Merged

Update polls to the new design#6155
gpunto merged 3 commits intov7from
redesign/poll

Conversation

@gpunto
Copy link
Contributor

@gpunto gpunto commented Feb 16, 2026

Goal

Update polls to the new design

Implementation

Nothing special here, just updating the poll to the new design. In the process, I also introduced the RadioCheck component according to Figma specs.

🎨 UI Changes

Add relevant screenshots

Before After
Screenshot_20260216_130902 Screenshot_20260216_130445
Screenshot_20260216_130844 Screenshot_20260216_130502

Testing

You can test it in the sample

Summary by CodeRabbit

Release Notes

  • New Features

    • Added new RadioCheck UI component for selection controls
    • Introduced comprehensive poll styling system with theme-aware colors for incoming and outgoing messages
    • Enhanced poll progress indicators with dedicated color tracks
  • Improvements

    • Improved vote count display with proper English pluralization (e.g., "1 vote" vs "2 votes")
    • Refined poll dialogs with updated UI components and consistent styling
    • Enhanced theme support for radio and checkbox controls with selected, border, and icon colors

@gpunto gpunto added the pr:improvement Improvement label Feb 16, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 16, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 16, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.25 MB 5.66 MB 0.41 MB 🟡
stream-chat-android-ui-components 10.60 MB 10.82 MB 0.23 MB 🟢
stream-chat-android-compose 12.81 MB 11.87 MB -0.94 MB 🚀

@gpunto gpunto marked this pull request as ready for review February 16, 2026 12:56
@gpunto gpunto requested a review from a team as a code owner February 16, 2026 12:56
@coderabbitai
Copy link

coderabbitai bot commented Feb 16, 2026

Walkthrough

This pull request introduces a new RadioCheck UI component for poll interactions, expands the StreamColors theme with poll-progress and radio-check color properties, refactors PollMessageContent to use a new PollStyle theming system, replaces string resources with pluralization support for vote counts, and renames a poll constants value for clarity.

Changes

Cohort / File(s) Summary
Theme and Color Updates
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/StreamColors.kt, stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/MessageStyling.kt
Added seven new color properties to StreamColors (chatPollProgressFillIncoming/Outgoing, chatPollProgressTrackIncoming/Outgoing, controlRadioCheckBgSelected/Border/IconSelected) and introduced PollStyle data class with textColor, outlineColor, progressColor, and trackColor fields; added pollStyle() composable function for style provisioning.
RadioCheck Component
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/common/RadioCheck.kt
New internal Compose UI component implementing a 24dp circular radio-like control with enabled/disabled states, border/background styling, optional checkmark icon when checked, and clickable behavior with onCheckedChange callback.
Poll UI Refactoring
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/PollMessageContent.kt
Refactored to accept PollStyle parameter, updated PollOptionButton to use StreamButtonStyle, introduced PollButtons helper composable, replaced inline UI constructs with style-driven layouts, and added MaxStackedAvatars constant for avatar limiting.
Poll Dialogs
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollMoreOptionsDialog.kt, stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollOptionVotesDialog.kt, stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollViewResultDialog.kt
Replaced PollItemCheckBox with RadioCheck in PollMoreOptionItem; added pluralStringResource usage for vote count localization with proper pluralization support in vote count displays.
String Resources
stream-chat-android-compose/src/main/res/values/strings.xml
Converted stream_compose_poll_vote_counts from singular string to plurals resource with quantity-based variants: "one" (%d vote) and "other" (%d votes).
Constants and Usage
stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/utils/PollsConstants.kt, stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/list/adapter/view/internal/PollView.kt
Renamed MIN_NUMBER_OF_VISIBLE_OPTIONS to MAX_NUMBER_OF_VISIBLE_OPTIONS with updated KDoc; updated PollView usage to reference the renamed constant.
Generated API
stream-chat-android-compose/api/stream-chat-android-compose.api
Updated API surface with new RadioCheckKt singleton, expanded StreamColors public API with seven new color accessors and component indices 113-119, removed lambda-7 field from PollMessageContentKt singleton.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A RadioCheck hops into view,
With colors for polls, both old and new,
Plurals count votes with proper care,
While PollStyle themes float through the air,
Constants renamed, the UI's fair! 🐰✨

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main objective of the pull request: updating polls to the new design.
Description check ✅ Passed The description includes a Goal section and Implementation with design references, plus UI screenshots showing before/after changes. However, Testing section lacks detail, and the contributor checklist is incomplete with most items unchecked.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into v7

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch redesign/poll

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/MessageStyling.kt`:
- Around line 116-130: The incoming PollStyle branch in MessageStyling.kt
incorrectly uses colors.chatTextOutgoing for the textColor; update the else
branch where PollStyle is constructed to use colors.chatTextIncoming instead of
colors.chatTextOutgoing so incoming polls respect the incoming text color
customization (locate the PollStyle construction in the incoming/outgoing
conditional in MessageStyling.kt).
🧹 Nitpick comments (8)
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollMoreOptionsDialog.kt (1)

240-250: Misleading lambda parameter name enabled.

The onCheckedChange callback receives the new checked state (i.e., !checked), not an enabled/disabled flag. Naming it enabled is confusing given that RadioCheck also has an enabled property with a different meaning. Consider renaming to newChecked or isChecked for clarity. Same naming issue also appears in PollMessageContent.kt line 413.

✏️ Suggested rename
-            RadioCheck(
-                modifier = Modifier.padding(end = 8.dp),
-                checked = checked,
-                onCheckedChange = { enabled ->
-                    if (enabled && checkedCount < poll.maxVotesAllowed && !checked) {
-                        onCastVote.invoke()
-                    } else if (!enabled) {
-                        onRemoveVote.invoke()
-                    }
-                },
-            )
+            RadioCheck(
+                modifier = Modifier.padding(end = 8.dp),
+                checked = checked,
+                onCheckedChange = { newChecked ->
+                    if (newChecked && checkedCount < poll.maxVotesAllowed && !checked) {
+                        onCastVote.invoke()
+                    } else if (!newChecked) {
+                        onRemoveVote.invoke()
+                    }
+                },
+            )
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/common/RadioCheck.kt (2)

40-47: Consider adding KDoc for this internal component.

While RadioCheck is internal, it's used by multiple poll-related composables across the module. A brief KDoc documenting the parameters (especially the nullable onCheckedChange semantics for read-only mode) would help maintainability.


82-83: Preview should use @StreamPreview helpers.

Per repository coding guidelines, Compose previews in stream-chat-android-compose should use @StreamPreview helpers instead of the plain @Preview annotation. Based on learnings: "Compose previews should use StreamPreview helpers".

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/PollMessageContent.kt (4)

261-272: Consider avoiding passing MutableState directly to composables.

PollButtons receives showDialog: MutableState<Boolean> and showAddAnswerDialog: MutableState<Boolean> as parameters. The idiomatic Compose approach is to pass the value and a callback (state hoisting), e.g., onSuggestOption: () -> Unit and onAddAnswer: () -> Unit, keeping the state management in the parent. This is a private composable so the blast radius is limited, but it couples PollButtons to the specific state mechanism.


410-421: Same misleading enabled parameter name as in PollMoreOptionsDialog.

The onCheckedChange lambda parameter enabled on line 413 represents the new checked state, not whether the control is enabled. See the comment on PollMoreOptionsDialog.kt line 243 for the root cause — renaming to newChecked in both locations would improve clarity.


223-227: Bottom padding condition only applies when all options are visible.

Line 226: index == poll.options.size - 1 evaluates against the total option count, not the number of displayed (taken) options. When options exceed MAX_NUMBER_OF_VISIBLE_OPTIONS, this condition is never true for any visible option, so the last visible item gets bottom = 0.dp. This appears intentional (the "See All" button follows immediately), but the asymmetry is subtle — a brief inline comment would clarify the intent.


453-458: Minor: animateFloatAsState missing a label.

animateFloatAsState on line 453 could benefit from a label parameter for animation inspection/debugging tooling. This is purely optional.

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/StreamColors.kt (1)

242-245: Missing @param KDoc for the seven new public properties.

The existing class-level KDoc documents every other property. The new chatPollProgressFill*, chatPollProgressTrack*, controlRadioCheckBgSelected, controlRadioCheckBorder, and controlRadioCheckIconSelected properties should be documented similarly for consistency.

Also applies to: 257-259

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
68.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@gpunto gpunto merged commit 261ee34 into v7 Feb 16, 2026
14 of 15 checks passed
@gpunto gpunto deleted the redesign/poll branch February 16, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:improvement Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants