From 936f65ecc9ac612063f107e93e400a373c7f1123 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 19 Dec 2016 08:32:32 -0500 Subject: [PATCH] switch tools to grid layout cells --- src/App/Pages/Tools/ToolsPage.cs | 46 ++++++++++++++------------------ src/App/Utilities/Extentions.cs | 2 +- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/App/Pages/Tools/ToolsPage.cs b/src/App/Pages/Tools/ToolsPage.cs index 33bf11848..189341c31 100644 --- a/src/App/Pages/Tools/ToolsPage.cs +++ b/src/App/Pages/Tools/ToolsPage.cs @@ -113,6 +113,11 @@ namespace Bit.App.Pages Text = labelText }; + if(Device.OS == TargetPlatform.Android) + { + label.TextColor = Color.Black; + } + var detail = new Label { FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), @@ -121,41 +126,30 @@ namespace Bit.App.Pages Text = detailText }; - if(Device.OS == TargetPlatform.Android) - { - label.TextColor = Color.Black; - } - - var labelDetailStackLayout = new StackLayout - { - HorizontalOptions = LayoutOptions.StartAndExpand, - VerticalOptions = LayoutOptions.FillAndExpand, - Children = { label, detail }, - Spacing = 0 - }; - var image = new Image { - HorizontalOptions = LayoutOptions.Start, - VerticalOptions = LayoutOptions.FillAndExpand, - Source = imageSource, - Margin = new Thickness(0, 0, 10, 0) + Source = imageSource }; - var containerStackLayout = new StackLayout + var grid = new Grid { - Orientation = StackOrientation.Horizontal, - Children = { image, labelDetailStackLayout }, - Padding = Device.OnPlatform( - iOS: new Thickness(15, 25), - Android: new Thickness(15, 20), - WinPhone: new Thickness(15, 25)) + ColumnSpacing = 15, + RowSpacing = 0, + Padding = new Thickness(15, 25) }; + grid.AdjustPaddingForDevice(); - containerStackLayout.AdjustPaddingForDevice(); + grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); + grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); + grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(44, GridUnitType.Absolute) }); + grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); + grid.Children.Add(image, 0, 0); + Grid.SetRowSpan(image, 2); + grid.Children.Add(label, 1, 0); + grid.Children.Add(detail, 1, 1); ShowDisclousure = true; - View = containerStackLayout; + View = grid; } } } diff --git a/src/App/Utilities/Extentions.cs b/src/App/Utilities/Extentions.cs index f1ef02f85..d498c94f2 100644 --- a/src/App/Utilities/Extentions.cs +++ b/src/App/Utilities/Extentions.cs @@ -77,7 +77,7 @@ namespace Bit.App } } - public static void AdjustPaddingForDevice(this StackLayout view) + public static void AdjustPaddingForDevice(this Layout view) { if(Device.OS == TargetPlatform.Android) {