public PaperOnboardingEngine(View rootLayout, List <PaperOnboardingPage> contentElements, Context appContext)
        {
            if (contentElements == null || contentElements.Count == 0)
            {
                throw new IllegalArgumentException("No content elements provided");
            }

            this.mElements.AddRange(contentElements);
            this.mAppContext = appContext.ApplicationContext;

            mRootLayout           = (RelativeLayout)rootLayout;
            mContentTextContainer = (FrameLayout)rootLayout.FindViewById(Resource.Id.onboardingContentTextContainer);
            mContentIconContainer = (FrameLayout)rootLayout.FindViewById(Resource.Id.onboardingContentIconContainer);
            mBackgroundContainer  = (FrameLayout)rootLayout.FindViewById(Resource.Id.onboardingBackgroundContainer);
            mPagerIconsContainer  = (LinearLayout)rootLayout.FindViewById(Resource.Id.onboardingPagerIconsContainer);

            mContentRootLayout        = (RelativeLayout)mRootLayout.GetChildAt(1);
            mContentCenteredContainer = (LinearLayout)mContentRootLayout.GetChildAt(0);

            this.dpToPixelsScaleFactor = this.mAppContext.Resources.DisplayMetrics.Density;

            InitializeStartingState();

            var swipeListener = new OnSwipeListener(mAppContext);

            swipeListener.OnSwipeLeft  += () => ToggleContent(false);
            swipeListener.OnSwipeRight += () => ToggleContent(true);
            mRootLayout.SetOnTouchListener(swipeListener);

            var customGlobalLayout = new CustomGlobalLayoutListener();

            customGlobalLayout.OnGlobalLayoutChanged += () => OnGlobalLayoutChanged(customGlobalLayout);
            mRootLayout.ViewTreeObserver.AddOnGlobalLayoutListener(customGlobalLayout);
        }
Example #2
0
 internal GestureListener(OnSwipeListener parent)
 {
     _parent = parent;
 }