more button click command

This commit is contained in:
Kyle Spearrin 2019-06-08 13:04:06 -04:00
parent 95c07334d7
commit 81cd2e26f4

View file

@ -56,6 +56,7 @@ namespace Bit.Droid.Renderers
public void CellPropertyChanged(object sender, PropertyChangedEventArgs e) public void CellPropertyChanged(object sender, PropertyChangedEventArgs e)
{ {
var cipherCell = sender as CipherViewCell; var cipherCell = sender as CipherViewCell;
_cell.CipherViewCell = cipherCell;
if(e.PropertyName == CipherViewCell.CipherProperty.PropertyName) if(e.PropertyName == CipherViewCell.CipherProperty.PropertyName)
{ {
_cell.UpdateCell(cipherCell); _cell.UpdateCell(cipherCell);
@ -89,6 +90,7 @@ namespace Bit.Droid.Renderers
SharedIcon = view.FindViewById<TextView>(Resource.Id.CipherCellSharedIcon); SharedIcon = view.FindViewById<TextView>(Resource.Id.CipherCellSharedIcon);
AttachmentsIcon = view.FindViewById<TextView>(Resource.Id.CipherCellAttachmentsIcon); AttachmentsIcon = view.FindViewById<TextView>(Resource.Id.CipherCellAttachmentsIcon);
MoreButton = view.FindViewById<Android.Widget.Button>(Resource.Id.CipherCellButton); MoreButton = view.FindViewById<Android.Widget.Button>(Resource.Id.CipherCellButton);
MoreButton.Click += MoreButton_Click;
Icon.Typeface = _faTypeface; Icon.Typeface = _faTypeface;
SharedIcon.Typeface = _faTypeface; SharedIcon.Typeface = _faTypeface;
@ -100,6 +102,7 @@ namespace Bit.Droid.Renderers
public CipherViewCell CipherViewCell { get; set; } public CipherViewCell CipherViewCell { get; set; }
public Element Element => CipherViewCell; public Element Element => CipherViewCell;
public IconImageView IconImage { get; set; } public IconImageView IconImage { get; set; }
public TextView Icon { get; set; } public TextView Icon { get; set; }
public TextView Name { get; set; } public TextView Name { get; set; }
@ -152,6 +155,23 @@ namespace Bit.Droid.Renderers
Icon.Text = iconImage.Item1; Icon.Text = iconImage.Item1;
} }
} }
private void MoreButton_Click(object sender, EventArgs e)
{
if(CipherViewCell.ButtonCommand?.CanExecute(CipherViewCell.Cipher) ?? false)
{
CipherViewCell.ButtonCommand.Execute(CipherViewCell.Cipher);
}
}
protected override void Dispose(bool disposing)
{
if(disposing)
{
MoreButton.Click -= MoreButton_Click;
}
base.Dispose(disposing);
}
} }
[Android.Runtime.Preserve(AllMembers = true)] [Android.Runtime.Preserve(AllMembers = true)]