mirror of
https://github.com/bitwarden/android.git
synced 2025-01-11 18:57:39 +03:00
Fixed password color and alignment on iOS password generator (#743)
This commit is contained in:
parent
f78f303a79
commit
cf3d52772d
2 changed files with 9 additions and 4 deletions
|
@ -68,6 +68,7 @@
|
|||
Margin="0, 20"
|
||||
StyleClass="text-lg"
|
||||
HorizontalTextAlignment="Center"
|
||||
HorizontalOptions="CenterAndExpand"
|
||||
LineBreakMode="CharacterWrap" />
|
||||
<Button Text="{u:I18n RegeneratePassword}"
|
||||
HorizontalOptions="FillAndExpand"
|
||||
|
|
|
@ -30,8 +30,9 @@ namespace Bit.App.Utilities
|
|||
|
||||
// First two digits of returned hex code contains the alpha,
|
||||
// which is not supported in HTML color, so we need to cut those out.
|
||||
var numberColor = $"<span style=\"color:#{((Color)Application.Current.Resources["PasswordNumberColor"]).ToHex().Substring(2)}\">";
|
||||
var specialColor = $"<span style=\"color:#{((Color)Application.Current.Resources["PasswordSpecialColor"]).ToHex().Substring(2)}\">";
|
||||
var normalColor = $"<span style=\"color:#{((Color)Application.Current.Resources["TextColor"]).ToHex().Substring(3)}\">";
|
||||
var numberColor = $"<span style=\"color:#{((Color)Application.Current.Resources["PasswordNumberColor"]).ToHex().Substring(3)}\">";
|
||||
var specialColor = $"<span style=\"color:#{((Color)Application.Current.Resources["PasswordSpecialColor"]).ToHex().Substring(3)}\">";
|
||||
var result = string.Empty;
|
||||
|
||||
// Start with an otherwise uncovered case so we will definitely enter the "something changed"
|
||||
|
@ -59,7 +60,7 @@ namespace Bit.App.Utilities
|
|||
if(charType != currentType)
|
||||
{
|
||||
// Close off previous span.
|
||||
if (currentType != CharType.None && currentType != CharType.Normal)
|
||||
if (currentType != CharType.None)
|
||||
{
|
||||
result += "</span>";
|
||||
}
|
||||
|
@ -71,6 +72,9 @@ namespace Bit.App.Utilities
|
|||
switch(currentType)
|
||||
{
|
||||
// Apply color style to span.
|
||||
case CharType.Normal:
|
||||
result += normalColor;
|
||||
break;
|
||||
case CharType.Number:
|
||||
result += numberColor;
|
||||
break;
|
||||
|
@ -83,7 +87,7 @@ namespace Bit.App.Utilities
|
|||
}
|
||||
|
||||
// Close off last span.
|
||||
if (currentType != CharType.None && currentType != CharType.Normal)
|
||||
if (currentType != CharType.None)
|
||||
{
|
||||
result += "</span>";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue