Ejemplo n.º 1
0
        private void HandleIllegalSlideChangeAttempt()
        {
            Fragment currentFragment = _pagerAdapter.GetItem(_pager.CurrentItem);

            if (currentFragment != null && currentFragment is ISlidePolicy)
            {
                ISlidePolicy slide = (ISlidePolicy)currentFragment;

                if (!slide.IsPolicyRespected())
                {
                    slide.OnUserIllegallyRequestedNextPage();
                }
            }
        }
Ejemplo n.º 2
0
        private bool HandleBeforeSlideChanged()
        {
            Fragment currentFragment = _pagerAdapter.GetItem(_pager.CurrentItem);

//            LogHelper.d(TAG, String.format(
//                "User wants to move away from slide: %s. Checking if this should be allowed...",
//                currentFragment));

            if (currentFragment is ISlidePolicy)
            {
                ISlidePolicy slide = (ISlidePolicy)currentFragment;

//                LogHelper.d(TAG, "Current fragment implements ISlidePolicy.");

                if (!slide.IsPolicyRespected())
                {
//                    LogHelper.d(TAG, "Slide policy not respected, denying change request.");
                    return(false);
                }
            }

            //LogHelper.d(TAG, "Change request will be allowed.");
            return(true);
        }