TextView, Link click
Как обработать клик на ссылку, чтобы можно было по ней перейти?
_messageContainer.Touch += CheckForLongClick;
private void CheckForLongClick(object s, View.TouchEventArgs e)
{
Action action = BeforeLongClickAnimation;
Runnable runnableAction = new Runnable(action);
if (e.Event.Action == MotionEventActions.Down)
{
longPress = true;
handler.PostDelayed(runnableAction, 200);
}
else if (e.Event.Action == MotionEventActions.Up)
{
longPress = false;
handler.RemoveCallbacks(runnableAction);
}
else
{
longPress = false;
handler.RemoveCallbacks(runnableAction);
}
}
void BeforeLongClickAnimation()
{
if (longPress)
{
var anim = new ScaleAnimation(1f, 0.9f, 1f, 0.9f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);
anim.Duration = 300;
_rootLayout.StartAnimation(anim);
new Handler().PostDelayed(() => ((UserChatMessage)DataContext).SelectActionCommand?.Execute(), 200);
}
}