protected void ToggleContent(bool prev) { int oldElementIndex = mActiveElementIndex; PaperOnboardingPage newElement = prev ? toggleToPreviousElement() : toggleToNextElement(); if (newElement == null) { if (prev && mOnLeftOutListener != null) { mOnLeftOutListener.OnLeftOut(); } if (!prev && mOnRightOutListener != null) { mOnRightOutListener.OnRightOut(); } return; } int newPagerPosX = calculateNewPagerPosition(mActiveElementIndex); // 1 - animate BG AnimatorSet bgAnimation = createBGAnimatorSet(newElement.BackgroundColor); // 2 - animate pager position Animator pagerMoveAnimation = ObjectAnimator.OfFloat(mPagerIconsContainer, "x", mPagerIconsContainer.GetX(), newPagerPosX); pagerMoveAnimation.SetDuration(ANIM_PAGER_BAR_MOVE_TIME); // 3 - animate pager icons AnimatorSet pagerIconAnimation = createPagerIconAnimation(oldElementIndex, mActiveElementIndex); // 4 animate content text ViewGroup newContentText = createContentTextView(newElement); mContentTextContainer.AddView(newContentText); AnimatorSet contentTextShowAnimation = createContentTextShowAnimation( mContentTextContainer.GetChildAt(mContentTextContainer.ChildCount - 2), newContentText); // 5 animate content icon ImageView newContentIcon = createContentIconView(newElement); mContentIconContainer.AddView(newContentIcon); AnimatorSet contentIconShowAnimation = createContentIconShowAnimation( mContentIconContainer.GetChildAt(mContentIconContainer.ChildCount - 2), newContentIcon); // 6 animate centering of all content Animator centerContentAnimation = createContentCenteringVerticalAnimation(newContentText, newContentIcon); centerContentAnimation.Start(); bgAnimation.Start(); pagerMoveAnimation.Start(); pagerIconAnimation.Start(); contentIconShowAnimation.Start(); contentTextShowAnimation.Start(); if (mOnChangeListener != null) { mOnChangeListener.OnPageChanged(oldElementIndex, mActiveElementIndex); } }
protected ImageView createContentIconView(PaperOnboardingPage PaperOnboardingPage) { ImageView contentIcon = new ImageView(mAppContext); contentIcon.SetImageResource(PaperOnboardingPage.ContentIconRes); FrameLayout.LayoutParams iconLP = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); iconLP.Gravity = GravityFlags.Center; contentIcon.LayoutParameters = (iconLP); return(contentIcon); }
protected ViewGroup createContentTextView(PaperOnboardingPage PaperOnboardingPage) { LayoutInflater vi = LayoutInflater.From(mAppContext); ViewGroup contentTextView = (ViewGroup)vi.Inflate(Resource.Layout.onboarding_text_content_layout, mContentTextContainer, false); TextView contentTitle = (TextView)contentTextView.GetChildAt(0); contentTitle.Text = PaperOnboardingPage.TitleText; TextView contentText = (TextView)contentTextView.GetChildAt(1); contentText.Text = PaperOnboardingPage.DescriptionText; return(contentTextView); }
public override bool Equals(Java.Lang.Object obj) { if (this == obj) { return(true); } if (obj == null) { return(false); } PaperOnboardingPage that = (PaperOnboardingPage)obj; if (bgColor != that.bgColor) { return(false); } if (titleColor != that.titleColor) { return(false); } if (descriptionColor != that.descriptionColor) { return(false); } if (contentIconRes != that.contentIconRes) { return(false); } if (bottomBarIconRes != that.bottomBarIconRes) { return(false); } if (titleText != null ? !titleText.Equals(that.titleText) : that.titleText != null) { return(false); } return(descriptionText != null?descriptionText.Equals(that.descriptionText) : that.descriptionText == null); }
protected void InitializeStartingState() { // Create bottom bar icons for all elements with big first icon for (int i = 0; i < mElements.Count; i++) { PaperOnboardingPage PaperOnboardingPage = mElements[i]; ViewGroup bottomBarIconElement = createPagerIconElement(PaperOnboardingPage.BottomBarIconRes, i == 0); mPagerIconsContainer.AddView(bottomBarIconElement); } // Initialize first element on screen PaperOnboardingPage activeElement = getActiveElement(); // initial content texts ViewGroup initialContentText = createContentTextView(activeElement); mContentTextContainer.AddView(initialContentText); // initial content icons ImageView initContentIcon = createContentIconView(activeElement); mContentIconContainer.AddView(initContentIcon); // initial bg color mRootLayout.SetBackgroundColor(activeElement.BackgroundColor); }