mirror of
https://github.com/bitwarden/android.git
synced 2024-12-18 23:31:52 +03:00
Move to named sizes
This commit is contained in:
parent
275246f27b
commit
54da129887
12 changed files with 45 additions and 31 deletions
|
@ -115,18 +115,20 @@ namespace Bit.App
|
||||||
// What method are we using to unlock?
|
// What method are we using to unlock?
|
||||||
var fingerprintUnlock = _settings.GetValueOrDefault<bool>(Constants.SettingFingerprintUnlockOn);
|
var fingerprintUnlock = _settings.GetValueOrDefault<bool>(Constants.SettingFingerprintUnlockOn);
|
||||||
var pinUnlock = _settings.GetValueOrDefault<bool>(Constants.SettingPinUnlockOn);
|
var pinUnlock = _settings.GetValueOrDefault<bool>(Constants.SettingPinUnlockOn);
|
||||||
|
var currentPage = Current.MainPage.Navigation.ModalStack.LastOrDefault() as ExtendedNavigationPage;
|
||||||
if(fingerprintUnlock && _fingerprint.IsAvailable)
|
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))
|
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
|
else
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace Bit.App.Controls
|
||||||
{
|
{
|
||||||
public EntryLabel()
|
public EntryLabel()
|
||||||
{
|
{
|
||||||
FontSize = 14;
|
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label));
|
||||||
TextColor = Color.FromHex("777777");
|
TextColor = Color.FromHex("777777");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,18 @@ namespace Bit.App.Controls
|
||||||
{
|
{
|
||||||
public class FormEntryCell : ExtendedViewCell
|
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)
|
||||||
|
{
|
||||||
|
if(!useLabelAsPlaceholder)
|
||||||
{
|
{
|
||||||
Label = new Label
|
Label = new Label
|
||||||
{
|
{
|
||||||
Text = labelText,
|
Text = labelText,
|
||||||
FontSize = 14,
|
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
|
||||||
VerticalOptions = LayoutOptions.Start,
|
VerticalOptions = LayoutOptions.Start,
|
||||||
Style = (Style)Application.Current.Resources["text-muted"]
|
Style = (Style)Application.Current.Resources["text-muted"]
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
Entry = new ExtendedEntry
|
Entry = new ExtendedEntry
|
||||||
{
|
{
|
||||||
|
@ -23,6 +26,11 @@ namespace Bit.App.Controls
|
||||||
IsPassword = IsPassword
|
IsPassword = IsPassword
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(useLabelAsPlaceholder)
|
||||||
|
{
|
||||||
|
Entry.Placeholder = labelText;
|
||||||
|
}
|
||||||
|
|
||||||
if(nextElement != null)
|
if(nextElement != null)
|
||||||
{
|
{
|
||||||
Entry.ReturnType = Enums.ReturnType.Next;
|
Entry.ReturnType = Enums.ReturnType.Next;
|
||||||
|
@ -34,7 +42,11 @@ namespace Bit.App.Controls
|
||||||
Padding = new Thickness(15, 10)
|
Padding = new Thickness(15, 10)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(!useLabelAsPlaceholder)
|
||||||
|
{
|
||||||
stackLayout.Children.Add(Label);
|
stackLayout.Children.Add(Label);
|
||||||
|
}
|
||||||
|
|
||||||
stackLayout.Children.Add(Entry);
|
stackLayout.Children.Add(Entry);
|
||||||
|
|
||||||
View = stackLayout;
|
View = stackLayout;
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Bit.App.Controls
|
||||||
Label = new Label
|
Label = new Label
|
||||||
{
|
{
|
||||||
Text = labelText,
|
Text = labelText,
|
||||||
FontSize = 14,
|
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
|
||||||
TextColor = Color.FromHex("777777"),
|
TextColor = Color.FromHex("777777"),
|
||||||
VerticalOptions = LayoutOptions.Start
|
VerticalOptions = LayoutOptions.Start
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace Bit.App.Controls
|
||||||
Label = new Label
|
Label = new Label
|
||||||
{
|
{
|
||||||
Text = labelText,
|
Text = labelText,
|
||||||
FontSize = 14,
|
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
|
||||||
Style = (Style)Application.Current.Resources["text-muted"],
|
Style = (Style)Application.Current.Resources["text-muted"],
|
||||||
VerticalOptions = LayoutOptions.Start
|
VerticalOptions = LayoutOptions.Start
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace Bit.App.Pages
|
||||||
HorizontalOptions = LayoutOptions.Center,
|
HorizontalOptions = LayoutOptions.Center,
|
||||||
HorizontalTextAlignment = TextAlignment.Center,
|
HorizontalTextAlignment = TextAlignment.Center,
|
||||||
LineBreakMode = LineBreakMode.WordWrap,
|
LineBreakMode = LineBreakMode.WordWrap,
|
||||||
FontSize = 20
|
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
|
||||||
};
|
};
|
||||||
|
|
||||||
var createAccountButton = new Button
|
var createAccountButton = new Button
|
||||||
|
@ -51,7 +51,7 @@ namespace Bit.App.Pages
|
||||||
VerticalOptions = LayoutOptions.End,
|
VerticalOptions = LayoutOptions.End,
|
||||||
HorizontalOptions = LayoutOptions.Fill,
|
HorizontalOptions = LayoutOptions.Fill,
|
||||||
Style = (Style)Application.Current.Resources["btn-primary"],
|
Style = (Style)Application.Current.Resources["btn-primary"],
|
||||||
FontSize = 17
|
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
|
||||||
};
|
};
|
||||||
|
|
||||||
var loginButton = new Button
|
var loginButton = new Button
|
||||||
|
@ -61,7 +61,7 @@ namespace Bit.App.Pages
|
||||||
VerticalOptions = LayoutOptions.End,
|
VerticalOptions = LayoutOptions.End,
|
||||||
Style = (Style)Application.Current.Resources["btn-primaryAccent"],
|
Style = (Style)Application.Current.Resources["btn-primaryAccent"],
|
||||||
HorizontalOptions = LayoutOptions.Fill,
|
HorizontalOptions = LayoutOptions.Fill,
|
||||||
FontSize = 17
|
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
|
||||||
};
|
};
|
||||||
|
|
||||||
var buttonStackLayout = new StackLayout
|
var buttonStackLayout = new StackLayout
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Bit.App.Pages
|
||||||
Text = "Use Fingerprint to Unlock",
|
Text = "Use Fingerprint to Unlock",
|
||||||
Command = new Command(async () => await CheckFingerprintAsync()),
|
Command = new Command(async () => await CheckFingerprintAsync()),
|
||||||
VerticalOptions = LayoutOptions.EndAndExpand,
|
VerticalOptions = LayoutOptions.EndAndExpand,
|
||||||
Style = (Style)Application.Current.Resources["btn-default"]
|
Style = (Style)Application.Current.Resources["btn-primary"]
|
||||||
};
|
};
|
||||||
|
|
||||||
var logoutButton = new Button
|
var logoutButton = new Button
|
||||||
|
@ -45,7 +45,7 @@ namespace Bit.App.Pages
|
||||||
Text = AppResources.LogOut,
|
Text = AppResources.LogOut,
|
||||||
Command = new Command(async () => await LogoutAsync()),
|
Command = new Command(async () => await LogoutAsync()),
|
||||||
VerticalOptions = LayoutOptions.End,
|
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 };
|
var stackLayout = new StackLayout { Padding = new Thickness(30, 40), Spacing = 10 };
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace Bit.App.Pages
|
||||||
Text = AppResources.LogOut,
|
Text = AppResources.LogOut,
|
||||||
Command = new Command(async () => await LogoutAsync()),
|
Command = new Command(async () => await LogoutAsync()),
|
||||||
VerticalOptions = LayoutOptions.End,
|
VerticalOptions = LayoutOptions.End,
|
||||||
Style = (Style)Application.Current.Resources["btn-default"]
|
Style = (Style)Application.Current.Resources["btn-primaryAccent"]
|
||||||
};
|
};
|
||||||
|
|
||||||
var stackLayout = new StackLayout
|
var stackLayout = new StackLayout
|
||||||
|
|
|
@ -36,8 +36,8 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true);
|
PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true, useLabelAsPlaceholder: true);
|
||||||
EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: PasswordCell.Entry, entryKeyboard: Keyboard.Email);
|
EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: PasswordCell.Entry, entryKeyboard: Keyboard.Email, useLabelAsPlaceholder: true);
|
||||||
|
|
||||||
PasswordCell.Entry.ReturnType = Enums.ReturnType.Go;
|
PasswordCell.Entry.ReturnType = Enums.ReturnType.Go;
|
||||||
PasswordCell.Entry.Completed += Entry_Completed;
|
PasswordCell.Entry.Completed += Entry_Completed;
|
||||||
|
|
|
@ -34,11 +34,11 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
PasswordHintCell = new FormEntryCell("Master Password Hint (optional)");
|
PasswordHintCell = new FormEntryCell("Master Password Hint (optional)", useLabelAsPlaceholder: true);
|
||||||
ConfirmPasswordCell = new FormEntryCell("Re-type Master Password", IsPassword: true, nextElement: PasswordHintCell.Entry);
|
ConfirmPasswordCell = new FormEntryCell("Re-type Master Password", IsPassword: true, nextElement: PasswordHintCell.Entry, useLabelAsPlaceholder: true);
|
||||||
PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true, nextElement: ConfirmPasswordCell.Entry);
|
PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true, nextElement: ConfirmPasswordCell.Entry, useLabelAsPlaceholder: true);
|
||||||
NameCell = new FormEntryCell("Your Name", nextElement: PasswordCell.Entry);
|
NameCell = new FormEntryCell("Your Name", nextElement: PasswordCell.Entry, useLabelAsPlaceholder: true);
|
||||||
EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: NameCell.Entry, entryKeyboard: Keyboard.Email);
|
EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: NameCell.Entry, entryKeyboard: Keyboard.Email, useLabelAsPlaceholder: true);
|
||||||
|
|
||||||
PasswordHintCell.Entry.ReturnType = Enums.ReturnType.Done;
|
PasswordHintCell.Entry.ReturnType = Enums.ReturnType.Done;
|
||||||
PasswordHintCell.Entry.Completed += Entry_Completed;
|
PasswordHintCell.Entry.Completed += Entry_Completed;
|
||||||
|
|
|
@ -48,7 +48,6 @@ namespace Bit.App.Pages
|
||||||
Title = "Set PIN";
|
Title = "Set PIN";
|
||||||
Content = stackLayout;
|
Content = stackLayout;
|
||||||
Content.GestureRecognizers.Add(tgr);
|
Content.GestureRecognizers.Add(tgr);
|
||||||
BackgroundImage = "bg.png";
|
|
||||||
BindingContext = Model;
|
BindingContext = Model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
VerticalTextAlignment = TextAlignment.Center,
|
VerticalTextAlignment = TextAlignment.Center,
|
||||||
VerticalOptions = LayoutOptions.CenterAndExpand,
|
VerticalOptions = LayoutOptions.CenterAndExpand,
|
||||||
FontSize = 14,
|
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
|
||||||
Style = (Style)Application.Current.Resources["text-muted"]
|
Style = (Style)Application.Current.Resources["text-muted"]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -231,7 +231,8 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
Orientation = StackOrientation.Horizontal,
|
Orientation = StackOrientation.Horizontal,
|
||||||
VerticalOptions = LayoutOptions.FillAndExpand,
|
VerticalOptions = LayoutOptions.FillAndExpand,
|
||||||
Children = { image, label }
|
Children = { image, label },
|
||||||
|
BackgroundColor = Color.FromHex("efeff4")
|
||||||
};
|
};
|
||||||
|
|
||||||
View = stackLayout;
|
View = stackLayout;
|
||||||
|
|
Loading…
Reference in a new issue