Esempio n. 1
0
                public override bool OnTouch( View v, MotionEvent e )
                {
                    // check to see if we should monitor navBar reveal
                    if ( e.Action == MotionEventActions.Down )
                    {
                        NavBarRevealTracker.BeginTracking( ScrollView.ScrollY );   
                    }
                    
                    if ( base.OnTouch( v, e ) == true )
                    {
                        return true;
                    }
                    else
                    {
                        switch ( e.Action )
                        {
                            case MotionEventActions.Move:
                            {
                                // if at any point during a move the task is no longer allowed to receive input,
                                // STOP SCROLLING. It means the user began panning out the view
                                if ( ParentTask.NavbarFragment.ShouldTaskAllowInput( ) == false )
                                {
                                    ScrollView.ScrollEnabled = false;
                                }

                                if ( Note != null )
                                {
                                    Note.TouchesMoved( new System.Drawing.PointF( e.GetX( ), e.GetY( ) ) );
                                }

                                break;
                            }

                            case MotionEventActions.Up:
                            {
                                if ( Note != null )
                                {
                                    AnimateTutorialScreen( false );

                                    bool urlLaunchesExternalBrowser = false;
                                    bool urlUsesRockImpersonation = false;

                                    string activeUrl = Note.TouchesEnded( new System.Drawing.PointF( e.GetX( ), e.GetY( ) ), out urlLaunchesExternalBrowser, out urlUsesRockImpersonation );

                                    // create a params object we can send to the parent
                                    UrlClickParams clickParams = new UrlClickParams()
                                    {
                                            UseExternalBrowser = urlLaunchesExternalBrowser,
                                            UseImpersonationToken = urlUsesRockImpersonation,
                                            Url = activeUrl
                                    };

                                    // again, only process this if we didn't create a note. We don't want to treat a double tap
                                    // like a request to view a note
                                    if ( DidGestureCreateNote == false )
                                    {
                                        if ( string.IsNullOrEmpty( activeUrl ) == false )
                                        {
                                            // if the url uses the rock impersonation token, it's safe to assume they tapped the takeaway.
                                            if ( urlUsesRockImpersonation )
                                            {
                                                MessageAnalytic.Instance.Trigger( MessageAnalytic.Takeaway, activeUrl );
                                            }

                                            ParentTask.OnClick( this, 0, clickParams );
                                        }
                                    }
                                }

                                ScrollView.ScrollEnabled = true;
                                MovingUserNote = false;

                                DidGestureCreateNote = false;

                                break;
                            }
                        }
                    }
                    return false;
                }
Esempio n. 2
0
                public override bool OnTouch(View v, MotionEvent e)
                {
                    // check to see if we should monitor navBar reveal
                    if (e.Action == MotionEventActions.Down)
                    {
                        NavBarRevealTracker.BeginTracking(ScrollView.ScrollY);
                    }

                    if (base.OnTouch(v, e) == true)
                    {
                        return(true);
                    }
                    else
                    {
                        switch (e.Action)
                        {
                        case MotionEventActions.Move:
                        {
                            // if at any point during a move the task is no longer allowed to receive input,
                            // STOP SCROLLING. It means the user began panning out the view
                            if (ParentTask.NavbarFragment.ShouldTaskAllowInput( ) == false)
                            {
                                ScrollView.ScrollEnabled = false;
                            }

                            if (Note != null)
                            {
                                Note.TouchesMoved(new System.Drawing.PointF(e.GetX( ), e.GetY( )));
                            }

                            break;
                        }

                        case MotionEventActions.Up:
                        {
                            if (Note != null)
                            {
                                // if the tutorial is showing, we don't want to do anything but hide it.
                                // This prevents a URL from changing the page when the user only intended to
                                // hide the tutorial.
                                if (TutorialShowing( ))
                                {
                                    AnimateTutorialScreen(false);
                                }
                                else
                                {
                                    bool urlLaunchesExternalBrowser = false;
                                    bool urlUsesRockImpersonation   = false;

                                    string activeUrl = Note.TouchesEnded(new System.Drawing.PointF(e.GetX( ), e.GetY( )), out urlLaunchesExternalBrowser, out urlUsesRockImpersonation);

                                    // create a params object we can send to the parent
                                    UrlClickParams clickParams = new UrlClickParams()
                                    {
                                        UseExternalBrowser    = urlLaunchesExternalBrowser,
                                        UseImpersonationToken = urlUsesRockImpersonation,
                                        Url = activeUrl
                                    };

                                    // again, only process this if we didn't create a note. We don't want to treat a double tap
                                    // like a request to view a note
                                    if (DidGestureCreateNote == false)
                                    {
                                        if (string.IsNullOrEmpty(activeUrl) == false)
                                        {
                                            // if the url uses the rock impersonation token, it's safe to assume they tapped the takeaway.
                                            if (urlUsesRockImpersonation)
                                            {
                                                MessageAnalytic.Instance.Trigger(MessageAnalytic.Takeaway, activeUrl);
                                            }

                                            ParentTask.OnClick(this, 0, clickParams);
                                        }
                                    }
                                }
                            }

                            ScrollView.ScrollEnabled = true;
                            MovingUserNote           = false;

                            DidGestureCreateNote = false;

                            break;
                        }
                        }
                    }
                    return(false);
                }