Skip to content

[Android] Tabs briefly display wrong background color when navigating between flyout items#24965

Closed
NanthiniMahalingam wants to merge 32 commits intodotnet:mainfrom
NanthiniMahalingam:fix-16522
Closed

[Android] Tabs briefly display wrong background color when navigating between flyout items#24965
NanthiniMahalingam wants to merge 32 commits intodotnet:mainfrom
NanthiniMahalingam:fix-16522

Conversation

@NanthiniMahalingam
Copy link
Copy Markdown
Contributor

@NanthiniMahalingam NanthiniMahalingam commented Sep 27, 2024

Root Cause:

  • On Android, the BottomNavigationView initially has a ColorDrawable with a white background, which is the default color during its creation.
  • Later, the BottomNavigationView background is changed to a ColorChangeRevealDrawable with an animation, transitioning to the color specified by IShellAppearanceElement.EffectiveTabBarBackgroundColor.
  • Since the previous background color (white) differs from the current color (black), the animation displays a transition from white to black when switching pages.

Description of Change:

  • To resolve this issue, the IShellAppearanceElement.EffectiveTabBarBackgroundColor is applied to the background of the BottomNavigationView immediately after its creation.
  • This ensures that no animation is triggered later, as the previous background color (black) and the current color (black) remain the same.

Tested the behaviour in the following platforms.

  • Android
  • Windows
  • iOS
  • Mac

Reference

N/A

Issues Fixed

Fixes #16522

Screenshots

Before After

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Sep 27, 2024
@NanthiniMahalingam NanthiniMahalingam marked this pull request as ready for review October 3, 2024 11:41
@NanthiniMahalingam NanthiniMahalingam requested a review from a team as a code owner October 3, 2024 11:41
@jfversluis
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Copy Markdown
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

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

Test failures on this one seem accurate

@jsuarezruiz jsuarezruiz added platform/android area-controls-shell Shell Navigation, Routes, Tabs, Flyout labels Oct 4, 2024
@vishnumenon2684
Copy link
Copy Markdown
Contributor

Test failures on this one seem accurate

@PureWeen The test case failing seems to be in Windows, even though the fix is specifically added for android.
Could you please check this once? If not can we try triggering the CI once.

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/rebase

@dotnet dotnet deleted a comment from azure-pipelines bot Oct 9, 2024
@jsuarezruiz
Copy link
Copy Markdown
Contributor

jsuarezruiz commented Oct 9, 2024

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Copy Markdown
Member

PureWeen commented Oct 9, 2024

Test failures on this one seem accurate

@PureWeen The test case failing seems to be in Windows, even though the fix is specifically added for android. Could you please check this once? If not can we try triggering the CI once.

Test failures on this one seem accurate

@PureWeen The test case failing seems to be in Windows, even though the fix is specifically added for android. Could you please check this once? If not can we try triggering the CI once.

The failure I'm referring to is that both API levels of the Android aren't running to completion

It looks like the changes here are causing the device tests on android to crash.
If you download the logcat file from the device test runs you should be able to see a crash in there that will need to be resolved

https://github.com/dotnet/maui/blob/main/docs/design/UITesting.md#logging

@PureWeen PureWeen moved this from Changes Requested to Ready To Review in MAUI SDK Ongoing Mar 2, 2025
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

HookEvents(ShellItem);
SetupMenu();

var appearance = ShellContext.Shell.GetAppearanceForPivot(ShellItem);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If I move this code into the SetAppearance call of this class it seems to do the same thing

image

Can we do that instead of setting the GetAppearanceForPivot to internal?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If I move this code into the SetAppearance call of this class it seems to do the same thing

image

Can we do that instead of setting the GetAppearanceForPivot to internal?

Yes It is working in SetAppearance call. I have modified the fix based on your suggestion. Could you please review it and let me know if you have any concerns?

@github-project-automation github-project-automation bot moved this from Ready To Review to Changes Requested in MAUI SDK Ongoing Mar 4, 2025
@PureWeen PureWeen modified the milestones: .NET 9 SR5, .NET 9 SR6 Mar 7, 2025
@rmarinho
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen moved this from Changes Requested to Ready To Review in MAUI SDK Ongoing Mar 18, 2025

[Test]
[Category(UITestCategories.Shell)]
public void ShellTabBarBackgroundColor()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The test is failing on Windows:
Snapshot different than baseline: ShellTabBarBackgroundColor.png (1.51% difference)

Note, in red the differences:
image
Could you take a look?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The test is failing on Windows: Snapshot different than baseline: ShellTabBarBackgroundColor.png (1.51% difference)

Note, in red the differences: image Could you take a look?

I have updated the snapshot. Could you please review it and let me know if you have any concerns?

@github-project-automation github-project-automation bot moved this from Ready To Review to Changes Requested in MAUI SDK Ongoing Mar 19, 2025
@PureWeen PureWeen modified the milestones: .NET 9 SR6, .NET 9 SR7 Mar 23, 2025
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen modified the milestones: .NET 9 SR7, .NET 9 SR8 May 8, 2025
@PureWeen PureWeen modified the milestones: .NET 9 SR8, .NET 9 Servicing May 8, 2025
@jsuarezruiz
Copy link
Copy Markdown
Contributor

@NanthiniMahalingam Could you rebase? Thanks in advance.

@NanthiniMahalingam
Copy link
Copy Markdown
Contributor Author

NanthiniMahalingam commented Jun 9, 2025

I'm closing this PR in reference to the newly created PR #29883

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

Labels

area-controls-shell Shell Navigation, Routes, Tabs, Flyout community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] Tabs briefly display wrong background color when navigating between flyout items

9 participants