New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppCompat should now be able to set title bar visibility programmatic… #350

Merged
merged 3 commits into from Sep 30, 2016

Conversation

Projects
None yet
4 participants
@adrianknight89
Contributor

adrianknight89 commented Sep 13, 2016

Description of Change

Created a bug 8 months ago that got no love. Decided to fix it myself. If you use AppCompat, you can't hide title bar (title bar controls are hidden but the background is still visible.) This change ensures that developers can toggle status bar visibility programmatically. Right now, there are two ways to achieve this:

  • Call Xamarin.Forms.Forms.SetTitleBarVisibility(param)
  • Add / clear fullscreen window flag

Updating title bar visibility should set the equivalent window flag or vice versa.

There is still more work to be done. For example, there is no way at the moment to hide status bar on splash screen. Also not sure if SystemUiFlags works (haven't tested immersive stuff). I will either add to this PR to fix those or submit another in the future.

EDIT:

Setting <item name="android:windowFullscreen">true</item> should work because this actually raises OnWindowAttributesChanged() with the fullscreen flag added.

Bugs Fixed

API Changes

Changed:

  • void LayoutRootPage(Page page, int width, int height) => internal static void LayoutRootPage(FormsAppCompatActivity activity, Page page, int width, int height)
  • internal static AndroidTitleBarVisibility TitleBarVisibility { get; private set; } => internal static AndroidTitleBarVisibility TitleBarVisibility { get; set; }
@dnfclas

This comment has been minimized.

Show comment
Hide comment
@dnfclas

dnfclas Sep 13, 2016

Hi @adrianknight89, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

dnfclas commented Sep 13, 2016

Hi @adrianknight89, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

@@ -41,7 +41,7 @@ public class FormsAppCompatActivity : AppCompatActivity, IDeviceInfoProvider, IS
AndroidApplicationLifecycleState _previousState;
bool _renderersAdded;
bool _renderersAdded, _isFullScreen;

This comment has been minimized.

@adrianknight89

adrianknight89 Sep 15, 2016

Contributor

Multiple flag changes fire on app launch and users can set different flags as they wish during runtime. This boolean ensures that root page runs layout only on fullscreen flag changes.

@adrianknight89

adrianknight89 Sep 15, 2016

Contributor

Multiple flag changes fire on app launch and users can set different flags as they wish during runtime. This boolean ensures that root page runs layout only on fullscreen flag changes.

@adrianknight89

This comment has been minimized.

Show comment
Hide comment
@adrianknight89

adrianknight89 Sep 20, 2016

Contributor

See https://forums.xamarin.com/discussion/comment/222386 for a discussion on the status bar.

Contributor

adrianknight89 commented Sep 20, 2016

See https://forums.xamarin.com/discussion/comment/222386 for a discussion on the status bar.

@jassmith jassmith merged commit 4b06bc2 into xamarin:master Sep 30, 2016

1 check failed

Android-UITests Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle8 :: UI Tests :: OSX Test Cloud Package - Run Android 6.0.1 : Exit code 1
Details

@samhouts samhouts added this to the 2.3.4 milestone Jun 27, 2018

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