1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-20 02:03:49 +00:00

Added reflection service to handle sizerequest for extendedtableview. Remove footer spacing on uitableview ios renderer.

This commit is contained in:
Kyle Spearrin
2016-07-03 02:57:09 -04:00
parent ec419a2306
commit b9c823b0aa
12 changed files with 121 additions and 3 deletions

View File

@@ -259,6 +259,7 @@
<Compile Include="Services\KeyStoreStorageService.cs" />
<Compile Include="MainActivity.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\ReflectionService.cs" />
<Compile Include="Services\SqlService.cs" />
</ItemGroup>
<ItemGroup>

View File

@@ -122,6 +122,7 @@ namespace Bit.Android
.RegisterType<IPushNotificationListener, PushNotificationListener>(new ContainerControlledLifetimeManager())
.RegisterType<IAppIdService, AppIdService>(new ContainerControlledLifetimeManager())
.RegisterType<IPasswordGenerationService, PasswordGenerationService>(new ContainerControlledLifetimeManager())
.RegisterType<IReflectionService, ReflectionService>(new ContainerControlledLifetimeManager())
// Repositories
.RegisterType<IFolderRepository, FolderRepository>(new ContainerControlledLifetimeManager())
.RegisterType<IFolderApiRepository, FolderApiRepository>(new ContainerControlledLifetimeManager())

View File

@@ -0,0 +1,34 @@
using System;
using System.Reflection;
using Bit.App.Abstractions;
using Bit.App.Controls;
using Xamarin.Forms;
namespace Bit.Android.Services
{
public class ReflectionService : IReflectionService
{
public Func<double, double, SizeRequest> GetVisualElementOnSizeRequest(ExtendedTableView tableView)
{
var handle = typeof(VisualElement).GetMethod(
"OnSizeRequest",
BindingFlags.Instance | BindingFlags.NonPublic,
null,
new Type[] { typeof(double), typeof(double) },
null)?.MethodHandle;
if(!handle.HasValue)
{
throw new ArgumentNullException("handle could not be found.");
}
var pointer = handle.Value.GetFunctionPointer();
if(pointer == null)
{
throw new ArgumentNullException("pointer could not be found.");
}
return (Func<double, double, SizeRequest>)Activator.CreateInstance(typeof(Func<double, double, SizeRequest>), tableView, pointer);
}
}
}