1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-03 09:03:35 +00:00

Added button to toggle password field visibility on site edit

This commit is contained in:
Kyle Spearrin
2016-11-07 22:07:33 -05:00
parent 4a0e3227fc
commit db6ceea711
4 changed files with 88 additions and 5 deletions

View File

@@ -45,15 +45,21 @@ namespace Bit.App.Pages
var notesCell = new FormEditorCell(height: 90);
notesCell.Editor.Text = site.Notes?.Decrypt();
PasswordCell = new FormEntryCell(AppResources.Password, IsPassword: true, nextElement: notesCell.Editor);
PasswordCell = new FormEntryCell(AppResources.Password, IsPassword: true, nextElement: notesCell.Editor,
useButton: true);
PasswordCell.Entry.Text = site.Password?.Decrypt();
PasswordCell.Button.Image = "eye";
PasswordCell.Button.Clicked += PasswordButton_Clicked;
var usernameCell = new FormEntryCell(AppResources.Username, nextElement: PasswordCell.Entry);
usernameCell.Entry.Text = site.Username?.Decrypt();
usernameCell.Entry.DisableAutocapitalize = true;
usernameCell.Entry.Autocorrect = false;
usernameCell.Entry.FontFamily = PasswordCell.Entry.FontFamily = Device.OnPlatform(
iOS: "Courier", Android: "monospace", WinPhone: "Courier");
usernameCell.Entry.FontFamily = PasswordCell.Entry.FontFamily =
Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
var uriCell = new FormEntryCell(AppResources.URI, Keyboard.Url, nextElement: usernameCell.Entry);
uriCell.Entry.Text = site.Uri?.Decrypt();
@@ -192,6 +198,12 @@ namespace Bit.App.Pages
}
}
private void PasswordButton_Clicked(object sender, EventArgs e)
{
PasswordCell.Entry.InvokeToggleIsPassword();
PasswordCell.Button.Image = "eye" + (!PasswordCell.Entry.IsPasswordFromToggled ? "_slash" : string.Empty);
}
protected override void OnAppearing()
{
base.OnAppearing();