From 81cd2e26f48a710c364cdd1eaf86f69f64705c95 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 8 Jun 2019 13:04:06 -0400 Subject: [PATCH] more button click command --- .../Renderers/CipherViewCellRenderer.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Android/Renderers/CipherViewCellRenderer.cs b/src/Android/Renderers/CipherViewCellRenderer.cs index a6cbab6c2..3e7775a99 100644 --- a/src/Android/Renderers/CipherViewCellRenderer.cs +++ b/src/Android/Renderers/CipherViewCellRenderer.cs @@ -56,6 +56,7 @@ namespace Bit.Droid.Renderers public void CellPropertyChanged(object sender, PropertyChangedEventArgs e) { var cipherCell = sender as CipherViewCell; + _cell.CipherViewCell = cipherCell; if(e.PropertyName == CipherViewCell.CipherProperty.PropertyName) { _cell.UpdateCell(cipherCell); @@ -89,6 +90,7 @@ namespace Bit.Droid.Renderers SharedIcon = view.FindViewById(Resource.Id.CipherCellSharedIcon); AttachmentsIcon = view.FindViewById(Resource.Id.CipherCellAttachmentsIcon); MoreButton = view.FindViewById(Resource.Id.CipherCellButton); + MoreButton.Click += MoreButton_Click; Icon.Typeface = _faTypeface; SharedIcon.Typeface = _faTypeface; @@ -100,6 +102,7 @@ namespace Bit.Droid.Renderers public CipherViewCell CipherViewCell { get; set; } public Element Element => CipherViewCell; + public IconImageView IconImage { get; set; } public TextView Icon { get; set; } public TextView Name { get; set; } @@ -152,6 +155,23 @@ namespace Bit.Droid.Renderers 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)]