diff --git a/src/App/Controls/ExtendedEntry.cs b/src/App/Controls/ExtendedEntry.cs index d804b5d56..55ccdd7be 100644 --- a/src/App/Controls/ExtendedEntry.cs +++ b/src/App/Controls/ExtendedEntry.cs @@ -45,6 +45,7 @@ namespace Bit.App.Controls public ReturnType? ReturnType { get; set; } public bool? Autocorrect { get; set; } public bool DisableAutocapitalize { get; set; } + public bool AllowClear { get; set; } // Need to overwrite default handler because we cant Invoke otherwise public new event EventHandler Completed; diff --git a/src/App/Controls/FormEntryCell.cs b/src/App/Controls/FormEntryCell.cs index 9a41a93b0..fd6bb8df9 100644 --- a/src/App/Controls/FormEntryCell.cs +++ b/src/App/Controls/FormEntryCell.cs @@ -5,7 +5,13 @@ namespace Bit.App.Controls { public class FormEntryCell : ExtendedViewCell { - public FormEntryCell(string labelText, Keyboard entryKeyboard = null, bool IsPassword = false, VisualElement nextElement = null, bool useLabelAsPlaceholder = false) + public FormEntryCell( + string labelText, + Keyboard entryKeyboard = null, + bool IsPassword = false, + VisualElement nextElement = null, + bool useLabelAsPlaceholder = false, + string imageSource = null) { if(!useLabelAsPlaceholder) { @@ -14,7 +20,8 @@ namespace Bit.App.Controls Text = labelText, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), VerticalOptions = LayoutOptions.Start, - Style = (Style)Application.Current.Resources["text-muted"] + Style = (Style)Application.Current.Resources["text-muted"], + HorizontalOptions = LayoutOptions.FillAndExpand }; } @@ -23,7 +30,9 @@ namespace Bit.App.Controls Keyboard = entryKeyboard, HasBorder = false, VerticalOptions = LayoutOptions.CenterAndExpand, - IsPassword = IsPassword + IsPassword = IsPassword, + AllowClear = true, + HorizontalOptions = LayoutOptions.FillAndExpand }; if(useLabelAsPlaceholder) @@ -37,22 +46,53 @@ namespace Bit.App.Controls Entry.Completed += (object sender, EventArgs e) => { nextElement.Focus(); }; } - var stackLayout = new StackLayout + var imageStackLayout = new StackLayout { - Padding = new Thickness(15, 10) + Padding = new Thickness(15, 10), + Orientation = StackOrientation.Horizontal, + Spacing = 10, + HorizontalOptions = LayoutOptions.FillAndExpand, + VerticalOptions = LayoutOptions.FillAndExpand }; - if(!useLabelAsPlaceholder) + if(imageSource != null) { - stackLayout.Children.Add(Label); + var tgr = new TapGestureRecognizer(); + tgr.Tapped += Tgr_Tapped; + + var theImage = new Image + { + Source = imageSource, + HorizontalOptions = LayoutOptions.Start, + VerticalOptions = LayoutOptions.Center + }; + theImage.GestureRecognizers.Add(tgr); + + imageStackLayout.Children.Add(theImage); } - stackLayout.Children.Add(Entry); + var formStackLayout = new StackLayout + { + HorizontalOptions = LayoutOptions.FillAndExpand, + VerticalOptions = LayoutOptions.FillAndExpand + }; + if(!useLabelAsPlaceholder) + { + formStackLayout.Children.Add(Label); + } - View = stackLayout; + formStackLayout.Children.Add(Entry); + imageStackLayout.Children.Add(formStackLayout); + + View = imageStackLayout; } public Label Label { get; private set; } public ExtendedEntry Entry { get; private set; } + + private void Tgr_Tapped(object sender, EventArgs e) + { + Entry.Focus(); + } } } diff --git a/src/App/Pages/LoginPage.cs b/src/App/Pages/LoginPage.cs index dc859310e..6fe017863 100644 --- a/src/App/Pages/LoginPage.cs +++ b/src/App/Pages/LoginPage.cs @@ -36,8 +36,10 @@ namespace Bit.App.Pages private void Init() { - PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true, useLabelAsPlaceholder: true); - EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: PasswordCell.Entry, entryKeyboard: Keyboard.Email, useLabelAsPlaceholder: true); + PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true, + useLabelAsPlaceholder: true, imageSource: "lock"); + EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: PasswordCell.Entry, + entryKeyboard: Keyboard.Email, useLabelAsPlaceholder: true, imageSource: "envelope"); PasswordCell.Entry.ReturnType = Enums.ReturnType.Go; PasswordCell.Entry.Completed += Entry_Completed; diff --git a/src/App/Pages/RegisterPage.cs b/src/App/Pages/RegisterPage.cs index 1de6524dd..4be1bdab1 100644 --- a/src/App/Pages/RegisterPage.cs +++ b/src/App/Pages/RegisterPage.cs @@ -34,11 +34,11 @@ namespace Bit.App.Pages private void Init() { - PasswordHintCell = new FormEntryCell("Master Password Hint (optional)", useLabelAsPlaceholder: true); - ConfirmPasswordCell = new FormEntryCell("Re-type Master Password", IsPassword: true, nextElement: PasswordHintCell.Entry, useLabelAsPlaceholder: true); - PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true, nextElement: ConfirmPasswordCell.Entry, useLabelAsPlaceholder: true); - NameCell = new FormEntryCell("Your Name", nextElement: PasswordCell.Entry, useLabelAsPlaceholder: true); - EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: NameCell.Entry, entryKeyboard: Keyboard.Email, useLabelAsPlaceholder: true); + PasswordHintCell = new FormEntryCell("Master Password Hint (optional)", useLabelAsPlaceholder: true, imageSource: "lightbulb-o"); + ConfirmPasswordCell = new FormEntryCell("Re-type Master Password", IsPassword: true, nextElement: PasswordHintCell.Entry, useLabelAsPlaceholder: true, imageSource: "lock"); + PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true, nextElement: ConfirmPasswordCell.Entry, useLabelAsPlaceholder: true, imageSource: "lock"); + NameCell = new FormEntryCell("Your Name", nextElement: PasswordCell.Entry, useLabelAsPlaceholder: true, imageSource: "user"); + EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: NameCell.Entry, entryKeyboard: Keyboard.Email, useLabelAsPlaceholder: true, imageSource: "envelope"); PasswordHintCell.Entry.ReturnType = Enums.ReturnType.Done; PasswordHintCell.Entry.Completed += Entry_Completed; @@ -54,7 +54,10 @@ namespace Bit.App.Pages new TableSection() { EmailCell, - NameCell, + NameCell + }, + new TableSection() + { PasswordCell, ConfirmPasswordCell, PasswordHintCell diff --git a/src/iOS/Controls/ExtendedEntryRenderer.cs b/src/iOS/Controls/ExtendedEntryRenderer.cs index fbc2403e0..86922b2ea 100644 --- a/src/iOS/Controls/ExtendedEntryRenderer.cs +++ b/src/iOS/Controls/ExtendedEntryRenderer.cs @@ -25,6 +25,11 @@ namespace Bit.iOS.Controls SetMaxLength(view); UpdateKeyboard(); + if(view.AllowClear) + { + Control.ClearButtonMode = UITextFieldViewMode.WhileEditing; + } + if(view.DisableAutocapitalize) { Control.AutocapitalizationType = UITextAutocapitalizationType.None; diff --git a/src/iOS/Resources/envelope.png b/src/iOS/Resources/envelope.png new file mode 100644 index 000000000..95c64ed09 Binary files /dev/null and b/src/iOS/Resources/envelope.png differ diff --git a/src/iOS/Resources/envelope@2x.png b/src/iOS/Resources/envelope@2x.png new file mode 100644 index 000000000..a174a6927 Binary files /dev/null and b/src/iOS/Resources/envelope@2x.png differ diff --git a/src/iOS/Resources/envelope@3x.png b/src/iOS/Resources/envelope@3x.png new file mode 100644 index 000000000..9e819aceb Binary files /dev/null and b/src/iOS/Resources/envelope@3x.png differ diff --git a/src/iOS/Resources/lightbulb-o.png b/src/iOS/Resources/lightbulb-o.png new file mode 100644 index 000000000..6d30f8b19 Binary files /dev/null and b/src/iOS/Resources/lightbulb-o.png differ diff --git a/src/iOS/Resources/lightbulb-o@2x.png b/src/iOS/Resources/lightbulb-o@2x.png new file mode 100644 index 000000000..a71f9bd76 Binary files /dev/null and b/src/iOS/Resources/lightbulb-o@2x.png differ diff --git a/src/iOS/Resources/lightbulb-o@3x.png b/src/iOS/Resources/lightbulb-o@3x.png new file mode 100644 index 000000000..5c09cc0ab Binary files /dev/null and b/src/iOS/Resources/lightbulb-o@3x.png differ diff --git a/src/iOS/Resources/lock.png b/src/iOS/Resources/lock.png new file mode 100644 index 000000000..d8e7e2edb Binary files /dev/null and b/src/iOS/Resources/lock.png differ diff --git a/src/iOS/Resources/lock@2x.png b/src/iOS/Resources/lock@2x.png new file mode 100644 index 000000000..868b6c6ae Binary files /dev/null and b/src/iOS/Resources/lock@2x.png differ diff --git a/src/iOS/Resources/lock@3x.png b/src/iOS/Resources/lock@3x.png new file mode 100644 index 000000000..789c5449e Binary files /dev/null and b/src/iOS/Resources/lock@3x.png differ diff --git a/src/iOS/Resources/user.png b/src/iOS/Resources/user.png new file mode 100644 index 000000000..de6d504fd Binary files /dev/null and b/src/iOS/Resources/user.png differ diff --git a/src/iOS/Resources/user@2x.png b/src/iOS/Resources/user@2x.png new file mode 100644 index 000000000..58874ba40 Binary files /dev/null and b/src/iOS/Resources/user@2x.png differ diff --git a/src/iOS/Resources/user@3x.png b/src/iOS/Resources/user@3x.png new file mode 100644 index 000000000..3df0dc41e Binary files /dev/null and b/src/iOS/Resources/user@3x.png differ diff --git a/src/iOS/iOS.csproj b/src/iOS/iOS.csproj index 7032f8fa5..60628c5dc 100644 --- a/src/iOS/iOS.csproj +++ b/src/iOS/iOS.csproj @@ -400,6 +400,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +