diff options
author | adrianknight89 <adrianknight89@outlook.com> | 2016-09-30 14:22:02 -0500 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-09-30 12:22:02 -0700 |
commit | 4b06bc212f0ff9b813693d6acbeaf23ccac38091 (patch) | |
tree | aa434e3bd982a7f33c91db1b83422ce79a2208c2 /Xamarin.Forms.Platform.Android/AppCompat/Platform.cs | |
parent | 88c0da5791efa3ebdc3385aadf091b574a987d80 (diff) | |
download | xamarin-forms-4b06bc212f0ff9b813693d6acbeaf23ccac38091.tar.gz xamarin-forms-4b06bc212f0ff9b813693d6acbeaf23ccac38091.tar.bz2 xamarin-forms-4b06bc212f0ff9b813693d6acbeaf23ccac38091.zip |
AppCompat should now be able to set title bar visibility programmatic… (#350)
* AppCompat should now be able to set title bar visibility programmatically
* coding style changes
* making sure page layout runs only on fullscreen flag changes
Diffstat (limited to 'Xamarin.Forms.Platform.Android/AppCompat/Platform.cs')
-rw-r--r-- | Xamarin.Forms.Platform.Android/AppCompat/Platform.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/Platform.cs b/Xamarin.Forms.Platform.Android/AppCompat/Platform.cs index f656ff84..eb23c4de 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/Platform.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/Platform.cs @@ -193,7 +193,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat void IPlatformLayout.OnLayout(bool changed, int l, int t, int r, int b) { if (changed) - LayoutRootPage(Page, r - l, b - t); + LayoutRootPage((FormsAppCompatActivity)_context, Page, r - l, b - t); Android.Platform.GetRenderer(Page).UpdateLayout(); @@ -251,7 +251,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat Android.Platform.SetRenderer(page, renderView); if (layout) - LayoutRootPage(page, _renderer.Width, _renderer.Height); + LayoutRootPage((FormsAppCompatActivity)_context, page, _renderer.Width, _renderer.Height); _renderer.AddView(renderView.ViewGroup); } @@ -267,16 +267,16 @@ namespace Xamarin.Forms.Platform.Android.AppCompat return handled; } - void LayoutRootPage(Page page, int width, int height) + internal static void LayoutRootPage(FormsAppCompatActivity activity, Page page, int width, int height) { - var activity = (FormsAppCompatActivity)_context; int statusBarHeight = Forms.IsLollipopOrNewer ? activity.GetStatusBarHeight() : 0; + statusBarHeight = activity.Window.Attributes.Flags.HasFlag(WindowManagerFlags.Fullscreen) || Forms.TitleBarVisibility == AndroidTitleBarVisibility.Never ? 0 : statusBarHeight; if (page is MasterDetailPage) - page.Layout(new Rectangle(0, 0, _context.FromPixels(width), _context.FromPixels(height))); + page.Layout(new Rectangle(0, 0, activity.FromPixels(width), activity.FromPixels(height))); else { - page.Layout(new Rectangle(0, _context.FromPixels(statusBarHeight), _context.FromPixels(width), _context.FromPixels(height - statusBarHeight))); + page.Layout(new Rectangle(0, activity.FromPixels(statusBarHeight), activity.FromPixels(width), activity.FromPixels(height - statusBarHeight))); } } |