protected override void OnAttached() { _view = Control ?? Container; if (_view != null && Element is ITouchAndPressEffectConsumer touchAndPressEffectConsumer) { _view.Touch += OnViewOnTouch; _touchAndPressEffectConsumer = touchAndPressEffectConsumer; } }
protected override void OnAttached() { _view = Control ?? Container; if (Element is ITouchAndPressEffectConsumer touchAndPressEffectConsumer) { _effectConsumer = touchAndPressEffectConsumer; _view.PointerPressed += ViewOnPointerPressed; _view.PointerReleased += ViewOnPointerReleased; _view.PointerCanceled += ViewOnPointerCanceled; } }
private static void RestoreAnimation(View view, ITouchAndPressEffectConsumer touchAndPressEffectConsumer) { if (touchAndPressEffectConsumer.Animation != AnimationTypes.None) { Task.Run(async() => { if (touchAndPressEffectConsumer.Animation == AnimationTypes.Fade) { await view.FadeTo(1, 100); } else { await view.ScaleTo(1, 100); } }); } }
private static void SetAnimation(View view, ITouchAndPressEffectConsumer touchAndPressEffectConsumer) { if (touchAndPressEffectConsumer.Animation != AnimationTypes.None && view.IsEnabled && (touchAndPressEffectConsumer.Command == null || touchAndPressEffectConsumer.Command.CanExecute(touchAndPressEffectConsumer.CommandParameter))) { Task.Run(async() => { if (touchAndPressEffectConsumer.Animation == AnimationTypes.Fade) { await view.FadeTo(touchAndPressEffectConsumer.AnimationParameter.HasValue ? touchAndPressEffectConsumer.AnimationParameter.Value : 0.6, 100); } else { await view.ScaleTo(touchAndPressEffectConsumer.AnimationParameter.HasValue ? touchAndPressEffectConsumer.AnimationParameter.Value : 0.95, 100); } }); } }
public TouchAndPressGestureRecognizer(ITouchAndPressEffectConsumer touchAndPressEffectConsumer) { _touchAndPressEffectConsumer = touchAndPressEffectConsumer; }