mirror of
https://github.com/bitwarden/android.git
synced 2024-12-20 08:12:26 +03:00
switch tools to grid layout cells
This commit is contained in:
parent
83985965f2
commit
936f65ecc9
2 changed files with 21 additions and 27 deletions
|
@ -113,6 +113,11 @@ namespace Bit.App.Pages
|
||||||
Text = labelText
|
Text = labelText
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(Device.OS == TargetPlatform.Android)
|
||||||
|
{
|
||||||
|
label.TextColor = Color.Black;
|
||||||
|
}
|
||||||
|
|
||||||
var detail = new Label
|
var detail = new Label
|
||||||
{
|
{
|
||||||
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
|
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
|
||||||
|
@ -121,41 +126,30 @@ namespace Bit.App.Pages
|
||||||
Text = detailText
|
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
|
var image = new Image
|
||||||
{
|
{
|
||||||
HorizontalOptions = LayoutOptions.Start,
|
Source = imageSource
|
||||||
VerticalOptions = LayoutOptions.FillAndExpand,
|
|
||||||
Source = imageSource,
|
|
||||||
Margin = new Thickness(0, 0, 10, 0)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var containerStackLayout = new StackLayout
|
var grid = new Grid
|
||||||
{
|
{
|
||||||
Orientation = StackOrientation.Horizontal,
|
ColumnSpacing = 15,
|
||||||
Children = { image, labelDetailStackLayout },
|
RowSpacing = 0,
|
||||||
Padding = Device.OnPlatform(
|
Padding = new Thickness(15, 25)
|
||||||
iOS: new Thickness(15, 25),
|
|
||||||
Android: new Thickness(15, 20),
|
|
||||||
WinPhone: 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;
|
ShowDisclousure = true;
|
||||||
View = containerStackLayout;
|
View = grid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
if(Device.OS == TargetPlatform.Android)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue