From 2180fb672806ca585f05f5582253b544b9b39d57 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sun, 14 Aug 2016 00:54:07 -0400 Subject: [PATCH] Android UI updates to custom cells --- src/App/Controls/FormEntryCell.cs | 18 +++++++++--------- src/App/Controls/FormPickerCell.cs | 15 ++++++++++----- src/App/Controls/LabeledValueCell.cs | 21 +++++++++++++++------ 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/App/Controls/FormEntryCell.cs b/src/App/Controls/FormEntryCell.cs index b1c6c15ac..128c28d5e 100644 --- a/src/App/Controls/FormEntryCell.cs +++ b/src/App/Controls/FormEntryCell.cs @@ -20,7 +20,6 @@ namespace Bit.App.Controls { Text = labelText, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), - VerticalOptions = LayoutOptions.Start, Style = (Style)Application.Current.Resources["text-muted"], HorizontalOptions = LayoutOptions.FillAndExpand }; @@ -35,18 +34,11 @@ namespace Bit.App.Controls { Keyboard = entryKeyboard, HasBorder = false, - VerticalOptions = LayoutOptions.CenterAndExpand, IsPassword = IsPassword, AllowClear = true, HorizontalOptions = LayoutOptions.FillAndExpand }; - if(Device.OS == TargetPlatform.Android) - { - Entry.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)); - Entry.TextColor = Color.Black; - } - if(useLabelAsPlaceholder) { Entry.Placeholder = labelText; @@ -86,8 +78,16 @@ namespace Bit.App.Controls var formStackLayout = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, - VerticalOptions = LayoutOptions.FillAndExpand + VerticalOptions = LayoutOptions.CenterAndExpand }; + + if(Device.OS == TargetPlatform.Android) + { + Entry.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)); + Entry.TextColor = Color.Black; + formStackLayout.Spacing = 0; + } + if(!useLabelAsPlaceholder) { formStackLayout.Children.Add(Label); diff --git a/src/App/Controls/FormPickerCell.cs b/src/App/Controls/FormPickerCell.cs index 38760a4e1..b949ac15d 100644 --- a/src/App/Controls/FormPickerCell.cs +++ b/src/App/Controls/FormPickerCell.cs @@ -12,14 +12,12 @@ namespace Bit.App.Controls { Text = labelText, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), - TextColor = Color.FromHex("777777"), - VerticalOptions = LayoutOptions.Start + TextColor = Color.FromHex("777777") }; Picker = new ExtendedPicker { - HasBorder = false, - VerticalOptions = LayoutOptions.CenterAndExpand + HasBorder = false }; foreach(var item in pickerItems) @@ -30,12 +28,19 @@ namespace Bit.App.Controls var stackLayout = new StackLayout { - Padding = new Thickness(15, 10) + Padding = new Thickness(15, 10), + VerticalOptions = LayoutOptions.CenterAndExpand }; stackLayout.Children.Add(Label); stackLayout.Children.Add(Picker); + if(Device.OS == TargetPlatform.Android) + { + Label.FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)); + stackLayout.Spacing = 0; + } + Tapped += FormPickerCell_Tapped; View = stackLayout; diff --git a/src/App/Controls/LabeledValueCell.cs b/src/App/Controls/LabeledValueCell.cs index 7e2f0bf11..beb3532a8 100644 --- a/src/App/Controls/LabeledValueCell.cs +++ b/src/App/Controls/LabeledValueCell.cs @@ -19,7 +19,7 @@ namespace Bit.App.Controls var labelValueStackLayout = new StackLayout { HorizontalOptions = LayoutOptions.StartAndExpand, - VerticalOptions = LayoutOptions.Center + VerticalOptions = LayoutOptions.CenterAndExpand }; if(labelText != null) @@ -28,10 +28,14 @@ namespace Bit.App.Controls { Text = labelText, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), - Style = (Style)Application.Current.Resources["text-muted"], - VerticalOptions = LayoutOptions.Start + Style = (Style)Application.Current.Resources["text-muted"] }; + if(Device.OS == TargetPlatform.Android) + { + Label.FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)); + } + labelValueStackLayout.Children.Add(Label); } @@ -39,17 +43,22 @@ namespace Bit.App.Controls { Text = valueText, FontSize = Device.GetNamedSize(NamedSize.Default, typeof(Label)), - LineBreakMode = LineBreakMode.TailTruncation, - VerticalOptions = LayoutOptions.CenterAndExpand + LineBreakMode = LineBreakMode.TailTruncation }; + if(Device.OS == TargetPlatform.Android) + { + Value.TextColor = Color.Black; + } + labelValueStackLayout.Children.Add(Value); containerStackLayout.Children.Add(labelValueStackLayout); var buttonStackLayout = new StackLayout { - Orientation = StackOrientation.Horizontal + Orientation = StackOrientation.Horizontal, + VerticalOptions = LayoutOptions.CenterAndExpand }; if(button1Text != null)