Beispiel #1
0
        public override void OnBackPressed()
        {
            FragmentTransaction transaction = FragmentManager.BeginTransaction();

            transaction.Replace(Resource.Id.fragmentContainer, FragmentHome.Get());
            transaction.Commit();
        }
Beispiel #2
0
 void OnClick(NavBarAdapterClickEventArgs args)
 {
     if (items[args.Position].fragment != null)
     {
         FragmentTransaction transaction = c.FragmentManager.BeginTransaction();
         transaction.Replace(Resource.Id.fragmentContainer, FragmentHome.Get());
         transaction.Commit();
         c.Drawer.CloseDrawers();
     }
 }
Beispiel #3
0
        public List <Category> SetNavList()
        {
            navList = new List <Category>();

            Category Search = new Category
            {
                Color    = "#607D8B",
                Icon     = Resource.Drawable.ic_navbar_search,
                Name     = "Search",//TODO: change for multilang support
                fragment = FragmentHome.Get()
            }; navList.Add(Search);

            Category MapSearch = new Category
            {
                Color = "#9C27B0",
                Icon  = Resource.Drawable.ic_map,
                Name  = "MapSearch",//TODO: change for multilang support
            }; navList.Add(MapSearch);


            Category ImageSearch = new Category
            {
                Color = "#2196F3",
                Icon  = Resource.Drawable.ic_images,
                Name  = "Images",//TODO: change for multilang support
            }; navList.Add(ImageSearch);

            Category Videos = new Category
            {
                Color = "#9E9E9E",
                Icon  = Resource.Drawable.ic_youtube,
                Name  = "Videos",//TODO: change for multilang support
            }; navList.Add(Videos);

            Category Infos = new Category
            {
                Color = "#FF9800",
                Icon  = Resource.Drawable.ic_info,
                Name  = "Infos",//TODO: change for multilang support
            }; navList.Add(Infos);

            return(navList);
        }
Beispiel #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);


            RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.Main);
            EntityModel = new EntityViewModel();

            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            toolbar        = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            Drawer         = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            RecyclerNav    = FindViewById <RecyclerView>(Resource.Id.recyclerNav);
            RecyclerNav.SetAdapter(new NavBarAdapter(SetNavList(), this));
            RecyclerNav.SetLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.Vertical, false));

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;


            SetSupportActionBar(toolbar);
            if (SupportActionBar != null)
            {
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetDisplayShowTitleEnabled(false);
                SupportActionBar.SetHomeButtonEnabled(true);
                SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_action_menu);
            }
            // Set our view from the "main" layout resource

            if (FindViewById <FrameLayout>(Resource.Id.fragmentContainer).ChildCount <= 0)
            {
                FragmentTransaction transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragmentContainer, FragmentHome.Get());
                transaction.Commit();
            }
        }