maui icon indicating copy to clipboard operation
maui copied to clipboard

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

Open NanthiniMahalingam opened this issue 1 year ago • 12 comments

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.

  • [x] Android
  • [x] Windows
  • [x] iOS
  • [x] Mac

Reference

N/A

Issues Fixed

Fixes #16522

Screenshots

Before After

NanthiniMahalingam avatar Sep 27 '24 10:09 NanthiniMahalingam

/azp run

jfversluis avatar Oct 03 '24 12:10 jfversluis

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Oct 03 '24 12:10 azure-pipelines[bot]

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.

vishnumenon2684 avatar Oct 09 '24 06:10 vishnumenon2684

/rebase

jsuarezruiz avatar Oct 09 '24 11:10 jsuarezruiz

/azp run

jsuarezruiz avatar Oct 09 '24 13:10 jsuarezruiz

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Oct 09 '24 13:10 azure-pipelines[bot]

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 avatar Oct 09 '24 15:10 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Oct 14 '24 18:10 azure-pipelines[bot]

@PureWeen

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

• I identified the cause of the crash during device testing on Android API 23. • The issue arises because the EffectiveTabBarBackgroundColor property is null in this API version. • To resolve this, I applied the DefaultBottomNavigationViewBackgroundColor as a fallback to ensure the background color is set properly.

NanthiniMahalingam avatar Oct 15 '24 06:10 NanthiniMahalingam

/azp run

jsuarezruiz avatar Oct 25 '24 09:10 jsuarezruiz

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Oct 25 '24 09:10 azure-pipelines[bot]

Could you include an UITest verifying the tabs background color?

Hi @jsuarezruiz I have added UI test case for TabBarBackgroundColor. Please let us know if you have any further concerns.

NanthiniMahalingam avatar Nov 05 '24 11:11 NanthiniMahalingam

/azp run

jsuarezruiz avatar Nov 11 '24 16:11 jsuarezruiz

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Nov 11 '24 16:11 azure-pipelines[bot]

/rebase

sheiksyedm avatar Nov 19 '24 06:11 sheiksyedm

/azp run

PureWeen avatar Jan 08 '25 18:01 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jan 08 '25 18:01 azure-pipelines[bot]

/azp run

jsuarezruiz avatar Jan 16 '25 10:01 jsuarezruiz

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jan 16 '25 10:01 azure-pipelines[bot]

/azp run

PureWeen avatar Jan 28 '25 22:01 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jan 28 '25 22:01 azure-pipelines[bot]

/azp run

jsuarezruiz avatar Feb 03 '25 12:02 jsuarezruiz

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Feb 03 '25 12:02 azure-pipelines[bot]

/rebase

jsuarezruiz avatar Feb 10 '25 08:02 jsuarezruiz

/azp run

PureWeen avatar Feb 14 '25 22:02 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Feb 14 '25 22:02 azure-pipelines[bot]

/azp run

jsuarezruiz avatar Feb 26 '25 07:02 jsuarezruiz

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Feb 26 '25 07:02 azure-pipelines[bot]

/azp run

jsuarezruiz avatar Mar 03 '25 10:03 jsuarezruiz

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Mar 03 '25 10:03 azure-pipelines[bot]