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

[Android] Fix padding on master MDP when using split view #226

Merged
merged 1 commit into from
Jun 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,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