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-14 08:34:42 +03:00
|
|
|
|
StackLayout = new StackLayout
|
2016-05-14 02:57:07 +03:00
|
|
|
|
{
|
|
|
|
|
Padding = new Thickness(15, 15, 15, 0),
|
|
|
|
|
BackgroundColor = Color.White
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if(labelText != null)
|
|
|
|
|
{
|
|
|
|
|
Label = new Label
|
|
|
|
|
{
|
|
|
|
|
Text = labelText,
|
|
|
|
|
FontSize = 14,
|
|
|
|
|
TextColor = Color.FromHex("777777")
|
|
|
|
|
};
|
|
|
|
|
|
2016-05-14 08:34:42 +03:00
|
|
|
|
StackLayout.Children.Add(Label);
|
2016-05-14 02:57:07 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Value = new Label
|
|
|
|
|
{
|
|
|
|
|
Text = valueText,
|
|
|
|
|
LineBreakMode = LineBreakMode.TailTruncation,
|
|
|
|
|
HorizontalOptions = LayoutOptions.StartAndExpand,
|
|
|
|
|
VerticalOptions = LayoutOptions.Center
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var valueStackLayout = new StackLayout
|
|
|
|
|
{
|
|
|
|
|
Orientation = StackOrientation.Horizontal
|
|
|
|
|
};
|
2016-05-14 08:34:42 +03:00
|
|
|
|
|
2016-05-14 02:57:07 +03:00
|
|
|
|
valueStackLayout.Children.Add(Value);
|
|
|
|
|
|
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-14 08:34:42 +03:00
|
|
|
|
valueStackLayout.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-14 08:34:42 +03:00
|
|
|
|
valueStackLayout.Children.Add(Button2);
|
2016-05-14 02:57:07 +03:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-14 08:34:42 +03:00
|
|
|
|
StackLayout.Children.Add(valueStackLayout);
|
2016-05-14 02:57:07 +03:00
|
|
|
|
|
2016-05-14 08:34:42 +03:00
|
|
|
|
View = StackLayout;
|
2016-05-14 02:57:07 +03:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-14 08:34:42 +03:00
|
|
|
|
public StackLayout StackLayout { get; private set; }
|
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
|
|
|
|
}
|
|
|
|
|
}
|