protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); BottomNavigationView navigation = FindViewById <BottomNavigationView>(Resource.Id.navigation); navigation.SetOnNavigationItemSelectedListener(this); BottomNavigationViewHelper.DisableShiftMode(navigation); fragmentManager = SupportFragmentManager; getTokenHandler = new Handler(); if (HttpClientUtil.accessToken == null || HttpClientUtil.accessToken.IsExpire || string.IsNullOrWhiteSpace(HttpClientUtil.accessToken.access_token)) { getTokenHandler.Post(async() => { await HttpClientUtil.GetCredentials(token => { AccessTokenShared.SaveAccessToken(this, token); HttpClientUtil.accessToken = token; SwicthFragment(Resource.Id.navigation_home); }, (error) => { ToastUtil.ToastShort(this, error); }); }); } else { SwicthFragment(Resource.Id.navigation_home); } }
private void InitView() { View view1 = LayoutInflater.Inflate(Resource.Layout.item_view_pager_1, null); View view2 = LayoutInflater.Inflate(Resource.Layout.item_view_pager_2, null); View view3 = LayoutInflater.Inflate(Resource.Layout.item_view_pager_3, null); View view4 = LayoutInflater.Inflate(Resource.Layout.item_view_pager_4, null); viewList = new List <View>(); viewList.Add(view1); viewList.Add(view2); viewList.Add(view3); viewList.Add(view4); viewPager = FindViewById <ViewPager>(Resource.Id.view_pager_bottom_navigation); viewPager.Adapter = new PageAdapter(); viewPager.AddOnPageChangeListener(new OnPageChange()); viewPager.SetPageTransformer(true, new BottomNavigationPageTransformer()); navigation = FindViewById <BottomNavigationView>(Resource.Id.bottom_navigation); navigation.SetOnNavigationItemSelectedListener(new OnNavigationItemSelected()); BottomNavigationViewHelper.disableShiftMode(navigation); }