예제 #1
0
        public void setupViewPager(ViewPager viewPager)
        {
            PositionFragment f  = new PositionFragment(1);
            PositionFragment f2 = new PositionFragment(2);

            ViewPagerAdapter adapter = new ViewPagerAdapter((activity as AppCompatActivity).SupportFragmentManager);

            adapter.addFragment(f, "Angitt posisjon ");
            adapter.addFragment(f2, "Valgt posisjon");
            viewPager.Adapter = adapter;
            Henspe.Current.PositionFragment = f;
        }
예제 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            //((PreferenceUtil.AndroidSettings) PreferenceUtil.Settings).SettingsContext = this;
            SetContentView(Resource.Layout.acivity_onboarding);
            mSkipButton        = FindViewById <TextView>(Resource.Id.onboarding_skip_button);
            mNextButton        = FindViewById <TextView>(Resource.Id.onboarding_next_button);
            mSkipButton.Click += SkipButtonOnClick;

            titleText          = FindViewById <TextView>(Resource.Id.onboarding_title);
            animationView      = FindViewById <LottieAnimationView>(Resource.Id.onboarding_animation_view);
            mNextButton.Click += NextButtonOnClick;

            _mPager       = FindViewById <ViewPager>(Resource.Id.onboarding_pager);
            mPagerAdapter = new InitialPagerAdapter(SupportFragmentManager);

            OnboardingItemFragment f  = new OnboardingItemFragment(0);
            OnboardingItemFragment f2 = new OnboardingItemFragment(1);
            OnboardingItemFragment f3 = new OnboardingItemFragment(2);

            ViewPagerAdapter adapter = new ViewPagerAdapter((this as AppCompatActivity).SupportFragmentManager);

            adapter.addFragment(f, "");
            adapter.addFragment(f2, "");
            adapter.addFragment(f3, "");

            _mPager.Adapter       = adapter;
            _mPager.PageSelected += ViewPager_PageSelected;
            _mPager.AddOnPageChangeListener(this);
            _mPager.PageScrolled += OnViewPagerPageScrolled;
            var dots = FindViewById <TabLayout>(Resource.Id.dots);

            dots.SetupWithViewPager(_mPager, true); // <- magic here

            _mPager.SetOnPageChangeListener(new CirclePageChangeListener(_mPager, this, animationView));

            this.animationView.AddAnimatorListener(this);
            this.animationView.AddAnimatorUpdateListener(this);

            if (animationView.Animation == null)
            {
                animationView.EnableMergePathsForKitKatAndAbove(true);
                animationView.SetScaleType(ImageView.ScaleType.CenterInside);
                animationView.SetAnimation("intro.json");

                //   animationView.CancelAnimation();
                animationView.RepeatCount = 0;
                animationView.PlayAnimation();

                //    animationView.SetBackgroundColor(Color.Green);
            }
        }