From 54da1298875ce41cd89b89bbc3cc5e72b41988af Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 27 Jun 2016 20:56:59 -0400 Subject: [PATCH] Move to named sizes --- src/App/App.cs | 10 ++++++---- src/App/Controls/EntryLabel.cs | 2 +- src/App/Controls/FormEntryCell.cs | 28 ++++++++++++++++++++-------- src/App/Controls/FormPickerCell.cs | 2 +- src/App/Controls/LabeledValueCell.cs | 2 +- src/App/Pages/HomePage.cs | 6 +++--- src/App/Pages/LockFingerprintPage.cs | 4 ++-- src/App/Pages/LockPinPage.cs | 2 +- src/App/Pages/LoginPage.cs | 4 ++-- src/App/Pages/RegisterPage.cs | 10 +++++----- src/App/Pages/SettingsPinPage.cs | 1 - src/App/Pages/VaultListSitesPage.cs | 5 +++-- 12 files changed, 45 insertions(+), 31 deletions(-) diff --git a/src/App/App.cs b/src/App/App.cs index aa1cc5318..8aa332bbd 100644 --- a/src/App/App.cs +++ b/src/App/App.cs @@ -115,18 +115,20 @@ namespace Bit.App // What method are we using to unlock? var fingerprintUnlock = _settings.GetValueOrDefault(Constants.SettingFingerprintUnlockOn); var pinUnlock = _settings.GetValueOrDefault(Constants.SettingPinUnlockOn); + var currentPage = Current.MainPage.Navigation.ModalStack.LastOrDefault() as ExtendedNavigationPage; if(fingerprintUnlock && _fingerprint.IsAvailable) { - if(Current.MainPage.Navigation.ModalStack.LastOrDefault() as LockFingerprintPage == null) + if((currentPage?.CurrentPage as LockFingerprintPage) == null) { - await Current.MainPage.Navigation.PushModalAsync(new LockFingerprintPage(!forceLock), false); + await Current.MainPage.Navigation.PushModalAsync(new ExtendedNavigationPage(new LockFingerprintPage(!forceLock)), false); } } else if(pinUnlock && !string.IsNullOrWhiteSpace(_authService.PIN)) { - if(Current.MainPage.Navigation.ModalStack.LastOrDefault() as LockPinPage == null) + + if((currentPage?.CurrentPage as LockPinPage) == null) { - await Current.MainPage.Navigation.PushModalAsync(new LockPinPage(), false); + await Current.MainPage.Navigation.PushModalAsync(new ExtendedNavigationPage(new LockPinPage()), false); } } else diff --git a/src/App/Controls/EntryLabel.cs b/src/App/Controls/EntryLabel.cs index 5db9ad725..30ef585e0 100644 --- a/src/App/Controls/EntryLabel.cs +++ b/src/App/Controls/EntryLabel.cs @@ -6,7 +6,7 @@ namespace Bit.App.Controls { public EntryLabel() { - FontSize = 14; + FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)); TextColor = Color.FromHex("777777"); } } diff --git a/src/App/Controls/FormEntryCell.cs b/src/App/Controls/FormEntryCell.cs index 5491530f3..9a41a93b0 100644 --- a/src/App/Controls/FormEntryCell.cs +++ b/src/App/Controls/FormEntryCell.cs @@ -5,15 +5,18 @@ namespace Bit.App.Controls { public class FormEntryCell : ExtendedViewCell { - public FormEntryCell(string labelText, Keyboard entryKeyboard = null, bool IsPassword = false, VisualElement nextElement = null) + public FormEntryCell(string labelText, Keyboard entryKeyboard = null, bool IsPassword = false, VisualElement nextElement = null, bool useLabelAsPlaceholder = false) { - Label = new Label + if(!useLabelAsPlaceholder) { - Text = labelText, - FontSize = 14, - VerticalOptions = LayoutOptions.Start, - Style = (Style)Application.Current.Resources["text-muted"] - }; + Label = new Label + { + Text = labelText, + FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), + VerticalOptions = LayoutOptions.Start, + Style = (Style)Application.Current.Resources["text-muted"] + }; + } Entry = new ExtendedEntry { @@ -23,6 +26,11 @@ namespace Bit.App.Controls IsPassword = IsPassword }; + if(useLabelAsPlaceholder) + { + Entry.Placeholder = labelText; + } + if(nextElement != null) { Entry.ReturnType = Enums.ReturnType.Next; @@ -34,7 +42,11 @@ namespace Bit.App.Controls Padding = new Thickness(15, 10) }; - stackLayout.Children.Add(Label); + if(!useLabelAsPlaceholder) + { + stackLayout.Children.Add(Label); + } + stackLayout.Children.Add(Entry); View = stackLayout; diff --git a/src/App/Controls/FormPickerCell.cs b/src/App/Controls/FormPickerCell.cs index 759d23d62..cd0d60b45 100644 --- a/src/App/Controls/FormPickerCell.cs +++ b/src/App/Controls/FormPickerCell.cs @@ -11,7 +11,7 @@ namespace Bit.App.Controls Label = new Label { Text = labelText, - FontSize = 14, + FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), TextColor = Color.FromHex("777777"), VerticalOptions = LayoutOptions.Start }; diff --git a/src/App/Controls/LabeledValueCell.cs b/src/App/Controls/LabeledValueCell.cs index 3beca6622..29fbff78d 100644 --- a/src/App/Controls/LabeledValueCell.cs +++ b/src/App/Controls/LabeledValueCell.cs @@ -27,7 +27,7 @@ namespace Bit.App.Controls Label = new Label { Text = labelText, - FontSize = 14, + FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), Style = (Style)Application.Current.Resources["text-muted"], VerticalOptions = LayoutOptions.Start }; diff --git a/src/App/Pages/HomePage.cs b/src/App/Pages/HomePage.cs index 28e08c3ec..ec3d7db90 100644 --- a/src/App/Pages/HomePage.cs +++ b/src/App/Pages/HomePage.cs @@ -41,7 +41,7 @@ namespace Bit.App.Pages HorizontalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center, LineBreakMode = LineBreakMode.WordWrap, - FontSize = 20 + FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), }; var createAccountButton = new Button @@ -51,7 +51,7 @@ namespace Bit.App.Pages VerticalOptions = LayoutOptions.End, HorizontalOptions = LayoutOptions.Fill, Style = (Style)Application.Current.Resources["btn-primary"], - FontSize = 17 + FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), }; var loginButton = new Button @@ -61,7 +61,7 @@ namespace Bit.App.Pages VerticalOptions = LayoutOptions.End, Style = (Style)Application.Current.Resources["btn-primaryAccent"], HorizontalOptions = LayoutOptions.Fill, - FontSize = 17 + FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), }; var buttonStackLayout = new StackLayout diff --git a/src/App/Pages/LockFingerprintPage.cs b/src/App/Pages/LockFingerprintPage.cs index c4b01d385..0698cdccf 100644 --- a/src/App/Pages/LockFingerprintPage.cs +++ b/src/App/Pages/LockFingerprintPage.cs @@ -37,7 +37,7 @@ namespace Bit.App.Pages Text = "Use Fingerprint to Unlock", Command = new Command(async () => await CheckFingerprintAsync()), VerticalOptions = LayoutOptions.EndAndExpand, - Style = (Style)Application.Current.Resources["btn-default"] + Style = (Style)Application.Current.Resources["btn-primary"] }; var logoutButton = new Button @@ -45,7 +45,7 @@ namespace Bit.App.Pages Text = AppResources.LogOut, Command = new Command(async () => await LogoutAsync()), VerticalOptions = LayoutOptions.End, - Style = (Style)Application.Current.Resources["btn-default"] + Style = (Style)Application.Current.Resources["btn-primaryAccent"] }; var stackLayout = new StackLayout { Padding = new Thickness(30, 40), Spacing = 10 }; diff --git a/src/App/Pages/LockPinPage.cs b/src/App/Pages/LockPinPage.cs index 5376e6893..12a13f6e1 100644 --- a/src/App/Pages/LockPinPage.cs +++ b/src/App/Pages/LockPinPage.cs @@ -41,7 +41,7 @@ namespace Bit.App.Pages Text = AppResources.LogOut, Command = new Command(async () => await LogoutAsync()), VerticalOptions = LayoutOptions.End, - Style = (Style)Application.Current.Resources["btn-default"] + Style = (Style)Application.Current.Resources["btn-primaryAccent"] }; var stackLayout = new StackLayout diff --git a/src/App/Pages/LoginPage.cs b/src/App/Pages/LoginPage.cs index f4e2faf80..dc859310e 100644 --- a/src/App/Pages/LoginPage.cs +++ b/src/App/Pages/LoginPage.cs @@ -36,8 +36,8 @@ namespace Bit.App.Pages private void Init() { - PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true); - EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: PasswordCell.Entry, entryKeyboard: Keyboard.Email); + PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true, useLabelAsPlaceholder: true); + EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: PasswordCell.Entry, entryKeyboard: Keyboard.Email, useLabelAsPlaceholder: true); 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 c769200c1..1de6524dd 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)"); - ConfirmPasswordCell = new FormEntryCell("Re-type Master Password", IsPassword: true, nextElement: PasswordHintCell.Entry); - PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true, nextElement: ConfirmPasswordCell.Entry); - NameCell = new FormEntryCell("Your Name", nextElement: PasswordCell.Entry); - EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: NameCell.Entry, entryKeyboard: Keyboard.Email); + 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.Entry.ReturnType = Enums.ReturnType.Done; PasswordHintCell.Entry.Completed += Entry_Completed; diff --git a/src/App/Pages/SettingsPinPage.cs b/src/App/Pages/SettingsPinPage.cs index 1f23a1ead..ab3ebe527 100644 --- a/src/App/Pages/SettingsPinPage.cs +++ b/src/App/Pages/SettingsPinPage.cs @@ -48,7 +48,6 @@ namespace Bit.App.Pages Title = "Set PIN"; Content = stackLayout; Content.GestureRecognizers.Add(tgr); - BackgroundImage = "bg.png"; BindingContext = Model; } diff --git a/src/App/Pages/VaultListSitesPage.cs b/src/App/Pages/VaultListSitesPage.cs index 1956ad4af..1a46b3dcd 100644 --- a/src/App/Pages/VaultListSitesPage.cs +++ b/src/App/Pages/VaultListSitesPage.cs @@ -221,7 +221,7 @@ namespace Bit.App.Pages { VerticalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.CenterAndExpand, - FontSize = 14, + FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), Style = (Style)Application.Current.Resources["text-muted"] }; @@ -231,7 +231,8 @@ namespace Bit.App.Pages { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.FillAndExpand, - Children = { image, label } + Children = { image, label }, + BackgroundColor = Color.FromHex("efeff4") }; View = stackLayout;