Skip to content

teams: smoother voices set data splitting (fixes #13086)#13019

Merged
dogi merged 3 commits into
masterfrom
code-health-refactor-voices-setData-13856087524995464396
Apr 22, 2026
Merged

teams: smoother voices set data splitting (fixes #13086)#13019
dogi merged 3 commits into
masterfrom
code-health-refactor-voices-setData-13856087524995464396

Conversation

@dogi
Copy link
Copy Markdown
Member

@dogi dogi commented Apr 16, 2026

🎯 What: The setData method in VoicesFragment.kt was overly long and contained monolithic logic for downloading resources, sorting news items, and setting up a large VoicesAdapter. This PR extracts these discrete responsibilities into smaller, testable private functions (downloadResourcesForNews, sortNews, and setupVoicesAdapter).

💡 Why: Breaking down the monolithic setData method improves maintainability and readability by adhering to the single responsibility principle. It isolates side effects (like resource downloading) and large configuration blocks (like setting up the VoicesAdapter with many closures) from the main data binding flow.

Verification: I manually inspected the refactored code and ran the compilation and test suite using ./gradlew compileDefaultDebugKotlin --offline and ./gradlew testDefaultDebugUnitTest --tests "org.ole.planet.myplanet.ui.voices.*" --offline. The app compiles correctly and all relevant unit tests pass.

Result: The code is cleaner, more modular, and easier to follow and test in the future.


PR created automatically by Jules for task 13856087524995464396 started by @dogi

…esFragment

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@qltysh
Copy link
Copy Markdown

qltysh Bot commented Apr 16, 2026

❌ 1 blocking issue (1 total)

Tool Category Rule Count
qlty Structure Function with many returns (count = 7): setupVoicesAdapter 1

adapterNews?.setListener(this)
adapterNews?.registerAdapterDataObserver(observer)
adapterNews?.submitList(sortedList)
binding.rvNews.adapter = adapterNews
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function with many returns (count = 7): setupVoicesAdapter [qlty:return-statements]

@dogi dogi changed the title 🧹 [code health: Refactored VoicesFragment.setData into smaller functions] teams: smoother voices set data splitting (fixes #13086) Apr 22, 2026
@dogi dogi merged commit 152a126 into master Apr 22, 2026
4 checks passed
@Okuro3499 Okuro3499 deleted the code-health-refactor-voices-setData-13856087524995464396 branch April 22, 2026 13:56
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.

2 participants