Skip to content

Conversation

@kubaflo
Copy link
Contributor

@kubaflo kubaflo commented May 17, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Issues Fixed

Fixes #29499
Fixes #29680

Before After
Screen.Recording.2025-05-17.at.02.17.05.mov
Screen.Recording.2025-05-17.at.02.18.30.mov

Copilot AI review requested due to automatic review settings May 17, 2025 00:21
@kubaflo kubaflo requested a review from a team as a code owner May 17, 2025 00:21
@kubaflo kubaflo requested review from jfversluis and jsuarezruiz May 17, 2025 00:21
@kubaflo kubaflo self-assigned this May 17, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses an issue where the SearchHandler toolbar item would be added repeatedly on Android by assigning a fixed placeholder ID and separating tint updates from item updates.

  • Replaces the generic UpdateToolbarItems call in the TintColor setter with a new UpdateToolbarItemsTintColors method to avoid re-adding items.
  • Introduces a hard-coded placeholder menu item ID (100) when adding the search placeholder to prevent duplicates.
  • Adds two overloads of UpdateToolbarItemsTintColors (one private and one parameterless) to apply tint without touching item setup.
Comments suppressed due to low confidence (1)

src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellToolbarTracker.cs:634

  • Magic number 100 is used for the placeholder menu item ID in two places; consider extracting it into a named constant to avoid duplication and improve maintainability.
int _placeholderMenuItemId = 100;

if (menu.FindItem(_placeholderMenuItemId) is IMenuItem item)
{
using (var icon = item.Icon)
icon.SetColorFilter(TintColor.ToPlatform(Colors.White), FilterMode.SrcAtop);
Copy link

Copilot AI May 17, 2025

Choose a reason for hiding this comment

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

The color filter is hard-coded to white (using Colors.White) instead of the actual TintColor; you should apply the intended TintColor (e.g., TintColor.ToPlatform()) to respect the configured tint.

Suggested change
icon.SetColorFilter(TintColor.ToPlatform(Colors.White), FilterMode.SrcAtop);
icon.SetColorFilter((TintColor?.ToPlatform() ?? Colors.White.ToPlatform()), FilterMode.SrcAtop);

Copilot uses AI. Check for mistakes.
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen added this to the .NET 9 SR8 milestone May 20, 2025
@PureWeen PureWeen added the p/0 Current heighest priority issues that we are targeting for a release. label May 20, 2025
@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing May 20, 2025
@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen requested a review from jsuarezruiz May 21, 2025 05:23
@PureWeen PureWeen changed the base branch from main to inflight/current May 22, 2025 18:15
@PureWeen PureWeen merged commit f94b535 into dotnet:inflight/current May 22, 2025
130 of 131 checks passed
@github-project-automation github-project-automation bot moved this from Ready To Review to Done in MAUI SDK Ongoing May 22, 2025
github-actions bot pushed a commit that referenced this pull request May 22, 2025
…ly - fix (#29561)

* [Android] The number of SearchHandler toolbar item increases abnormally - fix

* Added a UI test

* Create NumberOfToolbarItemsShouldNotIncrease.png
github-actions bot pushed a commit that referenced this pull request May 30, 2025
…ly - fix (#29561)

* [Android] The number of SearchHandler toolbar item increases abnormally - fix

* Added a UI test

* Create NumberOfToolbarItemsShouldNotIncrease.png
github-actions bot pushed a commit that referenced this pull request May 30, 2025
…ly - fix (#29561)

* [Android] The number of SearchHandler toolbar item increases abnormally - fix

* Added a UI test

* Create NumberOfToolbarItemsShouldNotIncrease.png
@github-actions github-actions bot locked and limited conversation to collaborators Jun 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution p/0 Current heighest priority issues that we are targeting for a release. platform/android shell-search-handler

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Android] The number of SearchHandler toolbar item increases abnormally

4 participants