Beispiel #1
0
        private void selectItem(int position)
        {
            // update the main content by replacing fragments
            var fragment = DisplayFragment.NewInstance();

            if (position == 0)
            {
                fragment = DisplayFragment.NewInstance();
            }
            else if (position == 1)
            {
                fragment = SettingsFragment.NewInstance();
            }
            else if (position == 2)
            {
                fragment = HelpFragment.NewInstance();
            }

            var fragmentManager = this.FragmentManager;
            var ft = fragmentManager.BeginTransaction();

            ft.Replace(Resource.Id.content_frame, fragment);
            ft.Commit();

            // update selected item title, then close the drawer
            mDrawerLayout.CloseDrawer(mDrawerList);
        }
Beispiel #2
0
        public override Android.Support.V4.App.Fragment GetItem(int position)
        {
            switch (position)
            {
            case 0: return(VplanFragment.NewInstance(true));

            case 1: return(VplanFragment.NewInstance(false));

            case 2: return(SettingsFragment.NewInstance());
            }
            return(null);
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            AndroidX.Fragment.App.Fragment existingFragment;
            existingFragment = SupportFragmentManager.FindFragmentByTag("CHK");
            if (existingFragment != null)
            {
                SupportFragmentManager.PopBackStackImmediate(existingFragment.Id, 0);
            }
            existingFragment = SupportFragmentManager.FindFragmentByTag("STS");
            if (existingFragment != null)
            {
                SupportFragmentManager.PopBackStackImmediate(existingFragment.Id, 0);
            }
            existingFragment = SupportFragmentManager.FindFragmentByTag("ABT");
            if (existingFragment != null)
            {
                SupportFragmentManager.PopBackStackImmediate(existingFragment.Id, 0);
            }

            AndroidX.Fragment.App.Fragment fragment;
            if (item.ItemId == Resource.Id.menu_about)
            {
                _fragmentTag = "ABT";
                fragment     = AboutFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.aboutTitle);
                _navigation.Visibility = ViewStates.Gone;
                _menu.FindItem(Resource.Id.menu_share).SetVisible(false);
                SupportFragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, fragment, _fragmentTag).Commit();
            }

            if (item.ItemId == Resource.Id.menu_settings)
            {
                _fragmentTag = "SET";
                fragment     = SettingsFragment.NewInstance(_settingsService, Container.Resolve <IWorkerService>());
                SupportActionBar.SetTitle(Resource.String.settingsTitle);
                _navigation.Visibility = ViewStates.Gone;
                _menu.FindItem(Resource.Id.menu_share).SetVisible(false);
                SupportFragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, fragment, _fragmentTag).Commit();
            }

            _eventService.OnMenuItemPressedEvent(new MenuItemPressedEventArgs(item.TitleFormatted.ToString(), _fragmentTag));
            //_eventService.OnSpareEvent(new EventArgs());
            return(base.OnOptionsItemSelected(item));
        }
Beispiel #4
0
    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);
        SetContentView(Resource.Layout.layout_mainactivity);

        // create our fragments and initialise them early.
        if (FragmentList == null)
        {
            FragmentList = new Dictionary <string, Fragment>
            {
                { "main", MainFragment.NewInstance() },
                { "bugreport", BugReportFragment.NewInstance() },
                { "settings", SettingsFragment.NewInstance() }
            };
        }

        navigation = FindViewById <BottomNavigationView>(Resource.Id.bottom_nav);
        navigation.SetOnNavigationItemSelectedListener(this);
        navigation.SelectedItemId = Resource.Id.navigation_main;
    }
Beispiel #5
0
        private void selectItem(int position)
        {
            switch (position)
            {
            case 0:
            {
                //Dashboard
                fragment = DashboardFragment.NewInstance();
                var fragmentManager = this.FragmentManager;
                var ft = FragmentManager.BeginTransaction();
                ft.Replace(Resource.Id.content_frame, fragment);
                ft.Commit();
                break;
            }

            case 1:
            {
                //Settings
                var fragment        = SettingsFragment.NewInstance();
                var fragmentManager = this.FragmentManager;
                var ft = FragmentManager.BeginTransaction();
                ft.Replace(Resource.Id.content_frame, fragment);
                ft.Commit();
                break;
            }

            case 2:
                //Logout
                LogoutAsync();
                break;
            }

            // update selected item title, then close the drawer
            Title = mOptionsTitles [position];
            mDrawerLayout.CloseDrawer(mDrawerList);
        }
        private void ListItemClicked(int position)
        {
            //this way we don't load twice, but you might want to modify this a bit.
            if (position == oldPosition)
            {
                return;
            }

            oldPosition = position;

            Fragment fragment = null;

            switch (position)
            {
            case 0:
                fragment = FuelOrderFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.fuel_order_title);
                break;

            case 1:
                fragment = FuelCheckFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.fuel_check_title);
                break;

            case 2:
                fragment = BaggageDistributionFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.baggage_distribution_title);
                break;

            case 3:
                fragment = BrakeCoolingFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.brake_cooling_title);
                break;

            case 4:
                fragment = CircuitBreakerFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.circuit_breaker_title);
                break;

            case 5:
                fragment = ChecklistsFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.checklists_title);
                break;

            case 6:
                fragment = ManouversFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.manouvers_title);
                break;

            case 7:
                fragment = LimitationsFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.limitations_title);
                break;

            case 8:
                fragment = SettingsFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.settings_title);
                break;
            }
            eventService.OnForceFragmentBackStackEvent(new System.EventArgs());
            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.content_frame, fragment)
            .Commit();

            //var fragmentManagerTransaction = SupportFragmentManager.BeginTransaction();
            //fragmentManagerTransaction.Replace(Resource.Id.content_frame, fragment);
            //fragmentManagerTransaction.AddToBackStack(null);
            //fragmentManagerTransaction.Commit();
        }