mirror of
https://github.com/bitwarden/android.git
synced 2024-12-20 08:12:26 +03:00
Added listview renderer that implements margins as contentinset. Added margin to vault listview.
This commit is contained in:
parent
527fc00e0a
commit
ecc15363b5
4 changed files with 44 additions and 2 deletions
|
@ -44,6 +44,7 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
var listView = new ListView
|
var listView = new ListView
|
||||||
{
|
{
|
||||||
|
Margin = new Thickness(0, 0, -15, 0),
|
||||||
IsGroupingEnabled = true,
|
IsGroupingEnabled = true,
|
||||||
ItemsSource = Folders,
|
ItemsSource = Folders,
|
||||||
HasUnevenRows = true,
|
HasUnevenRows = true,
|
||||||
|
|
|
@ -35,8 +35,7 @@ namespace Bit.iOS.Controls
|
||||||
detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage), UIControlState.Selected);
|
detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage), UIControlState.Selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
detailDisclosureButton.Frame = new CGRect(0f, 0f, 40f, 40f);
|
detailDisclosureButton.Frame = new CGRect(0f, 0f, 50f, 40f);
|
||||||
detailDisclosureButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
|
|
||||||
detailDisclosureButton.TouchUpInside += (sender, e) =>
|
detailDisclosureButton.TouchUpInside += (sender, e) =>
|
||||||
{
|
{
|
||||||
extendedCell.OnDisclousureTapped();
|
extendedCell.OnDisclousureTapped();
|
||||||
|
|
41
src/iOS/Controls/ListViewRenderer.cs
Normal file
41
src/iOS/Controls/ListViewRenderer.cs
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using UIKit;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Platform.iOS;
|
||||||
|
|
||||||
|
[assembly: ExportRenderer(typeof(ListView), typeof(Bit.iOS.Controls.ListViewRenderer))]
|
||||||
|
namespace Bit.iOS.Controls
|
||||||
|
{
|
||||||
|
public class ListViewRenderer : Xamarin.Forms.Platform.iOS.ListViewRenderer
|
||||||
|
{
|
||||||
|
protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
|
||||||
|
{
|
||||||
|
base.OnElementChanged(e);
|
||||||
|
|
||||||
|
var view = e.NewElement as ListView;
|
||||||
|
if(view != null)
|
||||||
|
{
|
||||||
|
SetMargin(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnElementPropertyChanged(sender, e);
|
||||||
|
if(e.PropertyName == View.MarginProperty.PropertyName)
|
||||||
|
{
|
||||||
|
SetMargin(Element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetMargin(ListView view)
|
||||||
|
{
|
||||||
|
Control.ContentInset = new UIEdgeInsets(
|
||||||
|
new nfloat(view.Margin.Top),
|
||||||
|
new nfloat(view.Margin.Left),
|
||||||
|
new nfloat(view.Margin.Bottom),
|
||||||
|
new nfloat(view.Margin.Right));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -109,6 +109,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Controls\ContentPageRenderer.cs" />
|
<Compile Include="Controls\ContentPageRenderer.cs" />
|
||||||
<Compile Include="Controls\ExtendedSwitchCellRenderer.cs" />
|
<Compile Include="Controls\ExtendedSwitchCellRenderer.cs" />
|
||||||
|
<Compile Include="Controls\ListViewRenderer.cs" />
|
||||||
<Compile Include="Controls\ExtendedViewCellRenderer.cs" />
|
<Compile Include="Controls\ExtendedViewCellRenderer.cs" />
|
||||||
<Compile Include="Controls\ExtendedTextCellRenderer.cs" />
|
<Compile Include="Controls\ExtendedTextCellRenderer.cs" />
|
||||||
<Compile Include="Controls\ExtendedTableViewRenderer.cs" />
|
<Compile Include="Controls\ExtendedTableViewRenderer.cs" />
|
||||||
|
|
Loading…
Reference in a new issue