mirror of
https://github.com/bitwarden/mobile.git
synced 2024-09-10 01:08:23 +02:00
wrap username and password at full font size
This commit is contained in:
parent
801829ccbf
commit
32a8676572
@ -39,31 +39,9 @@ namespace Bit.App.Models.Page
|
||||
_username = value;
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(Username)));
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(ShowUsername)));
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(UsernameFontSize)));
|
||||
}
|
||||
}
|
||||
public bool ShowUsername => !string.IsNullOrWhiteSpace(Username);
|
||||
public double UsernameFontSize
|
||||
{
|
||||
get
|
||||
{
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
var length = Username?.Length ?? 0;
|
||||
|
||||
if(length > 35)
|
||||
{
|
||||
return Device.GetNamedSize(NamedSize.Micro, typeof(Label));
|
||||
}
|
||||
else if(length > 25)
|
||||
{
|
||||
return Device.GetNamedSize(NamedSize.Small, typeof(Label));
|
||||
}
|
||||
}
|
||||
|
||||
return Device.GetNamedSize(NamedSize.Medium, typeof(Label));
|
||||
}
|
||||
}
|
||||
|
||||
public string Password
|
||||
{
|
||||
@ -74,31 +52,9 @@ namespace Bit.App.Models.Page
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(Password)));
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(MaskedPassword)));
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(ShowPassword)));
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(PasswordFontSize)));
|
||||
}
|
||||
}
|
||||
public bool ShowPassword => !string.IsNullOrWhiteSpace(Password);
|
||||
public double PasswordFontSize
|
||||
{
|
||||
get
|
||||
{
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
var length = Password?.Length ?? 0;
|
||||
|
||||
if(length > 25)
|
||||
{
|
||||
return Device.GetNamedSize(NamedSize.Micro, typeof(Label));
|
||||
}
|
||||
else if(length > 20)
|
||||
{
|
||||
return Device.GetNamedSize(NamedSize.Small, typeof(Label));
|
||||
}
|
||||
}
|
||||
|
||||
return Device.GetNamedSize(NamedSize.Medium, typeof(Label));
|
||||
}
|
||||
}
|
||||
|
||||
public string Uri
|
||||
{
|
||||
|
@ -63,14 +63,13 @@ namespace Bit.App.Pages
|
||||
// Username
|
||||
UsernameCell = new LabeledValueCell(AppResources.Username, button1Text: AppResources.Copy);
|
||||
UsernameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Username));
|
||||
UsernameCell.Value.SetBinding(Label.FontSizeProperty, nameof(VaultViewLoginPageModel.UsernameFontSize));
|
||||
UsernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username));
|
||||
UsernameCell.Value.LineBreakMode = LineBreakMode.WordWrap;
|
||||
|
||||
// Password
|
||||
PasswordCell = new LabeledValueCell(AppResources.Password, button1Text: string.Empty,
|
||||
button2Text: AppResources.Copy);
|
||||
PasswordCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.MaskedPassword));
|
||||
PasswordCell.Value.SetBinding(Label.FontSizeProperty, nameof(VaultViewLoginPageModel.PasswordFontSize));
|
||||
PasswordCell.Button1.SetBinding(Button.ImageProperty, nameof(VaultViewLoginPageModel.ShowHideImage));
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
@ -79,6 +78,7 @@ namespace Bit.App.Pages
|
||||
PasswordCell.Button1.Command = new Command(() => Model.RevealPassword = !Model.RevealPassword);
|
||||
PasswordCell.Button2.Command = new Command(() => Copy(Model.Password, AppResources.Password));
|
||||
PasswordCell.Value.FontFamily = Helpers.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
|
||||
PasswordCell.Value.LineBreakMode = LineBreakMode.WordWrap;
|
||||
|
||||
// URI
|
||||
UriCell = new LabeledValueCell(AppResources.Website, button1Text: AppResources.Launch);
|
||||
|
Loading…
Reference in New Issue
Block a user