2016-05-14 02:57:07 +03:00
|
|
|
|
using Acr.UserDialogs;
|
|
|
|
|
using Bit.App.Abstractions;
|
|
|
|
|
using Bit.App.Resources;
|
|
|
|
|
using System;
|
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
using XLabs.Ioc;
|
|
|
|
|
|
|
|
|
|
namespace Bit.App.Controls
|
|
|
|
|
{
|
|
|
|
|
public class LabeledValueCell : ViewCell
|
|
|
|
|
{
|
|
|
|
|
public LabeledValueCell(
|
2016-05-14 08:34:42 +03:00
|
|
|
|
string labelText = null,
|
2016-05-14 02:57:07 +03:00
|
|
|
|
string valueText = null,
|
2016-05-14 08:34:42 +03:00
|
|
|
|
string button1Text = null,
|
|
|
|
|
string button2Text = null)
|
2016-05-14 02:57:07 +03:00
|
|
|
|
{
|
2016-05-17 06:54:24 +03:00
|
|
|
|
var containerStackLayout = new StackLayout
|
2016-05-14 02:57:07 +03:00
|
|
|
|
{
|
2016-05-17 06:54:24 +03:00
|
|
|
|
Padding = new Thickness(15),
|
|
|
|
|
BackgroundColor = Color.White,
|
|
|
|
|
Orientation = StackOrientation.Horizontal
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var labelValueStackLayout = new StackLayout
|
|
|
|
|
{
|
|
|
|
|
HorizontalOptions = LayoutOptions.StartAndExpand,
|
|
|
|
|
VerticalOptions = LayoutOptions.Center
|
2016-05-14 02:57:07 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if(labelText != null)
|
|
|
|
|
{
|
|
|
|
|
Label = new Label
|
|
|
|
|
{
|
|
|
|
|
Text = labelText,
|
|
|
|
|
FontSize = 14,
|
2016-05-17 06:54:24 +03:00
|
|
|
|
TextColor = Color.FromHex("777777"),
|
|
|
|
|
VerticalOptions = LayoutOptions.Start
|
2016-05-14 02:57:07 +03:00
|
|
|
|
};
|
|
|
|
|
|
2016-05-17 06:54:24 +03:00
|
|
|
|
labelValueStackLayout.Children.Add(Label);
|
2016-05-14 02:57:07 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Value = new Label
|
|
|
|
|
{
|
|
|
|
|
Text = valueText,
|
|
|
|
|
LineBreakMode = LineBreakMode.TailTruncation,
|
2016-05-17 06:54:24 +03:00
|
|
|
|
VerticalOptions = LayoutOptions.CenterAndExpand,
|
|
|
|
|
Margin = new Thickness(0, 5, 0, 0)
|
2016-05-14 02:57:07 +03:00
|
|
|
|
};
|
|
|
|
|
|
2016-05-17 06:54:24 +03:00
|
|
|
|
labelValueStackLayout.Children.Add(Value);
|
|
|
|
|
|
|
|
|
|
containerStackLayout.Children.Add(labelValueStackLayout);
|
|
|
|
|
|
|
|
|
|
var buttonStackLayout = new StackLayout
|
2016-05-14 02:57:07 +03:00
|
|
|
|
{
|
|
|
|
|
Orientation = StackOrientation.Horizontal
|
|
|
|
|
};
|
2016-05-14 08:34:42 +03:00
|
|
|
|
|
|
|
|
|
if(button1Text != null)
|
2016-05-14 02:57:07 +03:00
|
|
|
|
{
|
2016-05-14 08:34:42 +03:00
|
|
|
|
Button1 = new Button
|
2016-05-14 02:57:07 +03:00
|
|
|
|
{
|
2016-05-14 08:34:42 +03:00
|
|
|
|
Text = button1Text,
|
2016-05-14 02:57:07 +03:00
|
|
|
|
HorizontalOptions = LayoutOptions.End,
|
2016-05-14 08:34:42 +03:00
|
|
|
|
VerticalOptions = LayoutOptions.Center
|
2016-05-14 02:57:07 +03:00
|
|
|
|
};
|
|
|
|
|
|
2016-05-17 06:54:24 +03:00
|
|
|
|
buttonStackLayout.Children.Add(Button1);
|
2016-05-14 02:57:07 +03:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-14 08:34:42 +03:00
|
|
|
|
if(button2Text != null)
|
2016-05-14 02:57:07 +03:00
|
|
|
|
{
|
2016-05-14 08:34:42 +03:00
|
|
|
|
Button2 = new Button
|
2016-05-14 02:57:07 +03:00
|
|
|
|
{
|
2016-05-14 08:34:42 +03:00
|
|
|
|
Text = button2Text,
|
2016-05-14 02:57:07 +03:00
|
|
|
|
HorizontalOptions = LayoutOptions.End,
|
2016-05-14 08:34:42 +03:00
|
|
|
|
VerticalOptions = LayoutOptions.Center
|
2016-05-14 02:57:07 +03:00
|
|
|
|
};
|
|
|
|
|
|
2016-05-17 06:54:24 +03:00
|
|
|
|
buttonStackLayout.Children.Add(Button2);
|
2016-05-14 02:57:07 +03:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-17 06:54:24 +03:00
|
|
|
|
containerStackLayout.Children.Add(buttonStackLayout);
|
2016-05-14 02:57:07 +03:00
|
|
|
|
|
2016-05-17 06:54:24 +03:00
|
|
|
|
View = containerStackLayout;
|
2016-05-14 02:57:07 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Label Label { get; private set; }
|
|
|
|
|
public Label Value { get; private set; }
|
2016-05-14 08:34:42 +03:00
|
|
|
|
public Button Button1 { get; private set; }
|
|
|
|
|
public Button Button2 { get; private set; }
|
2016-05-14 02:57:07 +03:00
|
|
|
|
}
|
|
|
|
|
}
|