public override bool OnOptionsItemSelected(IMenuItem item)
        {
            MyFragment fragement = FragmentManager.FindFragmentByTag <MyFragment>(MyFragment.PAGE_CONTENT);

            MyUtil.HideSoftKeyboard(this);

            switch (item.ItemId)
            {
            case Resource.Id.nav_home:
                MyUtil.GoPage(fragement, PAGE.HOME);
                return(true);

            case Resource.Id.nav_register:
                MyUtil.GoPage(fragement, PAGE.REGI);
                return(true);

            case Resource.Id.nav_list:
                MyUtil.GoPage(fragement, PAGE.LIST);
                return(true);

            default:
                if (drawerLayout.IsDrawerOpen(navigationView))
                {
                    drawerLayout.CloseDrawers();
                }
                else
                {
                    drawerLayout.OpenDrawer(navigationView);
                }
                return(true);
            }
        }
예제 #2
0
        public static void GoPage(MyFragment fragment, PAGE page)
        {
            MyAppCompatActivity.CURRENT_PAGE = page;

            FragmentTransaction ft = fragment.FragmentManager.BeginTransaction();

            if (page == PAGE.HOME)
            {
                ft.Replace(Resource.Id.page_placeholder, new PageMainFragment(), MyFragment.PAGE_CONTENT);
            }
            else if (page == PAGE.REGI)
            {
                ft.Replace(Resource.Id.page_placeholder, new PageRegisterFragment(), MyFragment.PAGE_CONTENT);
            }
            else if (page == PAGE.LIST)
            {
                ft.Replace(Resource.Id.page_placeholder, new PageListFragment(), MyFragment.PAGE_CONTENT);
            }
            ft.Commit();
        }
예제 #3
0
 public static void GoList(MyFragment fragment)
 {
     GoPage(fragment, PAGE.LIST);
 }
예제 #4
0
 public static void GoRegister(MyFragment fragment)
 {
     GoPage(fragment, PAGE.REGI);
 }
예제 #5
0
 public static void GoHome(MyFragment fragment)
 {
     GoPage(fragment, PAGE.HOME);
 }