2017-01-31 03:26:39 +03:00
|
|
|
|
using Bit.App.Models.Page;
|
|
|
|
|
using System;
|
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Bit.App.Controls
|
|
|
|
|
{
|
|
|
|
|
public class VaultListViewCell : LabeledDetailCell
|
|
|
|
|
{
|
2017-10-21 06:08:39 +03:00
|
|
|
|
public static readonly BindableProperty CipherParameterProperty = BindableProperty.Create(nameof(CipherParameter),
|
2017-10-19 04:35:33 +03:00
|
|
|
|
typeof(VaultListPageModel.Cipher), typeof(VaultListViewCell), null);
|
2017-01-31 03:26:39 +03:00
|
|
|
|
|
2017-10-19 04:35:33 +03:00
|
|
|
|
public VaultListViewCell(Action<VaultListPageModel.Cipher> moreClickedAction)
|
2017-01-31 03:26:39 +03:00
|
|
|
|
{
|
2017-10-21 06:08:39 +03:00
|
|
|
|
SetBinding(CipherParameterProperty, new Binding("."));
|
2017-10-19 04:35:33 +03:00
|
|
|
|
Label.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Cipher.Name));
|
|
|
|
|
Detail.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Cipher.Subtitle));
|
|
|
|
|
LabelIcon.SetBinding(VisualElement.IsVisibleProperty, nameof(VaultListPageModel.Cipher.Shared));
|
|
|
|
|
LabelIcon2.SetBinding(VisualElement.IsVisibleProperty, nameof(VaultListPageModel.Cipher.HasAttachments));
|
2017-01-31 03:26:39 +03:00
|
|
|
|
|
2017-10-20 20:03:04 +03:00
|
|
|
|
Button.Image = "more.png";
|
2017-10-21 06:08:39 +03:00
|
|
|
|
Button.Command = new Command(() => moreClickedAction?.Invoke(CipherParameter));
|
2017-01-31 03:26:39 +03:00
|
|
|
|
Button.BackgroundColor = Color.Transparent;
|
|
|
|
|
|
2017-10-20 20:03:04 +03:00
|
|
|
|
LabelIcon.Source = "share.png";
|
|
|
|
|
LabelIcon2.Source = "paperclip.png";
|
2017-04-24 22:00:55 +03:00
|
|
|
|
|
2017-01-31 03:26:39 +03:00
|
|
|
|
BackgroundColor = Color.White;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-21 06:08:39 +03:00
|
|
|
|
public VaultListPageModel.Cipher CipherParameter
|
2017-01-31 03:26:39 +03:00
|
|
|
|
{
|
2017-10-21 06:08:39 +03:00
|
|
|
|
get { return GetValue(CipherParameterProperty) as VaultListPageModel.Cipher; }
|
|
|
|
|
set { SetValue(CipherParameterProperty, value); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnBindingContextChanged()
|
|
|
|
|
{
|
|
|
|
|
Icon.Source = null;
|
|
|
|
|
if(BindingContext is VaultListPageModel.Cipher item)
|
|
|
|
|
{
|
|
|
|
|
if(item.Type == Enums.CipherType.Login)
|
|
|
|
|
{
|
|
|
|
|
Icon.LoadingPlaceholder = "login.png";
|
|
|
|
|
}
|
2017-10-23 20:08:46 +03:00
|
|
|
|
Icon.Source = item.Icon;
|
2017-10-21 06:08:39 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
base.OnBindingContextChanged();
|
2017-01-31 03:26:39 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|