mirror of
https://github.com/bitwarden/mobile
synced 2025-12-20 10:13:42 +00:00
redid lock pin page with pin control.
This commit is contained in:
45
src/App/Controls/PinControl.cs
Normal file
45
src/App/Controls/PinControl.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using Bit.App.Models.Page;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
public class PinControl
|
||||
{
|
||||
private Action _pinEnteredAction;
|
||||
|
||||
public PinControl(Action pinEnteredAction)
|
||||
{
|
||||
_pinEnteredAction = pinEnteredAction;
|
||||
|
||||
Label = new Label
|
||||
{
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
FontSize = 30,
|
||||
TextColor = Color.FromHex("333333"),
|
||||
FontFamily = "Courier"
|
||||
};
|
||||
Label.SetBinding<PinPageModel>(Label.TextProperty, s => s.LabelText);
|
||||
|
||||
Entry = new ExtendedEntry
|
||||
{
|
||||
Keyboard = Keyboard.Numeric,
|
||||
IsVisible = false,
|
||||
MaxLength = 4
|
||||
};
|
||||
Entry.SetBinding<PinPageModel>(Xamarin.Forms.Entry.TextProperty, s => s.PIN);
|
||||
Entry.TextChanged += PinEntry_TextChanged;
|
||||
}
|
||||
|
||||
private void PinEntry_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if(e.NewTextValue.Length >= 4)
|
||||
{
|
||||
_pinEnteredAction();
|
||||
}
|
||||
}
|
||||
|
||||
public Label Label { get; set; }
|
||||
public ExtendedEntry Entry { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user