mirror of
https://github.com/bitwarden/android.git
synced 2024-12-20 16:21:55 +03:00
Created extension for adjusting margins on entry fields for specific android API levels.
This commit is contained in:
parent
a7ba21f2f9
commit
2262e1c4c2
4 changed files with 28 additions and 15 deletions
|
@ -27,11 +27,7 @@ namespace Bit.App.Controls
|
||||||
stackLayout.Children.Add(Editor);
|
stackLayout.Children.Add(Editor);
|
||||||
|
|
||||||
Tapped += FormEditorCell_Tapped;
|
Tapped += FormEditorCell_Tapped;
|
||||||
|
Editor.AdjustMarginsForDevice();
|
||||||
if(Device.OS == TargetPlatform.Android)
|
|
||||||
{
|
|
||||||
Editor.Margin = new Thickness(-4, -2, -4, -10);
|
|
||||||
}
|
|
||||||
|
|
||||||
View = stackLayout;
|
View = stackLayout;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,21 +84,18 @@ namespace Bit.App.Controls
|
||||||
var deviceInfo = Resolver.Resolve<IDeviceInfoService>();
|
var deviceInfo = Resolver.Resolve<IDeviceInfoService>();
|
||||||
if(useLabelAsPlaceholder)
|
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);
|
Entry.Margin = new Thickness(0, 4, 0, -4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(deviceInfo.Version == 21)
|
Entry.AdjustMarginsForDevice();
|
||||||
{
|
|
||||||
Entry.Margin = new Thickness(-4, -2, -4, -11);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Entry.Margin = new Thickness(-4, -7, -4, -11);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,8 @@ namespace Bit.App.Controls
|
||||||
if(Device.OS == TargetPlatform.Android)
|
if(Device.OS == TargetPlatform.Android)
|
||||||
{
|
{
|
||||||
stackLayout.Spacing = 0;
|
stackLayout.Spacing = 0;
|
||||||
Picker.Margin = new Thickness(-4, -2, -4, -10);
|
|
||||||
}
|
}
|
||||||
|
Picker.AdjustMarginsForDevice();
|
||||||
|
|
||||||
Tapped += FormPickerCell_Tapped;
|
Tapped += FormPickerCell_Tapped;
|
||||||
|
|
||||||
|
|
|
@ -44,5 +44,25 @@ namespace Bit.App
|
||||||
entry.Focus();
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue