1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-23 19:53:50 +00:00

password lock VC for extension

This commit is contained in:
Kyle Spearrin
2016-07-21 18:28:05 -04:00
parent c2cb5ac7c9
commit 047f5b100f
4 changed files with 208 additions and 35 deletions

View File

@@ -8,13 +8,14 @@ namespace Bit.iOS.Core.Views
public FormEntryTableViewCell(
string labelName = null,
bool useTextView = false,
nfloat? height = null)
nfloat? height = null,
bool useLabelAsPlaceholder = false)
: base(UITableViewCellStyle.Default, nameof(FormEntryTableViewCell))
{
var descriptor = UIFontDescriptor.PreferredBody;
var pointSize = descriptor.PointSize;
if(labelName != null)
if(labelName != null && !useLabelAsPlaceholder)
{
Label = new UILabel
{
@@ -42,7 +43,7 @@ namespace Bit.iOS.Core.Views
NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, TextView, NSLayoutAttribute.Bottom, 1f, 10f)
});
if(labelName != null)
if(labelName != null && !useLabelAsPlaceholder)
{
ContentView.AddConstraint(
NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, Label, NSLayoutAttribute.Bottom, 1f, 10f));
@@ -69,6 +70,11 @@ namespace Bit.iOS.Core.Views
ClearButtonMode = UITextFieldViewMode.WhileEditing
};
if(useLabelAsPlaceholder)
{
TextField.Placeholder = labelName;
}
ContentView.Add(TextField);
ContentView.AddConstraints(new NSLayoutConstraint[] {
NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f),
@@ -76,7 +82,7 @@ namespace Bit.iOS.Core.Views
NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, TextField, NSLayoutAttribute.Bottom, 1f, 10f)
});
if(labelName != null)
if(labelName != null && !useLabelAsPlaceholder)
{
ContentView.AddConstraint(
NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Top, NSLayoutRelation.Equal, Label, NSLayoutAttribute.Bottom, 1f, 10f));
@@ -94,7 +100,7 @@ namespace Bit.iOS.Core.Views
}
}
if(labelName != null)
if(labelName != null && !useLabelAsPlaceholder)
{
ContentView.AddConstraints(new NSLayoutConstraint[] {
NSLayoutConstraint.Create(Label, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f),