Fix icon image size to be adaptive on Large Font Size Accessibility which fixes row height on large vault (#1795)

This commit is contained in:
Federico Maccaroni 2022-02-22 12:33:38 -03:00 committed by GitHub
parent 04f4ad48f0
commit 23ca0f4b93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View file

@ -39,15 +39,16 @@
AutomationProperties.IsInAccessibleTree="False" /> AutomationProperties.IsInAccessibleTree="False" />
<ff:CachedImage <ff:CachedImage
x:Name="_iconImage"
Grid.Column="0" Grid.Column="0"
BitmapOptimizations="True" BitmapOptimizations="True"
ErrorPlaceholder="login.png" ErrorPlaceholder="login.png"
LoadingPlaceholder="login.png" LoadingPlaceholder="login.png"
HorizontalOptions="Fill" HorizontalOptions="CenterAndExpand"
VerticalOptions="Fill" VerticalOptions="CenterAndExpand"
Margin="9" Margin="9"
MinimumWidthRequest="22" WidthRequest="22"
MinimumHeightRequest="22" HeightRequest="22"
Aspect="AspectFit" Aspect="AspectFit"
IsVisible="{Binding ShowIconImage}" IsVisible="{Binding ShowIconImage}"
Source="{Binding IconImageSource, Mode=OneTime}" Source="{Binding IconImageSource, Mode=OneTime}"

View file

@ -8,6 +8,9 @@ namespace Bit.App.Controls
{ {
public partial class CipherViewCell : ExtendedGrid public partial class CipherViewCell : ExtendedGrid
{ {
private const int ICON_COLUMN_DEFAULT_WIDTH = 40;
private const int ICON_IMAGE_DEFAULT_WIDTH = 22;
public static readonly BindableProperty CipherProperty = BindableProperty.Create( public static readonly BindableProperty CipherProperty = BindableProperty.Create(
nameof(Cipher), typeof(CipherView), typeof(CipherViewCell), default(CipherView), BindingMode.OneWay); nameof(Cipher), typeof(CipherView), typeof(CipherViewCell), default(CipherView), BindingMode.OneWay);
@ -21,8 +24,10 @@ namespace Bit.App.Controls
{ {
InitializeComponent(); InitializeComponent();
var deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService"); var fontScale = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService").GetSystemFontSizeScale();
_iconColumn.Width = new GridLength(40 * deviceActionService.GetSystemFontSizeScale(), GridUnitType.Absolute); _iconColumn.Width = new GridLength(ICON_COLUMN_DEFAULT_WIDTH * fontScale, GridUnitType.Absolute);
_iconImage.WidthRequest = ICON_IMAGE_DEFAULT_WIDTH * fontScale;
_iconImage.HeightRequest = ICON_IMAGE_DEFAULT_WIDTH * fontScale;
} }
public bool? WebsiteIconsEnabled public bool? WebsiteIconsEnabled