adjust font sizse for username/password if they are over certain lengths on vault view page.
This commit is contained in:
parent
428e35237f
commit
4a0e3227fc
|
@ -36,9 +36,31 @@ namespace Bit.App.Models.Page
|
||||||
_username = value;
|
_username = value;
|
||||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(Username)));
|
PropertyChanged(this, new PropertyChangedEventArgs(nameof(Username)));
|
||||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(ShowUsername)));
|
PropertyChanged(this, new PropertyChangedEventArgs(nameof(ShowUsername)));
|
||||||
|
PropertyChanged(this, new PropertyChangedEventArgs(nameof(UsernameFontSize)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool ShowUsername => !string.IsNullOrWhiteSpace(Username);
|
public bool ShowUsername => !string.IsNullOrWhiteSpace(Username);
|
||||||
|
public double UsernameFontSize
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if(Device.OS == TargetPlatform.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
|
public string Password
|
||||||
{
|
{
|
||||||
|
@ -48,9 +70,32 @@ namespace Bit.App.Models.Page
|
||||||
_password = value;
|
_password = value;
|
||||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(Password)));
|
PropertyChanged(this, new PropertyChangedEventArgs(nameof(Password)));
|
||||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(MaskedPassword)));
|
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 bool ShowPassword => !string.IsNullOrWhiteSpace(Password);
|
||||||
|
public double PasswordFontSize
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if(Device.OS == TargetPlatform.Android)
|
||||||
|
{
|
||||||
|
var length = Password?.Length ?? 0;
|
||||||
|
|
||||||
|
if(length > 25)
|
||||||
|
{
|
||||||
|
return Device.GetNamedSize(NamedSize.Micro, typeof(Label));
|
||||||
|
}
|
||||||
|
else if(length > 15)
|
||||||
|
{
|
||||||
|
return Device.GetNamedSize(NamedSize.Small, typeof(Label));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Device.GetNamedSize(NamedSize.Medium, typeof(Label));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string Uri
|
public string Uri
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,12 +49,14 @@ namespace Bit.App.Pages
|
||||||
// Username
|
// Username
|
||||||
UsernameCell = new LabeledValueCell(AppResources.Username, button1Text: AppResources.Copy);
|
UsernameCell = new LabeledValueCell(AppResources.Username, button1Text: AppResources.Copy);
|
||||||
UsernameCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.Username);
|
UsernameCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.Username);
|
||||||
|
UsernameCell.Value.SetBinding<VaultViewSitePageModel>(Label.FontSizeProperty, s => s.UsernameFontSize);
|
||||||
UsernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username));
|
UsernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username));
|
||||||
|
|
||||||
// Password
|
// Password
|
||||||
PasswordCell = new LabeledValueCell(AppResources.Password, button1Text: string.Empty,
|
PasswordCell = new LabeledValueCell(AppResources.Password, button1Text: string.Empty,
|
||||||
button2Text: AppResources.Copy);
|
button2Text: AppResources.Copy);
|
||||||
PasswordCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.MaskedPassword);
|
PasswordCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.MaskedPassword);
|
||||||
|
PasswordCell.Value.SetBinding<VaultViewSitePageModel>(Label.FontSizeProperty, s => s.PasswordFontSize);
|
||||||
PasswordCell.Button1.SetBinding<VaultViewSitePageModel>(Button.ImageProperty, s => s.ShowHideImage);
|
PasswordCell.Button1.SetBinding<VaultViewSitePageModel>(Button.ImageProperty, s => s.ShowHideImage);
|
||||||
if(Device.OS == TargetPlatform.iOS)
|
if(Device.OS == TargetPlatform.iOS)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue