xamarin / XamarinCommunityToolkit

The Xamarin Community Toolkit is a collection of Animations, Behaviors, Converters, and Effects for mobile development with Xamarin.Forms. It simplifies and demonstrates common developer tasks building iOS, Android, and UWP apps with Xamarin.Forms.
MIT License
1.58k stars 471 forks source link

[Enhancement] Implement an effect that manage the full screen mode #718

Open Cfun1 opened 3 years ago

Cfun1 commented 3 years ago

Summary

Provide an option to hide/unhide the status bar on some pages only, at Xamarin.Forms level, currently one needs to use a DependencyService to achieve this.

API

FullScreenEffect

Properties

API Description
Mode Full screen mode platform dependent, may affect StatusBar, navigation visibility
IsPersistent True: Keep Full Screen mode set even after navigating away from page that enabled it.
False: Restore the initial Full screen state/mode (what if changed meanwhile?) once navigating away from the page.
xPlat Mode Android iOS UWP
? Enabled Enabled FullScreen
? Disabled Disabled CompactOverlay
? Immersive Auto
? LeanBack Maximized
? StickyImmersive PreferredLaunchViewSize

Intended Use Case

My initial goal is to set a page in full screen with an attached effect to it. Used besides (or even without) Shell.NavBarIsVisible="False" it will enable full screen mode. xct:FullScreenEffect.Mode="Enabled" What do you guys think?

Scenarios

<ContentPage xct:FullScreenEffect.Mode="Enabled" xct:FullScreenEffect.IsPersistent="True"

References

Android: https://developer.android.com/training/system-ui/immersive UWP: https://docs.microsoft.com/en-us/uwp/api/windows.ui.viewmanagement.applicationviewwindowingmode?view=winrt-19041 iOS: https://developer.apple.com/documentation/uikit/uiviewcontroller/1621453-modalpresentationcapturesstatusb https://developer.apple.com/documentation/uikit/uiviewcontroller/1621440-prefersstatusbarhidden

Who Will Do The Work?

pictos commented 3 years ago

@Cfun1 on Android we have different ways to hide the statusbar as you can see here, do you plan to manage that on android? Do you have any implementation spec?

Cfun1 commented 3 years ago

@pictos I was thinking about the SYSTEM_UI_FLAG_FULLSCREEN only but if you think it better with all so yea. The only spec I have so far is the one described in the issue, still some questions pending. Also still not clear if such feature suggestion will be approved from the usage case point of view.

pictos commented 3 years ago

@Cfun1 I'm ok with this feature, I think that will be a great addition to the lib. Let me see your questions and try to answer them in next hour

Cfun1 commented 3 years ago

1- Should we trigger Shell.NavBarIsVisible="False"/ NavigationPage.HasNavigationBar="False" along when is applied ? 2- Should I follow the same shared effect design in xct, or using platform specific API (will have to take a look on how it works)?

pictos commented 3 years ago
  1. TBH makes sense to hide the navigationBar when the user enters this full-screen mode. We can do for both Shell and NavigationPage, I believe that will be very straight forward to implement;
  2. In this case we can implement this on all platforms (Android, iOS, and UWP)? If yes we can move with the normal effect, if not we need to discuss a little bit more if makes senses to use it as Platform Specific APIs
pictos commented 3 years ago

@Cfun1 since you want to work on this, I already added in-progress label. Please let me know if you can work on this