Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
[Android] Take in account status bar padding on master when using spl…
Browse files Browse the repository at this point in the history
…it behaviour in MDP (#226)
  • Loading branch information
rmarinho authored and Jason Smith committed Jun 17, 2016
1 parent dae4dfa commit 9340833
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ void IVisualElementRenderer.SetElement(VisualElement element)

_masterLayout = new MasterDetailContainer(newElement, true, Context)
{
TopPadding = ((IMasterDetailPageController)newElement).ShouldShowSplitMode ? statusBarHeight : 0,
LayoutParameters = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent) { Gravity = (int)GravityFlags.Start }
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ Rectangle GetBounds(bool isMasterPage, int left, int top, int right, int bottom)
double width = Context.FromPixels(right - left);
double height = Context.FromPixels(bottom - top);
double xPos = 0;
bool supressPadding = false;

//splitview
if (MasterDetailPageController.ShouldShowSplitMode)
Expand All @@ -131,11 +132,13 @@ Rectangle GetBounds(bool isMasterPage, int left, int top, int right, int bottom)
}
else
{
//if we are showing the normal popover master doesn't have padding
supressPadding = isMasterPage;
//popover make the master smaller
width = isMasterPage && (Device.Info.CurrentOrientation.IsLandscape() || Device.Idiom == TargetIdiom.Tablet) ? DefaultWidthMaster : width;
}

double padding = Context.FromPixels(TopPadding);
double padding = supressPadding ? 0 : Context.FromPixels(TopPadding);
return new Rectangle(xPos, padding, width, height - padding);
}

Expand Down

0 comments on commit 9340833

Please sign in to comment.