1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-06-25 10:26:02 +02:00

Move to named sizes

This commit is contained in:
Kyle Spearrin 2016-06-27 20:56:59 -04:00
parent 275246f27b
commit 54da129887
12 changed files with 45 additions and 31 deletions

View File

@ -115,18 +115,20 @@ namespace Bit.App
// What method are we using to unlock?
var fingerprintUnlock = _settings.GetValueOrDefault<bool>(Constants.SettingFingerprintUnlockOn);
var pinUnlock = _settings.GetValueOrDefault<bool>(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

View File

@ -6,7 +6,7 @@ namespace Bit.App.Controls
{
public EntryLabel()
{
FontSize = 14;
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label));
TextColor = Color.FromHex("777777");
}
}

View File

@ -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;

View File

@ -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
};

View File

@ -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
};

View File

@ -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

View File

@ -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 };

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -48,7 +48,6 @@ namespace Bit.App.Pages
Title = "Set PIN";
Content = stackLayout;
Content.GestureRecognizers.Add(tgr);
BackgroundImage = "bg.png";
BindingContext = Model;
}

View File

@ -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;