2016-05-24 04:56:38 +03:00
|
|
|
|
using System;
|
|
|
|
|
using Xamarin.Forms;
|
2016-05-13 07:11:32 +03:00
|
|
|
|
|
|
|
|
|
namespace Bit.App.Controls
|
|
|
|
|
{
|
2016-05-18 04:28:19 +03:00
|
|
|
|
public class FormEntryCell : ExtendedViewCell
|
2016-05-13 07:11:32 +03:00
|
|
|
|
{
|
2016-05-24 04:56:38 +03:00
|
|
|
|
public FormEntryCell(string labelText, Keyboard entryKeyboard = null, bool IsPassword = false, VisualElement nextElement = null)
|
2016-05-13 07:11:32 +03:00
|
|
|
|
{
|
|
|
|
|
Label = new Label
|
|
|
|
|
{
|
|
|
|
|
Text = labelText,
|
|
|
|
|
FontSize = 14,
|
2016-05-17 06:54:24 +03:00
|
|
|
|
TextColor = Color.FromHex("777777"),
|
|
|
|
|
VerticalOptions = LayoutOptions.Start
|
2016-05-13 07:11:32 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Entry = new ExtendedEntry
|
|
|
|
|
{
|
|
|
|
|
Keyboard = entryKeyboard,
|
2016-05-17 06:54:24 +03:00
|
|
|
|
HasBorder = false,
|
2016-05-24 04:56:38 +03:00
|
|
|
|
VerticalOptions = LayoutOptions.CenterAndExpand,
|
|
|
|
|
IsPassword = IsPassword,
|
|
|
|
|
TextColor = Color.FromHex("333333")
|
2016-05-13 07:11:32 +03:00
|
|
|
|
};
|
|
|
|
|
|
2016-05-24 04:56:38 +03:00
|
|
|
|
if(nextElement != null)
|
|
|
|
|
{
|
|
|
|
|
Entry.ReturnType = Enums.ReturnType.Next;
|
|
|
|
|
Entry.Completed += (object sender, EventArgs e) => { nextElement.Focus(); };
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-13 07:11:32 +03:00
|
|
|
|
var stackLayout = new StackLayout
|
|
|
|
|
{
|
2016-05-18 04:28:19 +03:00
|
|
|
|
Padding = new Thickness(15)
|
2016-05-13 07:11:32 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
stackLayout.Children.Add(Label);
|
|
|
|
|
stackLayout.Children.Add(Entry);
|
|
|
|
|
|
|
|
|
|
View = stackLayout;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Label Label { get; private set; }
|
|
|
|
|
public ExtendedEntry Entry { get; private set; }
|
|
|
|
|
}
|
|
|
|
|
}
|