mirror of
https://github.com/bitwarden/mobile
synced 2025-12-05 23:53:33 +00:00
Created extension for adjusting margins on entry fields for specific android API levels.
This commit is contained in:
@@ -27,11 +27,7 @@ namespace Bit.App.Controls
|
||||
stackLayout.Children.Add(Editor);
|
||||
|
||||
Tapped += FormEditorCell_Tapped;
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
{
|
||||
Editor.Margin = new Thickness(-4, -2, -4, -10);
|
||||
}
|
||||
Editor.AdjustMarginsForDevice();
|
||||
|
||||
View = stackLayout;
|
||||
}
|
||||
|
||||
@@ -84,21 +84,18 @@ namespace Bit.App.Controls
|
||||
var deviceInfo = Resolver.Resolve<IDeviceInfoService>();
|
||||
if(useLabelAsPlaceholder)
|
||||
{
|
||||
if(deviceInfo.Version == 21)
|
||||
if(deviceInfo.Version < 21)
|
||||
{
|
||||
Entry.Margin = new Thickness(-9, 0);
|
||||
}
|
||||
else if(deviceInfo.Version == 21)
|
||||
{
|
||||
Entry.Margin = new Thickness(0, 4, 0, -4);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(deviceInfo.Version == 21)
|
||||
{
|
||||
Entry.Margin = new Thickness(-4, -2, -4, -11);
|
||||
}
|
||||
else
|
||||
{
|
||||
Entry.Margin = new Thickness(-4, -7, -4, -11);
|
||||
}
|
||||
Entry.AdjustMarginsForDevice();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace Bit.App.Controls
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
{
|
||||
stackLayout.Spacing = 0;
|
||||
Picker.Margin = new Thickness(-4, -2, -4, -10);
|
||||
}
|
||||
Picker.AdjustMarginsForDevice();
|
||||
|
||||
Tapped += FormPickerCell_Tapped;
|
||||
|
||||
|
||||
@@ -44,5 +44,25 @@ namespace Bit.App
|
||||
entry.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
public static void AdjustMarginsForDevice(this View view)
|
||||
{
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
{
|
||||
var deviceInfo = Resolver.Resolve<IDeviceInfoService>();
|
||||
if(deviceInfo.Version < 21)
|
||||
{
|
||||
view.Margin = new Thickness(-12, -5, -12, -6);
|
||||
}
|
||||
else if(deviceInfo.Version == 21)
|
||||
{
|
||||
view.Margin = new Thickness(-4, -2, -4, -11);
|
||||
}
|
||||
else
|
||||
{
|
||||
view.Margin = new Thickness(-4, -7, -4, -11);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user