summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/Cells
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2017-06-22 03:44:45 -0600
committerRui Marinho <me@ruimarinho.net>2017-06-22 10:44:45 +0100
commit7e4628e0dd645aae03358b4a74639a2feed64f0d (patch)
treefb86def90cfc70792b09b2512a1bca97c33fa25a /Xamarin.Forms.Platform.Android/Cells
parent67bc2d54882950ed947b21db2a93fb1f80dfde12 (diff)
downloadxamarin-forms-7e4628e0dd645aae03358b4a74639a2feed64f0d.tar.gz
xamarin-forms-7e4628e0dd645aae03358b4a74639a2feed64f0d.tar.bz2
xamarin-forms-7e4628e0dd645aae03358b4a74639a2feed64f0d.zip
Allow Context Actions on ViewCells with TapGestures (#985)
* Repro * Allow context menu actions on ViewCells with tap gestures * Make context menu test work for iOS * Make the ActivateContextMenu option work for items with small text
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Cells')
-rw-r--r--Xamarin.Forms.Platform.Android/Cells/ViewCellRenderer.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Android/Cells/ViewCellRenderer.cs b/Xamarin.Forms.Platform.Android/Cells/ViewCellRenderer.cs
index 48abb49b..75246220 100644
--- a/Xamarin.Forms.Platform.Android/Cells/ViewCellRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Cells/ViewCellRenderer.cs
@@ -63,6 +63,7 @@ namespace Xamarin.Forms.Platform.Android
_viewCell = viewCell;
AddView(view.View);
UpdateIsEnabled();
+ UpdateLongClickable();
}
protected bool ParentHasUnevenRows
@@ -84,6 +85,7 @@ namespace Xamarin.Forms.Platform.Android
{
if (!Enabled)
return true;
+
return base.OnInterceptTouchEvent(ev);
}
@@ -135,6 +137,7 @@ namespace Xamarin.Forms.Platform.Android
AddView(_view.View);
UpdateIsEnabled();
+ UpdateLongClickable();
Performance.Stop();
}
@@ -178,6 +181,14 @@ namespace Xamarin.Forms.Platform.Android
Performance.Stop();
}
+
+ void UpdateLongClickable()
+ {
+ // In order for context menu long presses/clicks to work on ViewCells which have
+ // and Clickable content, we have to make the container view LongClickable
+ // If we don't have a context menu, we don't have to worry about it
+ _view.View.LongClickable = _viewCell.ContextActions.Count > 0;
+ }
}
}
} \ No newline at end of file