Skip to content

Add SystemNavigationBar behavior for android#1665

Closed
tranb3r wants to merge 2 commits intoCommunityToolkit:mainfrom
tranb3r:feature-navbar
Closed

Add SystemNavigationBar behavior for android#1665
tranb3r wants to merge 2 commits intoCommunityToolkit:mainfrom
tranb3r:feature-navbar

Conversation

@tranb3r
Copy link
Copy Markdown

@tranb3r tranb3r commented Jan 26, 2024

Description of Change

Implement the behavior for system navigation bar (android-specific).

Linked Issues

#103

PR Checklist

Additional information

  • This feature is not available on iOS. Should we hide the page link in the sample app on iOS? It does not seem to be the case for other features that are platform specific.
  • StatusBar is only available for android>23, although according to the doc here, the min api is 21. I've also set min version 23 for system navigation bar.
  • I've copied the StatusBarStyle enum to SystemNavigationBarStyle. It would be better to have a single SystemBarStyle enum, and share it for both system bars, but I don't think it's worth a breaking change for now.

Copy link
Copy Markdown
Member

@pictos pictos left a comment

Choose a reason for hiding this comment

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

Thanks for your PR. I would that your implement isn't the best solution for this, since we're talking about a feature that will be available just for one platform, doesn't make sense to expose it in a multi-target way and throw exceptions on other platforms. I added some references on how you can approach this.

if you have more questions about the API implementation, let's use the issue to discuss it.

}
}

static bool IsSupported()
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.

Can you cache this value? I doubt this value will change during the app runtime.

/// <see cref="PlatformBehavior{TView,TPlatformView}"/> that controls the System navigation bar color
/// </summary>
[UnsupportedOSPlatform("Windows"), UnsupportedOSPlatform("MacCatalyst"), UnsupportedOSPlatform("MacOS"), UnsupportedOSPlatform("Tizen"), UnsupportedOSPlatform("iOS")]
public class SystemNavigationBarBehavior : PlatformBehavior<Page>
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.

Since this is a platform-specific just for Android, I don't think this is the best way to do it. You should use the OnPlatform API, we don't have it implemented here but you can adapt the implementation we did for XCT.

Here's a sample on how to use that API

@pictos
Copy link
Copy Markdown
Member

pictos commented Feb 5, 2024

closing this in favor of #1678.

@tranb3r thanks for your help and time on this, but as discussed I moved it forward with the .NET MAUI approach for platform-specific APIs.

@pictos pictos closed this Feb 5, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants