Android UI updates to custom cells

This commit is contained in:
Kyle Spearrin 2016-08-14 00:54:07 -04:00
parent de244efbf9
commit 2180fb6728
3 changed files with 34 additions and 20 deletions

View file

@ -20,7 +20,6 @@ namespace Bit.App.Controls
{ {
Text = labelText, Text = labelText,
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
VerticalOptions = LayoutOptions.Start,
Style = (Style)Application.Current.Resources["text-muted"], Style = (Style)Application.Current.Resources["text-muted"],
HorizontalOptions = LayoutOptions.FillAndExpand HorizontalOptions = LayoutOptions.FillAndExpand
}; };
@ -35,18 +34,11 @@ namespace Bit.App.Controls
{ {
Keyboard = entryKeyboard, Keyboard = entryKeyboard,
HasBorder = false, HasBorder = false,
VerticalOptions = LayoutOptions.CenterAndExpand,
IsPassword = IsPassword, IsPassword = IsPassword,
AllowClear = true, AllowClear = true,
HorizontalOptions = LayoutOptions.FillAndExpand HorizontalOptions = LayoutOptions.FillAndExpand
}; };
if(Device.OS == TargetPlatform.Android)
{
Entry.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label));
Entry.TextColor = Color.Black;
}
if(useLabelAsPlaceholder) if(useLabelAsPlaceholder)
{ {
Entry.Placeholder = labelText; Entry.Placeholder = labelText;
@ -86,8 +78,16 @@ namespace Bit.App.Controls
var formStackLayout = new StackLayout var formStackLayout = new StackLayout
{ {
HorizontalOptions = LayoutOptions.FillAndExpand, 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) if(!useLabelAsPlaceholder)
{ {
formStackLayout.Children.Add(Label); formStackLayout.Children.Add(Label);

View file

@ -12,14 +12,12 @@ namespace Bit.App.Controls
{ {
Text = labelText, Text = labelText,
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
TextColor = Color.FromHex("777777"), TextColor = Color.FromHex("777777")
VerticalOptions = LayoutOptions.Start
}; };
Picker = new ExtendedPicker Picker = new ExtendedPicker
{ {
HasBorder = false, HasBorder = false
VerticalOptions = LayoutOptions.CenterAndExpand
}; };
foreach(var item in pickerItems) foreach(var item in pickerItems)
@ -30,12 +28,19 @@ namespace Bit.App.Controls
var stackLayout = new StackLayout var stackLayout = new StackLayout
{ {
Padding = new Thickness(15, 10) Padding = new Thickness(15, 10),
VerticalOptions = LayoutOptions.CenterAndExpand
}; };
stackLayout.Children.Add(Label); stackLayout.Children.Add(Label);
stackLayout.Children.Add(Picker); stackLayout.Children.Add(Picker);
if(Device.OS == TargetPlatform.Android)
{
Label.FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label));
stackLayout.Spacing = 0;
}
Tapped += FormPickerCell_Tapped; Tapped += FormPickerCell_Tapped;
View = stackLayout; View = stackLayout;

View file

@ -19,7 +19,7 @@ namespace Bit.App.Controls
var labelValueStackLayout = new StackLayout var labelValueStackLayout = new StackLayout
{ {
HorizontalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.StartAndExpand,
VerticalOptions = LayoutOptions.Center VerticalOptions = LayoutOptions.CenterAndExpand
}; };
if(labelText != null) if(labelText != null)
@ -28,10 +28,14 @@ namespace Bit.App.Controls
{ {
Text = labelText, Text = labelText,
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
Style = (Style)Application.Current.Resources["text-muted"], Style = (Style)Application.Current.Resources["text-muted"]
VerticalOptions = LayoutOptions.Start
}; };
if(Device.OS == TargetPlatform.Android)
{
Label.FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label));
}
labelValueStackLayout.Children.Add(Label); labelValueStackLayout.Children.Add(Label);
} }
@ -39,17 +43,22 @@ namespace Bit.App.Controls
{ {
Text = valueText, Text = valueText,
FontSize = Device.GetNamedSize(NamedSize.Default, typeof(Label)), FontSize = Device.GetNamedSize(NamedSize.Default, typeof(Label)),
LineBreakMode = LineBreakMode.TailTruncation, LineBreakMode = LineBreakMode.TailTruncation
VerticalOptions = LayoutOptions.CenterAndExpand
}; };
if(Device.OS == TargetPlatform.Android)
{
Value.TextColor = Color.Black;
}
labelValueStackLayout.Children.Add(Value); labelValueStackLayout.Children.Add(Value);
containerStackLayout.Children.Add(labelValueStackLayout); containerStackLayout.Children.Add(labelValueStackLayout);
var buttonStackLayout = new StackLayout var buttonStackLayout = new StackLayout
{ {
Orientation = StackOrientation.Horizontal Orientation = StackOrientation.Horizontal,
VerticalOptions = LayoutOptions.CenterAndExpand
}; };
if(button1Text != null) if(button1Text != null)