Beispiel #1
0
        protected override void OnCreate(Bundle?savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(R.Layout.activity_bottom_bar);

            var fragList = new List <ScreenSlidePageFragment>
            {
                ScreenSlidePageFragment.NewInstance(GetString(R.String.home), R.Color.red_inactive),
                ScreenSlidePageFragment.NewInstance(GetString(R.String.search), R.Color.blue_inactive),
                ScreenSlidePageFragment.NewInstance(GetString(R.String.likes), R.Color.blue_grey_inactive),
                ScreenSlidePageFragment.NewInstance(GetString(R.String.notification), R.Color.green_inactive),
                ScreenSlidePageFragment.NewInstance(GetString(R.String.profile), R.Color.purple_inactive)
            };
            var pagerAdapter = new ScreenSlidePagerAdapter(fragList, SupportFragmentManager);

            var bubbleNavigationLinear = FindViewById <BubbleNavigationLinearView>(R.Id.bottom_navigation_view_linear) !;

            bubbleNavigationLinear.SetTypeface(Typeface.CreateFromAsset(Assets, "rubik.ttf"));
            bubbleNavigationLinear.SetBadgeValue(0, "40");
            bubbleNavigationLinear.SetBadgeValue(1, null); //invisible badge
            bubbleNavigationLinear.SetBadgeValue(2, "7");
            bubbleNavigationLinear.SetBadgeValue(3, "2");
            bubbleNavigationLinear.SetBadgeValue(4, ""); //empty badge

            var viewPager = FindViewById <ViewPager>(R.Id.view_pager) !;

            viewPager.Adapter = pagerAdapter;
            viewPager.PageScrollStateChanged += null;
            viewPager.PageScrolled           += null;
            viewPager.PageSelected           += (s, e) => bubbleNavigationLinear.SetCurrentActiveItem(e.Position);

            bubbleNavigationLinear.NavigationChange += (s, e) => viewPager.SetCurrentItem(e.Position, true);
        }
        protected override void OnCreate(Bundle?savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(R.Layout.activity_floating_top_bar);

            var floatingTopBarNavigation =
                FindViewById <BubbleNavigationConstraintView>(R.Id.floating_top_bar_navigation) !;

            floatingTopBarNavigation.SetTypeface(Typeface.CreateFromAsset(Assets, "rubik.ttf"));
            floatingTopBarNavigation.SetBadgeValue(0, "3");
            floatingTopBarNavigation.SetBadgeValue(1, "9+"); // Invisible badge

            var fragList = new List <ScreenSlidePageFragment>
            {
                ScreenSlidePageFragment.NewInstance(GetString(R.String.home), R.Color.red_inactive),
                ScreenSlidePageFragment.NewInstance(GetString(R.String.search), R.Color.blue_inactive),
                ScreenSlidePageFragment.NewInstance(GetString(R.String.likes), R.Color.blue_grey_inactive),
                ScreenSlidePageFragment.NewInstance(GetString(R.String.notification), R.Color.green_inactive)
            };
            var pagerAdapter = new ScreenSlidePagerAdapter(fragList, SupportFragmentManager);

            var viewPager = FindViewById <ViewPager>(R.Id.view_pager) !;

            viewPager.Adapter = pagerAdapter;

            // Disable swipe
            viewPager.SetOnTouchListener(
                new MyViewOnTouchListener((v, motionEvent) => true)
                );

            floatingTopBarNavigation.NavigationChange += (s, e) => viewPager.SetCurrentItem(e.Position, true);
        }
        protected override void OnCreate(Bundle?savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(R.Layout.activity_top_bar);

            var fragList = new List <ScreenSlidePageFragment>
            {
                ScreenSlidePageFragment.NewInstance(GetString(R.String.restaurant), R.Color.orange_inactive),
                ScreenSlidePageFragment.NewInstance(GetString(R.String.room), R.Color.red_inactive),
                ScreenSlidePageFragment.NewInstance(GetString(R.String.happy), R.Color.green_inactive)
            };
            var pagerAdapter = new ScreenSlidePagerAdapter(fragList, SupportFragmentManager);

            var viewPager = FindViewById <ViewPager>(R.Id.view_pager) !;
            var topNavigationConstraint = FindViewById <BubbleNavigationConstraintView>(R.Id.top_navigation_constraint) !;

            viewPager.Adapter = pagerAdapter;
            viewPager.PageScrollStateChanged += null;
            viewPager.PageScrolled           += null;
            viewPager.PageSelected           += (s, e) => topNavigationConstraint.SetCurrentActiveItem(e.Position);

            topNavigationConstraint.NavigationChange += (s, e) => viewPager.SetCurrentItem(e.Position, true);
        }